Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install via DKMS after git upgrade 2.35.2 or later #346

Closed
1 of 11 tasks
jaimetavares-code opened this issue Apr 13, 2022 · 19 comments
Closed
1 of 11 tasks

Can't install via DKMS after git upgrade 2.35.2 or later #346

jaimetavares-code opened this issue Apr 13, 2022 · 19 comments

Comments

@jaimetavares-code
Copy link

jaimetavares-code commented Apr 13, 2022

Severity / Impact

  • I've read the docs and the bug reporting instructions
  • I've applied the latest firmware update to the controller
  • It does not work at all
  • It used to work in a previous version
  • It mostly works but sometimes it doesn't
  • I found a work-around
  • I probably didn't figure it all out but it's too early to give up
  • I don't know how to ...
  • It's too complicated
  • Fantastic work but ...
  • I can code and I want to help

Describe the Bug

After following the prerequisites and installation commands, I cloned the repository and attempted to run the install command sudo ./install.sh, only to see the following output: sed: can't read lib/../VERSION: No such file or directory

Steps to Reproduce

Clone repository;
Access xpadneo folder;
Open terminal in folder;
Type: sudo ./install.sh and press enter

Expected Behavior

xpadneo to install.

System Information

Pop!_OS 21.10

# uname -a
Linux pop-os 5.16.15-76051615-generic #202203161444~1647964027~21.10~e706226 SMP PREEMPT Tue Mar 22 17 x86_64 x86_64 x86_64 GNU/Linux

Additional Context

Attempted to install xpadneo, today, on Linux Mint 20.3 as well, also had a sed error.

@kakra
Copy link
Collaborator

kakra commented Apr 13, 2022

Which download link did you use?

@readtedium
Copy link

readtedium commented Apr 14, 2022

Ditto, used the default download link in the readme. (On latest ArcoLinux over this way, but the result is basically the same as what happened in the top comment.)

@kakra
Copy link
Collaborator

kakra commented Apr 14, 2022

Okay, so it probably boils down to sed then... What's the sed error exactly?

@tb936
Copy link

tb936 commented Apr 14, 2022

getting this same issue, this is the output when using the verbose option

  • verbose mode enabled
  • source lib/installer.sh
    ++ '[' 0 -ne 0 ']'
    +++ git rev-parse --show-toplevel
    +++ true
    ++ GIT_ROOT=
    +++ __version
    +++ git describe --tags --dirty
    ++++ dirname lib/installer.sh
    +++ sed '-res/v?(.*)/v\1/' lib/../VERSION
    sed: can't read lib/../VERSION: No such file or directory
    ++ VERSION=

EDIT: this started happening after updating from kernel 5.17.1 -> 5.17.2

@Yasand123
Copy link

Yasand123 commented Apr 15, 2022

sed: can't read lib/../VERSION: No such file or directory
Started happening just today after upgrading the system. Using ArchLinux 5.17.3-arch1-1.

@EwokExile
Copy link

I had the same thing happen on a recent kernal update on Manjaro unstable, switching to the AUR version allowed me to get things running again for now

@medusalix
Copy link

@kakra This issue is probably caused by the recent Git vulnerability (CVE-2022-24765) that has been fixed in v2.35.2 (see this blog post).
The installer calls git describe which fails with fatal: unsafe repository ('/home/abc/xpadneo' is owned by someone else) because the script is running as root while the repository is owned by your local user. The fallback to sed is somehow failing (which should be investigated) but the root cause is basically the Git vulnerability fix.
I'm hitting the same issue with xone.

@Yasand123
Copy link

@kakra This issue is probably caused by the recent Git vulnerability (CVE-2022-24765) that has been fixed in v2.35.2 (see this blog post). The installer calls git describe which fails with fatal: unsafe repository ('/home/abc/xpadneo' is owned by someone else) because the script is running as root while the repository is owned by your local user. The fallback to sed is somehow failing (which should be investigated) but the root cause is basically the Git vulnerability fix. I'm hitting the same issue with xone.

Can confirm, downgrading to git v2.35.1 allowed me to reinstall just fine.

@kakra
Copy link
Collaborator

kakra commented Apr 15, 2022

Ah okay... Gentoo does not provide this version yet because they investigate how this affects usage in Portage. The package is available but masked from installation. I'll try to setup the sandbox to find an idea how to work around this issue.

@kakra
Copy link
Collaborator

kakra commented Apr 15, 2022

The fallback to sed is somehow failing (which should be investigated)

It fails because the VERSION file does not exist. Archive downloads from a tagged version will include this file, so in that case git will fail and use the VERSION file instead. But if installing from a git checkout, there's no such file and it will be derived from the git checkout itself. So this is expected although it could be documented better.

@AerosolSP
Copy link

The fallback to sed is somehow failing (which should be investigated)

It fails because the VERSION file does not exist. Archive downloads from a tagged version will include this file, so in that case git will fail and use the VERSION file instead. But if installing from a git checkout, there's no such file and it will be derived from the git checkout itself. So this is expected although it could be documented better.

I'm an idiot and can't parse this to figure out what the actual fix is. I just installed Zorin OS fresh today this is the first thing I started fiddling with.

@the-questjon
Copy link

I can confirm this same issue on Pop OS 21.10, Zorin 16, Kubuntu 20.04.4

I opened this issue #348, will close and follow here.

@kakra kakra changed the title Can't install via DKMS Can't install via DKMS after git upgrade 2.35.2 or later Apr 16, 2022
@kakra kakra pinned this issue Apr 16, 2022
@Joomsy
Copy link

Joomsy commented Apr 16, 2022

I'm an idiot and can't parse this to figure out what the actual fix is. I just installed Zorin OS fresh today this is the first thing I started fiddling with.

Not a fix, but a workaround is simple enough. Just drop to a root shell, clone the repo somewhere, and run the install script. To overly simplify the problem, it's a permissions issue. The install script has to be ran as root, but it sources files that aren't owned by root when the repo is cloned by your user, thus causing it to fail thanks to new security implemented into Git.

Worked just fine for me on Pop 21.10 with xanmod stable:

root@wedge /usr/local/src/xpadneo                                                             [16:13:52]
> # ./install.sh                                                                             [±master ✓]
* creating dkms.conf
* adding hid-xpadneo-v0.9-96-g4fd620c folder to /usr/src
* installing module (using DKMS)

Creating symlink /var/lib/dkms/hid-xpadneo/v0.9-96-g4fd620c/source ->
                 /usr/src/hid-xpadneo-v0.9-96-g4fd620c

DKMS: add completed.

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
make -j8 KERNELRELEASE=5.15.34-xanmod1 -C /lib/modules/5.15.34-xanmod1/build M=/var/lib/dkms/hid-xpadneo/v0.9-96-g4fd620c/build/src VERSION=v0.9-96-g4fd620c modules...
cleaning build area...

DKMS: build completed.

hid-xpadneo.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.15.34-xanmod1/kernel/drivers/hid/

Running the post_install script:
Not disabling ERTM, kernel version doesn't require it...
Installing modalias database...
Installing udev rules...
Reloading udev...

depmod...

DKMS: install completed.

@SonGoku90
Copy link

On linux mint cinnamon 20.3 this workaround does not work.

@Joomsy
Copy link

Joomsy commented Apr 22, 2022

On linux mint cinnamon 20.3 this workaround does not work.

You did something wrong then. I just set up a Mint 20.3 VM, and was able to install xpadneo without any problems. Use these commands:

sudo su -
cd /usr/local/src
git clone https://github.com/atar-axis/xpadneo.git && cd xpadneo
./install.sh

@AerosolSP
Copy link

Worked for me. Cheers.

@SonGoku90
Copy link

On linux mint cinnamon 20.3 this workaround does not work.

You did something wrong then. I just set up a Mint 20.3 VM, and was able to install xpadneo without any problems. Use these commands:

sudo su -
cd /usr/local/src
git clone https://github.com/atar-axis/xpadneo.git && cd xpadneo
./install.sh

It works thanks, I did it wrong in the beginning.

@Paulemeister

This comment was marked as off-topic.

@kakra
Copy link
Collaborator

kakra commented May 4, 2022

Well, you can create the version file before running install with make -C hid-xpadneo ../VERSION, then run the installer. But the version file won't become cleaned up that way when you update the source tree later, so you'd need to delete it after installation. This file will only be tracked in the stable versioned branches, there's no way to properly track that in the development branch.

If you install from the development branch, you should probably add the git directory as trusted so a different user can safely use the git repository: That's actually what happens during install: The installer runs as root, and then tries to generate the version file but now the git repo is not trustable for the root user.

You can probably run sudo git config --global --add safe.directory $PWD once from the repo directory to fix that for future installations: The installer should now be able to create an intermediate version file by inspecting the git status. I cannot currently verify this because Gentoo didn't switch to the new Git version for obvious reasons (it's an integral part of the package manager).

You could also simply checkout the git repository with the root user so users match.

@Paulemeister Please do not use or recommend using version files from a different archive as it will mess up our reports here (reported code and version won't match). If you want to have a version file tracked (which we actually DO have), checkout the stable versioned branches. I thus hide your comment. Thanks.

kakra added a commit to kakra/xpadneo that referenced this issue May 25, 2022
Git 2.35.2 added a trust model to prevent user scripts and hooks of git
repositories to be executed with elevated privileges by accident. This
prevents the installer from getting the repository version when the
repository was checked out by a non-root user.

This commit adds an error message to suggest trusting the repository
and also links to the bug report for further details.

Fixes: atar-axis#346
Signed-off-by: Kai Krakow <[email protected]>
kakra added a commit that referenced this issue May 26, 2022
Git 2.35.2 added a trust model to prevent user scripts and hooks of git
repositories to be executed with elevated privileges by accident. This
prevents the installer from getting the repository version when the
repository was checked out by a non-root user.

This commit adds an error message to suggest trusting the repository
and also links to the bug report for further details.

Fixes: #346
Signed-off-by: Kai Krakow <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests