Upgrade command experience

Unfortunately, I’m not in the habit of reading release notes and usually it’s hard to retrace my steps to see where I left the beaten path, the recommended state / transition process. As such, I’ve upgraded from 25.11 → 26.05 (my first NixOS upgrade!) :
$ sudo nix-channel --add [channel 26.05] nixos
$ sudo nixos-rebuild switch --upgrade

Unfortunately, after what appeared a successful upgrade, creating derivations crashed the bash process itself:
$ sudo nixos-rebuild switch
unpacking 2 channels…
Warning: Program ‘/run/current-system/sw/bin/bash’ crashed.

As such, I decided to ask for help here, but before I did I went through the release notes here

What do you know, after running nixos-rebuild boot my bash process no longer crashes!

$sudo nixos-rebuild switch
building the system configuration...
Checking switch inhibitors... done
activating the configuration...
Use of uninitialized value in numeric comparison (<=>) at /nix/store/-update-users-groups.pl line 283.
Use of uninitialized value in join or string at /nix/store/-update-users-groups.pl line 282.
setting up /etc...
reloading user units for bogdanbiv...
restarting the following user units: nixos-activation.service
restarting sysinit-reactivation.target
the following new units were started: libvirtd.service, NetworkManager-dispatcher.service
Done. The new configuration is /nix/store/-nixos-system-nixos-26.05.1183.6b316287bae2

How do I mark this as [SOLVED] ?

So, switch instantly applies the new configuration, while boot only applies it after you reboot.

In practice, this means that switch can only ever perform partial updates. Services that cannot be restarted without rebooting the whole system (systemd, dbus, your DE/WM, the kernel, …) will never be updated by switch - it simply cannot do that.

This means that for some upgrades, using switch will leave you in a broken state, because some software you’re using will be expecting that you have newer versions of other software, which in turn has not been updated.

Therefore, in general, you should probably use boot when you update, especially for major version upgrades. IMO you should basically always use boot if you’re not doing rapid, iterative development on your config, because it’s hard to predict whether a specific update will leave you in a partial state.


Bash crashing seems like a pretty unusual failure even when using switch, though. This sounds more to me like you haven’t rebooted yet and that the crash will occur on your next boot. Have you tried that?

You can’t mark the initial post as solved, you should have replied to your own topic and marked that reply as the solution.

Though I’m uncertain it actually is a solution. I think your activation script might still fail.

2 Likes

I’m pretty sure I rebooted about 20-30 time after I upgraded: `sudo nixos-rebuild switch --upgrade
` , but bash crashing was persistent whenever I would run it in a KDE Plasma session (CTRL+ALT+F2). Logging in via tty (CTRL+ALT+F3) and doing the nixos-rebuild switch from there did work just fine.

Forgot to try boot an older derivation, check to see if bash still crashed then.
After I ran under (CTRL+ALT+F3, tty3) nixos-rebuild boot - now nixos-rebuild switch works fully even in KDE plasma, without any reboot!