Cant update NVIDIA driver on stable branch

I am getting a GPL-only symbol error when trying to upgrade from kernel 6.1.75 to 6.1.76 with the NVIDIA-Linux-x86_64-545.29.02 driver. I have tried with both open kernel mods and closed kernel mods.
I have my configuration listed on my gitlab at Daniel McLarty / NixOS Config · GitLab.
Here is the output of the failing install:

building the system configuration...
error: builder for '/nix/store/4n0fb6y3d1vyqbgnpflwm7q69s92dzn2-nvidia-x11-545.29.02-6.1.76.drv' failed with exit code 2;
       last 10 log lines:
       >   LD [M]  /build/NVIDIA-Linux-x86_64-545.29.02/kernel/nvidia-drm.o
       >   LD [M]  /build/NVIDIA-Linux-x86_64-545.29.02/kernel/nvidia-peermem.o
       >   MODPOST /build/NVIDIA-Linux-x86_64-545.29.02/kernel/Module.symvers
       > ERROR: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol '__rcu_read_lock'
       > ERROR: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol '__rcu_read_unlock'
       > make[3]: *** [/nix/store/kpwm0vhi68njzhcqfbym2jj4jp9h740x-linux-6.1.76-dev/lib/modules/6.1.76/source/scripts/Makefile.modpost:126: /build/NVIDIA-Linux-x86_64-545.29.02/kernel/Module.symvers] Error 1
       > make[2]: *** [/nix/store/kpwm0vhi68njzhcqfbym2jj4jp9h740x-linux-6.1.76-dev/lib/modules/6.1.76/source/Makefile:1966: modpost] Error 2
       > make[1]: *** [Makefile:238: __sub-make] Error 2
       > make[1]: Leaving directory '/nix/store/kpwm0vhi68njzhcqfbym2jj4jp9h740x-linux-6.1.76-dev/lib/modules/6.1.76/source'
       > make: *** [Makefile:82: modules] Error 2
       For full logs, run 'nix log /nix/store/4n0fb6y3d1vyqbgnpflwm7q69s92dzn2-nvidia-x11-545.29.02-6.1.76.drv'.
error: 1 dependencies of derivation '/nix/store/bdz44ykppdk30f9z6783y31lw4z7lx8v-etc.drv' failed to build
error: 1 dependencies of derivation '/nix/store/whn97fmkyalv62m9gycrs4l6i7lff8hr-firmware.drv' failed to build
error: 1 dependencies of derivation '/nix/store/d7zdnvg98zd9fnq0ljm7kdygqm0kyybr-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/m9dr76nzb2dw9nv3n0hq14wnsn49z1hm-nixos-system-danielpc-23.11.20240201.25e3d4c.drv' failed to build

Any help would be nice, my system will still boot but until I can build an image I cant update anything or install any new apps.
I hear on Gentoo you can just compile the kernel with a workaround, but I have no clue how you would do the same on NixOS and I dont feel like compiling a kernel for every update.

1 Like

I have the same issue and more.

  LD [M]  /build/NVIDIA-Linux-x86_64-545.29.02/kernel/nvidia-peermem.o
  MODPOST /build/NVIDIA-Linux-x86_64-545.29.02/kernel/Module.symvers
ERROR: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol '__rcu_read_lock'
ERROR: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol '__rcu_read_unlock'
make[3]: *** [/nix/store/kpwm0vhi68njzhcqfbym2jj4jp9h740x-linux-6.1.76-dev/lib/modules/6.1.76/source/scripts/Makefile.modpost:126: /build/NVIDIA-Linux-x86_64-545.29.02/kernel/Module.symvers] Error 1
make[2]: *** [/nix/store/kpwm0vhi68njzhcqfbym2jj4jp9h740x-linux-6.1.76-dev/lib/modules/6.1.76/source/Makefile:1966: modpost] Error 2
make[1]: *** [Makefile:238: __sub-make] Error 2
make[1]: Leaving directory '/nix/store/kpwm0vhi68njzhcqfbym2jj4jp9h740x-linux-6.1.76-dev/lib/modules/6.1.76/source'
make: *** [Makefile:82: modules] Error 2
error: builder for '/nix/store/4n0fb6y3d1vyqbgnpflwm7q69s92dzn2-nvidia-x11-545.29.02-6.1.76.drv' failed with exit code 2
error: 1 dependencies of derivation '/nix/store/fqr6j831dy9ywrsa34yjwixhd8xgjnlv-kernel-modules.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ml17cmgv4aixkpqb8fc4ffrkfzljb76m-linux-6.1.76-modules.drv' failed to build
error: 1 dependencies of derivation '/nix/store/0jj2hf7w515jdf1hrh0prl3mpikh8xjs-nvidia-settings-545.29.02.drv' failed to build
error: 1 dependencies of derivation '/nix/store/i888ik9hgark94iwkk31ki7d54mjz7dd-opengl-drivers.drv' failed to build
error: 1 dependencies of derivation '/nix/store/iz9iyga906di1s4s516pnqbh0kilgwwv-system-generators.drv' failed to build
error: 1 dependencies of derivation '/nix/store/5ij4xr334fyr05vrb4w69cr0l90ccgn6-system-shutdown.drv' failed to build
error: 1 dependencies of derivation '/nix/store/mp8nddx1wdm21fixfxykl850nlc07ld1-unit-nvidia-hibernate.service.drv' failed to build
error: 1 dependencies of derivation '/nix/store/mckk7nchcz5381nxx3b80yzy2pxf1j3s-unit-nvidia-resume.service.drv' failed to build
error: 1 dependencies of derivation '/nix/store/a000i6bwzhcihfx2q29sdwxjrbn6x7cj-unit-nvidia-suspend.service.drv' failed to build
error: 1 dependencies of derivation '/nix/store/lcrx6xj2c46wm2qfl8l6gpaclayjai0b-xserver.conf.drv' failed to build
error: 1 dependencies of derivation '/nix/store/3p7lfynhl2g4zrkjbrcm55d5kczy0rii-linux-6.1.76-modules-shrunk.drv' failed to build
error: 1 dependencies of derivation '/nix/store/rj5l7g4s235hvif5p0n9wxsl5ivrlb9b-nixos-tmpfiles.d.drv' failed to build
error: 2 dependencies of derivation '/nix/store/154d7y2b0xsqg4p82gpxqhvikv5wa732-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/zaf0xf87sr1nqii45s00g389zcbyh7gi-unit-display-manager.service.drv' failed to build
error: 1 dependencies of derivation '/nix/store/vkld9fwkqyz32vdk1dflsmp0mx8m829l-X-Restart-Triggers-polkit.drv' failed to build
error: 1 dependencies of derivation '/nix/store/nffi6pa52mc1c61zzx4jvyfyakiil9mr-dbus-1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/pnnbbm21fc5d8whfjnj4f0k1yxlvw439-etc-pam-environment.drv' failed to build
error: 1 dependencies of derivation '/nix/store/0g4cngbrqvy6r36924znz6hydd4npkv7-initrd-linux-6.1.76.drv' failed to build
error: 1 dependencies of derivation '/nix/store/335hd8a3hdcg63g27i5569zgc0z3km8q-set-environment.drv' failed to build
error: 1 dependencies of derivation '/nix/store/jflkcdhdh0nk1xxv5qi4nfj9pfj4ffl0-tmpfiles.d.drv' failed to build
error: 1 dependencies of derivation '/nix/store/snb4n783g1bma3szgi7s7wzfbi26kw2z-unit-accounts-daemon.service.drv' failed to build
error: 1 dependencies of derivation '/nix/store/fhddypwa5cjkphdk5m5g043w4svqdigi-X-Restart-Triggers-dbus.drv' failed to build
error: 1 dependencies of derivation '/nix/store/h0kgyb4xlgmr1gkq6naawfdk3iwxnh03-boot.json.drv' failed to build
error: 1 dependencies of derivation '/nix/store/4acmxn2jb4hrz3qd0x03qsjxifs9919s-etc-profile.drv' failed to build
error: 1 dependencies of derivation '/nix/store/2vajylwr9jb6k203q6myi172grv8gbwp-unit-polkit.service.drv' failed to build
error: 1 dependencies of derivation '/nix/store/56igsxaw2n1jfsy4nlzaw7pfw0albxr0-unit-dbus.service.drv' failed to build
error: 1 dependencies of derivation '/nix/store/p6dlcimbdjf7ga92j96f04n9ziz4kcx2-unit-dbus.service.drv' failed to build
error: 8 dependencies of derivation '/nix/store/9kazjl8lmhia0mwm6yci2524ypf1d4hw-system-units.drv' failed to build
error: 2 dependencies of derivation '/nix/store/43w6kjvahb9lqscc34562dv3xln2cw37-user-units.drv' failed to build

Ah, that’s probably the patch that broke the GPL condom, then. Yeah, nvidia are abusing the kernel license and the kernel developers didn’t want to potentially need to sue them, so they broke what nvidia was using to make their driver work.

Edit: No, unrelated change that just happens to break the interface nvidia were using. Their drivers need updating, but because this is backported to older kernel branches this is even hitting you on older kernels. Nvidia drivers just aren’t compatible with those Linux versions for the moment.

Looks like someone is already on adding the gentoo patch to NixOS, just have to wait for CI to finish:

I’d argue that shouldn’t be added though, we should wait for Nvidia to update their drivers and just bump their version. But hey, guess the patches are already in.

2 Likes

Looks like someone is already on adding the gentoo patch to NixOS, just have to wait for CI to finish

So If I wait I should be able to update, but right now because NVIDIA wont play nice I just have to wait for NixOS to apply a patch that is a workaround for NVIDIA’s shoddy workmanship.

1 Like

Pretty much, but as much as I dislike nvidia

Just the fact that they insist on maintaining a proprietary driver as a third party kernel module, instead of having a mesa driver. Which is reasonable enough if you don’t subscribe to FOSS ideology and don’t want to provide a mesa driver, as much as I disagree with the decision.

Best option is to buy AMD or intel in the future, then you can entirely avoid this mess.

2 Likes

Just the fact that they insist on maintaining a proprietary driver as a third party kernel module, instead of having a mesa driver.

But it wont build even with hardware.nvidia.open = true; and those are supposed to be able to use the GPL symbol right? Or maybe something is up with how I am defining it in my configs, but changing open from true to false does nothing.
Maybe even the open kernel mods rely on broken symbols?

1 Like

Hm, yeah, odd. In theory I think the open driers should be able to depend on that symbol. Wonder if the NixOS package is missing something to mark it as GPL.

1 Like

If I can read GitHub right, the patch should of been merged by now, but my update still is broken. Is it just taking a while or am I messing something up?

1 Like

To avoid full rebuilds the nixos-* channels and branches are updated when hydra finishes evaluating and building the packageset. You can check https://nixpk.gs/pr-tracker.html?pr=286084 to see when it is available in the cache.

4 Likes

Thanks for the info!

I have an app that I want to install and use but the build is failing because of this error. How can I do install/use the app without nvidia getting updated in the rebuild process?

Don’t update your channels/flake inputs when you install it.

If you already have, you can rollback your channels or revert git commits for a flake.

I have a similar issue. I tried converting to using Flakes, and in the build process I was met with the same problem.

Since it was my first Flake build, I have nothing to convert back to. How can I do the initial build? Will I somehow have to build using an older Linux kernel? Or, is it the NVIDIA driver that I need to somehow downgrade? Or both?

// disclaimer: i am brand new to nixos

I think we just have to wait for Hydra to take its sweet sweet time.

It would be possible to get this specific package from unstable.
However in this case I don’t know where to define it.
Pointing hardware.nvidia.package to the unstable version of linuxKernel.packages.linux_6_1.nvidia_x11 didn’t work for me.

The alternative option is to pin the whole flake to a commit before it broke.

2 Likes

Yeah, if you’re using a flake, you can change the nixpkgs url to include the exact commit:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11?rev=14944a4d567c6679e6054b382cf7f309ae880f0c";
    # Or if I misremember, maybe the branch is not allowed if you specify `rev`:
    # nixpkgs.url = "github:NixOS/nixpkgs?rev=14944a4d567c6679e6054b382cf7f309ae880f0c";
  };
}

That commit is the one that changed to the 6.1.74 kernel version, which is 2 weeks out of date.

You’ll need to remove the rev bit manually later if you want to actually update again. Though frankly, at this point it will likely only take a few hours before hydra finishes, so it might be worth just waiting an evening.

2 Likes

You can use this workaround temporarily (source):

In flake.nix:

inputs.nixpkgs_patched.url = "github:nixos/nixpkgs/468a37e6ba01c45c91460580f345d48ecdb5a4db";

In configuration.nix:

{ config, pkgs, inputs ... }:

{
  nixpkgs.overlays = [ (self: super: (let
    patched_pkgs = import inputs.nixpkgs_patched {
      inherit (self) system;
      config.allowUnfree = true;
    };
  in {
    linuxPackages = patched_pkgs.linuxPackages;
  })) ];
  hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
  boot.kernelPackages = pkgs.linuxPackages;
}

That will require building the kernel, by the way, until hydra publishes a binary, whereas the workaround of sticking to an older commit means you don’t have to do that.

I just applied the @Brisingr05 's workaround to my own configs and it definitely did not rebuild the full kernel. So i guess hydra already has binaries for that.

looks like the patch there is applied to the nvidia package, not the kernel. So that just means rebuilding nvidia.

1 Like