Cannot Build nvidia-x11-570.153.02-6.15

I am encountering GPL-incompatible module * uses GPL-only symbol errors when building nvidia-x11-570.153.02-6.15:

        > nvidia.o: warning: objtool: _nv045909rm+0x77: 'naked' return found in MITIGATION_RETHUNK build
┃        > nvidia.o: warning: objtool: _nv045853rm+0x7f: 'naked' return found in MITIGATION_RETHUNK build
┃        > nvidia.o: warning: objtool: _nv035412rm+0x3e: 'naked' return found in MITIGATION_RETHUNK build
┃        > nvidia.o: warning: objtool: _nv035411rm+0x27: 'naked' return found in MITIGATION_RETHUNK build
┃        > nvidia.o: warning: objtool: _nv035415rm+0x37: 'naked' return found in MITIGATION_RETHUNK build
┃        > nvidia.o: warning: objtool: _nv035414rm+0x24: 'naked' return found in MITIGATION_RETHUNK build
┃        > nvidia.o: warning: objtool: _nv035413rm+0xca: 'naked' return found in MITIGATION_RETHUNK build
┃        > nvidia.o: warning: objtool: _nv035416rm+0x193: 'naked' return found in MITIGATION_RETHUNK build
┃        > nvidia.o: warning: objtool: _nv035418rm+0x17f: 'naked' return found in MITIGATION_RETHUNK build
┃        > nvidia.o: warning: objtool: _nv013509rm+0x5d: 'naked' return found in MITIGATION_RETHUNK build
┃        > nvidia.o: warning: objtool: _nv046215rm+0x12f: 'naked' return found in MITIGATION_RETHUNK build
┃        >   MODPOST Module.symvers
┃        > WARNING: modpost: missing MODULE_DESCRIPTION() in nvidia.o
┃        > WARNING: modpost: missing MODULE_DESCRIPTION() in nvidia-uvm.o
┃        > WARNING: modpost: missing MODULE_DESCRIPTION() in nvidia-modeset.o
┃        > WARNING: modpost: missing MODULE_DESCRIPTION() in nvidia-drm.o
┃        > ERROR: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol '__vma_start_write'
┃        > ERROR: modpost: GPL-incompatible module nvidia-drm.ko uses GPL-only symbol '__vma_start_write'
┃        > make[4]: *** [/nix/store/gl4zb4minm4ddaz31lhsx2rr964z1gjl-linux-6.15-dev/lib/modules/6.15.0/source/scripts/Makefile.modpost:147: Module.symvers] Error 1
┃        > make[3]: *** [/nix/store/gl4zb4minm4ddaz31lhsx2rr964z1gjl-linux-6.15-dev/lib/modules/6.15.0/source/Makefile:1953: modpost] Error 2
┃        > make[2]: *** [/nix/store/gl4zb4minm4ddaz31lhsx2rr964z1gjl-linux-6.15-dev/lib/modules/6.15.0/source/Makefile:248: __sub-make] Error 2
┃        > make[2]: Leaving directory '/build/NVIDIA-Linux-x86_64-570.153.02/kernel'
┃        > make[1]: *** [Makefile:248: __sub-make] Error 2
┃        > make[1]: Leaving directory '/nix/store/gl4zb4minm4ddaz31lhsx2rr964z1gjl-linux-6.15-dev/lib/modules/6.15.0/source'
┃        > make: *** [Makefile:115: modules] Error 2

Below is my relevant configuration:

  config = lib.mkIf config.nvidiaEnable {
    environment.systemPackages = with pkgs; [
      egl-wayland
      nvitop
    ];

    boot.kernelPackages = pkgs.linuxPackages_latest;
    boot.kernelParams = [
      "nvidia-drm.modeset=1"
      "nvidia-drm.fbdev=1"
    ];

    hardware.nvidia = {
      # Modesetting is required.
      modesetting.enable = true;

      # Nvidia power management. Experimental, and can cause sleep/suspend to fail.
      # Enable this if you have graphical corruption issues or application crashes after waking
      # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
      # of just the bare essentials.
      powerManagement.enable = false;

      # Fine-grained power management. Turns off GPU when not in use.
      # Experimental and only works on modern Nvidia GPUs (Turing or newer).
      powerManagement.finegrained = false;

      # Use the NVidia open source kernel module (not to be confused with the
      # independent third-party "nouveau" open source driver).
      # Support is limited to the Turing and later architectures. Full list of
      # supported GPUs is at:
      # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
      # Only available from driver 515.43.04+
      open = false;

      # Enable the Nvidia settings menu,
      # accessible via `nvidia-settings`.
      nvidiaSettings = true;

      # Optionally, you may need to select the appropriate driver version for your specific GPU.
      package = config.boot.kernelPackages.nvidiaPackages.latest;
    };

    nixpkgs = {
      config = {
        allowUnfree = true;
        pulseaudio = true;
        nvidia.acceptLicense = true;
        # packageOverrides = pkgs: { inherit (pkgs) linuxPackages_latest nvidia_x11; };
      };
    };

    services.xserver.videoDrivers = [ "nvidia" ];

I have set boot.kernelPackages = pkgs.linuxPackages_6_14; for now, which builds correctly.

3 Likes

Glad I’m not the only one with this error, but I also came across this with the Beta and latest drivers: “570.153.02” and “575.51.02”

I’ll probably stick to kernel 6.14 until someone finds a solution…

I ran into almost the exact same problem on Fedora Rawhide. Try using the open driver.

Having the same problem here with the open driver, sadly

Don’t use linux_latest with third party kernel modules!

The nvidia modules are developed against the LTS kernel. Since they are developed separately from the kernel, they effectively use a completely unstable API and cannot do anything to ensure that your module will build against a newer kernel.

Eventually this will be patched, probably when they release their next driver, but it can take months - nvidia do not have a release schedule for their drivers.

Literally any kernel bump can cause this, and many do. So the best thing you as a consumer can do to prevent this stuff is just to use the LTS kernel.

That, or get kernel hacking and write your own nvidia patches. Or grab patches from random people online, and hope they don’t set your hardware on fire.

Or switch to AMD or intel - they have in-tree drivers, so updates happen with the kernel, as they are supposed to, allowing you to experiment with kernel versions as much as you desire.

tl;dr: If somewhere in your config you have:

boot.kernelPackages = pkgs.linuxPackages_latest;

delete that line.

Removing it will make you use the LTS Linux kernel, since that is the default setting.

2 Likes

Which one is considered LTS in this list?

https://nixos.wiki/wiki/Linux_kernel

Would I write the following in my nix config file?

boot.kernelPackages = pkgs.linuxPackages

Or would I remove this line entirely because LTS is used by default?

Yep. You can also use pkgs.linuxPackages if you wish, but I would recommend not duplicating default settings in general; that way upstream can change them for you if that needs to happen for some reason.

Also, that is the unofficial, mostly bitrotting wiki. The owner of the domain is uncooperative, there is an official wiki now, try to use and link to it so we finally get the page rankings fixed: Linux kernel - NixOS Wiki

As an aside, the first line on that entry helpfully states:

By default, the latest LTS linux kernel is installed (Linux Kernel Version History).

1 Like