# Upgrade nix has a problem for me

**URL:** https://discourse.nixos.org/t/upgrade-nix-has-a-problem-for-me/64971
**Category:** Help
**Created:** [May 30, 2025, 8:53am UTC](https://discourse.nixos.org/t/upgrade-nix-has-a-problem-for-me/64971 "2025-05-30T08:53:13Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![AMHOAZ](https://discourse.nixos.org/user_avatar/discourse.nixos.org/amhoaz/32/36133_2.png) [@AMHOAZ](https://discourse.nixos.org/u/AMHOAZ)
#### Post date: [May 30, 2025, 8:53am UTC](https://discourse.nixos.org/t/upgrade-nix-has-a-problem-for-me/64971/1 "2025-05-30T08:53:13Z")

</div>

when i want to upgrade my nix package i get this error

```auto
amir@nixos ~> upgrade-sys
[sudo] password for amir: 
warning: Git tree '/etc/nixos' is dirty
warning: Git tree '/etc/nixos' is dirty
building the system configuration...
warning: Git tree '/etc/nixos' is dirty
error: builder for '/nix/store/m139vk4k6kbzjdad3xvdx6g3qrp1a2cc-nvidia-x11-570.153.02-6.15.drv' failed with exit code 2;
       last 25 log lines:
       > 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
       For full logs, run:
         nix log /nix/store/m139vk4k6kbzjdad3xvdx6g3qrp1a2cc-nvidia-x11-570.153.02-6.15.drv
error: 1 dependencies of derivation '/nix/store/dh8mvlmrp7lva0k52lps2vk4dgj5sk4h-etc.drv' failed to build
error: 1 dependencies of derivation '/nix/store/mf9nwb29mlzxmh6si7854lqp6ir5w42z-firmware.drv' failed to build
error: 1 dependencies of derivation '/nix/store/c85d7l5g89zfzih7zy86dcz6795r19dv-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/h7mhv04nixixi0zfancd6mkhqy20dkyi-nixos-system-nixos-25.11.20250527.4faa5f5.drv' failed to build

```

this alias for upgrade use

```auto
upgrade-sys = "cd /etc/nixos/ && sudo nix flake update && sudo nixos-rebuild switch --upgrade --flake /etc/nixos/ && sudo nixos-rebuild boot --upgrade --flake /etc/nixos/ && cd ~ && conda-shell -c 'conda init fish && conda install python=3.11 -y && pip install -U ipython g4f[all] gallery-dl orjson'";

```

```auto
boot.initrd.kernelModules = ["nvidia"];
 services.xserver.videoDrivers = ["nvidia"];
  boot.kernelPackages = pkgs.linuxPackages_latest;
  #boot.kernelPackages = pkgs.linuxKernel.packages.linux_xanmod_latest;
  hardware.nvidia = {
    modesetting.enable = true;
    open = true;
    powerManagement.enable = false;
    powerManagement.finegrained = false;
    nvidiaSettings = true;
    prime = {
	offload = {
	enable = true;
	enableOffloadCmd = true;
	};
# # Make sure to use the correct Bus ID values for your system!
		intelBusId = "PCI:0:2:0";
		nvidiaBusId = "PCI:1:0:0";
                # amdgpuBusId = "PCI:54:0:0"; For AMD GPU
	};
    package = config.boot.kernelPackages.nvidiaPackages.stable;
  };

```

how can i fix this error and have successful upgrade ?  
thanks

---

<div class="post-metadata">

### Author: ![TLATER](https://discourse.nixos.org/user_avatar/discourse.nixos.org/tlater/32/4257_2.png) [@TLATER](https://discourse.nixos.org/u/TLATER)
#### Post date: [May 30, 2025, 10:31am UTC](https://discourse.nixos.org/t/upgrade-nix-has-a-problem-for-me/64971/2 "2025-05-30T10:31:10Z")

</div>

See my answer to the exact same question from yesterday: [Cannot Build nvidia-x11-570.153.02-6.15 - #5 by TLATER](https://discourse.nixos.org/t/cannot-build-nvidia-x11-570-153-02-6-15/64898/5)

It’s the bi-yearly season of kernel changes causing everyone to learn what it actually _means_ for nvidia’s drivers to be third party 😛

---

<div class="post-metadata">

### Author: ![AMHOAZ](https://discourse.nixos.org/user_avatar/discourse.nixos.org/amhoaz/32/36133_2.png) [@AMHOAZ](https://discourse.nixos.org/u/AMHOAZ)
#### Post date: [May 30, 2025, 12:14pm UTC](https://discourse.nixos.org/t/upgrade-nix-has-a-problem-for-me/64971/3 "2025-05-30T12:14:47Z")

</div>

Thank you. So, does that mean I should change the kernel to the LTS version?

---

<div class="post-metadata">

### Author: ![TLATER](https://discourse.nixos.org/user_avatar/discourse.nixos.org/tlater/32/4257_2.png) [@TLATER](https://discourse.nixos.org/u/TLATER)
#### Post date: [May 30, 2025, 12:16pm UTC](https://discourse.nixos.org/t/upgrade-nix-has-a-problem-for-me/64971/4 "2025-05-30T12:16:26Z")

</div>

I put a handly lil’ tl;dr to explain exactly what you need to do:

> [@Cannot Build nvidia-x11-570.153.02-6.15](https://discourse.nixos.org/t/cannot-build-nvidia-x11-570-153-02-6-15/64898/5):
>
> tl;dr: If somewhere in your config you have:
> 
> ```auto
> boot.kernelPackages = pkgs.linuxPackages_latest;
> 
> ```
> 
> delete that line.

---

<div class="post-metadata">

### Author: ![AMHOAZ](https://discourse.nixos.org/user_avatar/discourse.nixos.org/amhoaz/32/36133_2.png) [@AMHOAZ](https://discourse.nixos.org/u/AMHOAZ)
#### Post date: [May 30, 2025, 12:19pm UTC](https://discourse.nixos.org/t/upgrade-nix-has-a-problem-for-me/64971/5 "2025-05-30T12:19:48Z")

</div>

Does removing this line automatically switch to the LTS kernel?  
What I mean is, does Nix automatically detect this?

---

<div class="post-metadata">

### Author: ![TLATER](https://discourse.nixos.org/user_avatar/discourse.nixos.org/tlater/32/4257_2.png) [@TLATER](https://discourse.nixos.org/u/TLATER)
#### Post date: [May 30, 2025, 12:29pm UTC](https://discourse.nixos.org/t/upgrade-nix-has-a-problem-for-me/64971/6 "2025-05-30T12:29:55Z")

</div>

If you don’t set that line, your configuration will use the default setting. The default setting is the LTS kernel.

NixOS modules always revert to the default if you don’t set a setting. You should avoid setting as many options as you can, because then upstream takes care of maintaining those for you.

In fact, all the configuration you shared _should_ be simplified to just this:

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

hardware.nvidia.prime = {
  offload = {
    enable = true;
    enableOffloadCmd = true;
  };
  intelBusId = "PCI:0:2:0";
  nvidiaBusId = "PCI:1:0:0";
};

```

… since all the other settings are just the defaults (and possibly actively harmful in the case of `boot.initrd.kernelModules`).

---

<div class="post-metadata">

### Author: ![AMHOAZ](https://discourse.nixos.org/user_avatar/discourse.nixos.org/amhoaz/32/36133_2.png) [@AMHOAZ](https://discourse.nixos.org/u/AMHOAZ)
#### Post date: [May 30, 2025, 12:51pm UTC](https://discourse.nixos.org/t/upgrade-nix-has-a-problem-for-me/64971/7 "2025-05-30T12:51:11Z")

</div>

Thank you for your help! I have another question.  
After the upgrade, I noticed that my kernel was version 14.6 before the upgrade, but after I removed the line, the kernel version changed to 12. Is there a way to manually set the kernel back to version 14.6 or the latest available version before 15?

Of course, if this might cause any issues, please let me know so I don’t proceed, as I don’t have much experience with Nix, and I got the configuration from one of my friends.

---

<div class="post-metadata">

### Author: ![TLATER](https://discourse.nixos.org/user_avatar/discourse.nixos.org/tlater/32/4257_2.png) [@TLATER](https://discourse.nixos.org/u/TLATER)
#### Post date: [May 30, 2025, 12:54pm UTC](https://discourse.nixos.org/t/upgrade-nix-has-a-problem-for-me/64971/8 "2025-05-30T12:54:42Z")

</div>

> [@AMHOAZ](#):
>
> Is there a way to manually set the kernel back to version 14.6 or the latest available version before 15?

Yes, but I would not recommend it unless you really _need_ version 14, since at the end of the month it will go EOL and you’ll have this exact same issue (and will at that point need to downgrade to 12 anyway). Sounds like your hardware is booting fine on version 12, so I’d recommend sticking with it until the next LTS kernel version comes around.

Or in other words, I would recommend not touching `boot.kernelPackages` unless you have a good reason to, _especially_ if you’re using an nvidia GPU.
