NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.39k stars 14.34k forks source link

Multiple libXNVCtrl in system after update #319167

Open VeilSilence opened 5 months ago

VeilSilence commented 5 months ago

Describe the bug

Greetings.

I'm currently using the Nvidia beta 555.52.04 driver. After an update, NixOS replaced libXNVCtrl-555.52.04 with libXNVCtrl-390.157 and libXNVCtrl-550.90.07. According to this pull request, this library is not tied to the driver version. However, now I have two versions of the library in my system, whereas before I had only libXNVCtrl-555.52.04, which matched my Nvidia driver version.

I would prefer to have only one version of the library, ideally matching the Nvidia driver version, to avoid any unexpected behavior. Is there something I should do on my end to achieve this?

Steps To Reproduce

Steps to reproduce the behavior:

  1. Be nvidia user.
  2. Update nix flake and rebuild.
  3. two libXNVCtrl appear.

Expected behavior

Having one libXNVCtrl in system and matched with nvidia driver version if possible.

Screenshots

изображение

Additional context

Add any other context about the problem here.

Notify maintainers

@aidalgol @kira-bruneau @Kiskae

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
  nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.9.3-xanmod1, NixOS, 24.11 (Vicuña), 24.11.20240609.c7b821b`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix Super) 2.22.0pre20240422_5ecd820`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/store/rljkm6h18fjvavm6l17jiil8glphc44f-source`

Add a :+1: reaction to issues you find important.

aidalgol commented 5 months ago

This really should have been pinged only @NixOS/cuda-maintainers. One of the people pinged was only involved with #318092 because it touched MangoHUD, and is not a maintainer of nvidia packages.

aidalgol commented 5 months ago

On NixOS, packages are not "on the system" in the same way that they are on other Linux distributions. libXNVCtrl-390.157 is part of your system profile, but is only in scope for packages that reference libXNVCtrl. That PR actually reverted changes that put libXNVCtrl into /run/opengl-driver/lib/, and after my series of PRs around libXNVCtrl the only things that should be different are,

So it should be that the only way you could have libXNVCtrl-390.157 in your system profile is if you have mangohud in your system profile. Is this the case?

VeilSilence commented 5 months ago

This really should have been pinged only @NixOS/cuda-maintainers. One of the people pinged was only involved with #318092 because it touched MangoHUD, and is not a maintainer of nvidia packages.

Oh, I just pinged everyone who participate in pull request. My apologizes. I'm using mangohud from Home-manager module.

If I'm using flake.lock from 5 days ago, nh ( nix helper ) show on rebuild:

[U.]  #068  libXNVCtrl                              390.157, 550.90.07 -> 555.42.02
aidalgol commented 5 months ago

I'm using mangohud from Home-manager module.

OK, that would be why, then. I'm not sure why the top level libXNVCtrl is that version in particular. I don't think anything needs fixing in nixpkgs, for the reasons discussed/mentioned in https://github.com/NixOS/nixpkgs/pull/318092, https://github.com/NixOS/nixpkgs/pull/318092#pullrequestreview-2105412242, https://github.com/NixOS/nixpkgs/issues/314289#issuecomment-2144037037, and https://github.com/NixOS/nixpkgs/pull/312811#discussion_r1613495768. If you experience any unexpected behaviour with MangoHUD, then we would want to rule out the RPATH change from #318092 as a possible cause.

To reiterate, libXNVCtrl-390.157 is only visible to mangohud on your system. It cannot cause problems for anything else, because nothing else will see it.

SomeoneSerge commented 5 months ago

@VeilSilence thanks for noticing!

The impure deployment of the library via hardware.opengl.extraPackages was a compromise, and so, to an extent, is the new approach. Multiple versions of the library sneaking into the closure is a possible side-effect, maybe we could polish this further. Could you post the outputs of nix why-depends /run/current-system /nix/store/.../libXNVCTRL-...so for each version of the library? You can also use nixpkgs#nix-tree for the purpose

Kiskae commented 5 months ago

@VeilSilence thanks for noticing!

The impure deployment of the library via hardware.opengl.extraPackages was a compromise, and so, to an extent, is the new approach. Multiple versions of the library sneaking into the closure is a possible side-effect, maybe we could polish this further. Could you post the outputs of nix why-depends /run/current-system /nix/store/.../libXNVCTRL-...so for each version of the library? You can also use nixpkgs#nix-tree for the purpose

The impure deployment has been removed in one of the PRs linked above. Since it's an interface to a versioned X protocol extension it doesn't actually matter what version you use as a client.

SomeoneSerge commented 5 months ago

The impure deployment has been removed in one of the PRs linked above. Since it's an interface to a versioned X protocol extension it doesn't actually matter what version you use as a client.

Letting multiple versions of the library into the closure is redundant, and if we can cut that off we should. I lost the reference, but I must've had mentioned in one of those issues/PRs that if we believe libXNVCtrl isn't tied to the particular nvidia_x11 we should move it to the top-level (pkgs/by-name). That would, on one hand, make it easier to have a single fix-point for the package, and on the other that'd let us avoid referencing concrete linuxPackages from Nixpkgs (which is usually a mistake but in case of libXNVCtrl a compromise)

VeilSilence commented 5 months ago

@VeilSilence thanks for noticing!

The impure deployment of the library via hardware.opengl.extraPackages was a compromise, and so, to an extent, is the new approach. Multiple versions of the library sneaking into the closure is a possible side-effect, maybe we could polish this further. Could you post the outputs of nix why-depends /run/current-system /nix/store/.../libXNVCTRL-...so for each version of the library? You can also use nixpkgs#nix-tree for the purpose

nix why-depends /run/current-system /nix/store/.../libXNVCTRL-...so
error: getting status of '/nix/store/.../libXNVCTRL-...so': No such file or directory

❯  nix why-depends /run/current-system /nix/store/.../libXNVCtrl-...so
error: getting status of '/nix/store/.../libXNVCtrl-...so': No such file or directory
find /nix/store -name 'libXNVCtrl*'

```shell ❯ find /nix/store -name 'libXNVCtrl*' /nix/store/xmr8a99y0a7xfjiaxghbhi47d7b1khdh-libXNVCtrl-390.157/lib/libXNVCtrl.a /nix/store/xmr8a99y0a7xfjiaxghbhi47d7b1khdh-libXNVCtrl-390.157/lib/libXNVCtrl.so.0.0.0 /nix/store/xmr8a99y0a7xfjiaxghbhi47d7b1khdh-libXNVCtrl-390.157/lib/libXNVCtrl.so /nix/store/xmr8a99y0a7xfjiaxghbhi47d7b1khdh-libXNVCtrl-390.157/lib/libXNVCtrl.so.0 /nix/store/cp6gmfn98pbl1xj4sfwrvild9wav8v1q-libXNVCtrl-550.90.07/lib/libXNVCtrl.a /nix/store/cp6gmfn98pbl1xj4sfwrvild9wav8v1q-libXNVCtrl-550.90.07/lib/libXNVCtrl.so /nix/store/cp6gmfn98pbl1xj4sfwrvild9wav8v1q-libXNVCtrl-550.90.07/lib/libXNVCtrl.so.0 /nix/store/cp6gmfn98pbl1xj4sfwrvild9wav8v1q-libXNVCtrl-550.90.07/lib/libXNVCtrl.so.0.0.0 /nix/store/zibhj33r9s7b04gjjkfxx05md0rfjmlj-source/src/libXNVCtrl /nix/store/zibhj33r9s7b04gjjkfxx05md0rfjmlj-source/src/libXNVCtrlAttributes /nix/store/223k1ryry4m6a47nhq6bgjqyxs1wc32m-libXNVCtrl-555.42.02/lib/libXNVCtrl.a /nix/store/223k1ryry4m6a47nhq6bgjqyxs1wc32m-libXNVCtrl-555.42.02/lib/libXNVCtrl.so /nix/store/223k1ryry4m6a47nhq6bgjqyxs1wc32m-libXNVCtrl-555.42.02/lib/libXNVCtrl.so.0 /nix/store/223k1ryry4m6a47nhq6bgjqyxs1wc32m-libXNVCtrl-555.42.02/lib/libXNVCtrl.so.0.0.0 /nix/store/0jzfva7wwmzfgzya3a1wfkbjf3y16xb6-source/src/libXNVCtrl /nix/store/0jzfva7wwmzfgzya3a1wfkbjf3y16xb6-source/src/libXNVCtrlAttributes /nix/store/48ky96zh3137j5062gy71xhplr8g9f8d-opengl-drivers/lib/libXNVCtrl.a /nix/store/48ky96zh3137j5062gy71xhplr8g9f8d-opengl-drivers/lib/libXNVCtrl.so /nix/store/48ky96zh3137j5062gy71xhplr8g9f8d-opengl-drivers/lib/libXNVCtrl.so.0 /nix/store/48ky96zh3137j5062gy71xhplr8g9f8d-opengl-drivers/lib/libXNVCtrl.so.0.0.0 /nix/store/67nlnnmh10h3ls404021rfdlrf41by6n-steam-run-usr-target/lib/libXNVCtrl.a /nix/store/67nlnnmh10h3ls404021rfdlrf41by6n-steam-run-usr-target/lib/libXNVCtrl.so /nix/store/67nlnnmh10h3ls404021rfdlrf41by6n-steam-run-usr-target/lib/libXNVCtrl.so.0 /nix/store/67nlnnmh10h3ls404021rfdlrf41by6n-steam-run-usr-target/lib/libXNVCtrl.so.0.0.0 /nix/store/2k8khh265gmj84g6slbr6zfq9p03q1dp-steam-usr-target/lib/libXNVCtrl.a /nix/store/2k8khh265gmj84g6slbr6zfq9p03q1dp-steam-usr-target/lib/libXNVCtrl.so /nix/store/2k8khh265gmj84g6slbr6zfq9p03q1dp-steam-usr-target/lib/libXNVCtrl.so.0 /nix/store/2k8khh265gmj84g6slbr6zfq9p03q1dp-steam-usr-target/lib/libXNVCtrl.so.0.0.0 /nix/store/3nidy6sd5migll8llpdl2512yqr66008-steam-run-fhs/usr/lib64/libXNVCtrl.a /nix/store/3nidy6sd5migll8llpdl2512yqr66008-steam-run-fhs/usr/lib64/libXNVCtrl.so /nix/store/3nidy6sd5migll8llpdl2512yqr66008-steam-run-fhs/usr/lib64/libXNVCtrl.so.0 /nix/store/3nidy6sd5migll8llpdl2512yqr66008-steam-run-fhs/usr/lib64/libXNVCtrl.so.0.0.0 /nix/store/nwj2vlj8b0fp31a7fxns7658p2ilbb9x-steam-fhs/usr/lib64/libXNVCtrl.a /nix/store/nwj2vlj8b0fp31a7fxns7658p2ilbb9x-steam-fhs/usr/lib64/libXNVCtrl.so /nix/store/nwj2vlj8b0fp31a7fxns7658p2ilbb9x-steam-fhs/usr/lib64/libXNVCtrl.so.0 /nix/store/nwj2vlj8b0fp31a7fxns7658p2ilbb9x-steam-fhs/usr/lib64/libXNVCtrl.so.0.0.0 ```

nix why-depends again

```shell  ~ ❯ nix why-depends /run/current-system /nix/store/xmr8a99y0a7xfjiaxghbhi47d7b1khdh-libXNVCtrl-390.157/lib/libXNVCtrl.a /nix/store/rw780dk85jg0982aq9ad2pqsr62yszqd-nixos-system-Nix-graphical-workstation-24.11.20240609.c7b821b └───/nix/store/j8djnra1xpyx55gz2nky6gazxgvp3y40-etc └───/nix/store/igqxc6nycap61frm1271g25zppsk5sb9-user-environment └───/nix/store/nw2fgk3d2040yrmh17ya9lyg34306aiv-home-manager-path └───/nix/store/r6sihahiahkdwd1pf6ry47yxk34rg59k-mangohud-0.7.2 └───/nix/store/b5i61k79ardwi0mahgr9s2bnajmxbylx-mangohud-0.7.2 └───/nix/store/xmr8a99y0a7xfjiaxghbhi47d7b1khdh-libXNVCtrl-390.157  ~ ❯ nix why-depends /run/current-system /nix/store/cp6gmfn98pbl1xj4sfwrvild9wav8v1q-libXNVCtrl-550.90.07/lib/libXNVCtrl.a /nix/store/rw780dk85jg0982aq9ad2pqsr62yszqd-nixos-system-Nix-graphical-workstation-24.11.20240609.c7b821b └───/nix/store/j8djnra1xpyx55gz2nky6gazxgvp3y40-etc └───/nix/store/igqxc6nycap61frm1271g25zppsk5sb9-user-environment └───/nix/store/nw2fgk3d2040yrmh17ya9lyg34306aiv-home-manager-path └───/nix/store/r6sihahiahkdwd1pf6ry47yxk34rg59k-mangohud-0.7.2 └───/nix/store/cp6gmfn98pbl1xj4sfwrvild9wav8v1q-libXNVCtrl-550.90.07  ~ ❯ nix why-depends /run/current-system /nix/store/223k1ryry4m6a47nhq6bgjqyxs1wc32m-libXNVCtrl-555.42.02/lib/libXNVCtrl.a '/nix/store/rw780dk85jg0982aq9ad2pqsr62yszqd-nixos-system-Nix-graphical-workstation-24.11.20240609.c7b821b' does not depend on '/nix/store/223k1ryry4m6a47nhq6bgjqyxs1wc32m-libXNVCtrl-555.42.02' ```

Mangohud for some reason pull two times libXNVCtrl? Even though my nvidia driver is 555.52.04 currently.

Kiskae commented 5 months ago

I suspect thats the 32-bit version of mangohud, since the newer drivers don't support it anymore.

https://github.com/NixOS/nixpkgs/blob/9d0b1700fbb4bffea4ed4f30706113f6f17ce19a/pkgs/os-specific/linux/nvidia-x11/default.nix#L33

I'm actually wondering why nvidia-settings depends on the driver at all, since it goes through libXNVCtrl and libnvidia-ml for its functionality. And it should be fine to compile libXNVCtrl as 32-bit even for newer drivers.