[SOLVED] 23.05 upgrade : nixos-rebuild switch fails


I need some help.
I tried to upgrade to 23.05, but switch to new configuration fails.
Build is successfull but nixos-rebuild boot or nixos-rebuild switch fails with this error msg

sudo nixos-rebuild boot 
building Nix...
building the system configuration...
Traceback (most recent call last):
  File "/nix/store/y8pzl5487as5vi1594r39fi9wpjby2pc-systemd-boot", line 341, in <module>
  File "/nix/store/y8pzl5487as5vi1594r39fi9wpjby2pc-systemd-boot", line 262, in main
    installed_out = subprocess.check_output(["/nix/store/75wxj2a3c0pdbf46bzmff8qr9vbjm5y1-systemd-253.3/bin/bootctl", "--esp-path=/boot/efi", "status"], universal_newlines=True)
  File "/nix/store/95cxzy2hpizr23343b8bskl4yacf4b3l-python3-3.10.11/lib/python3.10/subprocess.py", line 421, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/nix/store/95cxzy2hpizr23343b8bskl4yacf4b3l-python3-3.10.11/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/nix/store/75wxj2a3c0pdbf46bzmff8qr9vbjm5y1-systemd-253.3/bin/bootctl', '--esp-path=/boot/efi', 'status']' returned non-zero exit status 1.
warning: error(s) occurred while switching to the new configuration
1 Like

In case someone has the same issue you can bypass it with
sudo nixos-rebuild switch --install-bootloader

The issue is reported on github nixos/systemd-boot: exit status 1 nixos-rebuild fails · Issue #223579 · NixOS/nixpkgs · GitHub


the mentioned systemd fix seem to have been merged on 30th of march, and yet the issue is still there

in the comments of the fix there’s a link to this PR that isn’t merged yet

It’s not quite clear to me if this PR will fix it

1 Like

The PR should fix it. Will be merged soon and back ported. Sorry for the inconvenience


I see the fix was merged into staging-23.05 pretty fast, but it’s still not in nixos-23.05 branch.

I’m curious, how long does it take on average for such fix to arrive in “stable” branch?

From staging to channel usually takes between 2 and 4 weeks, depending on where in the staging next cycle we currently are.

1 Like

for anyone interested: that commit finally made it into nixos-23.05 branch

edit: I’m surprised that commit did not make it into nixos-unstable though…

1 Like

sorry for late follow up - the update did not fix the error

for me --install-bootloader flag to nixos-rebuild does not help avoiding the error, so i cannot update to 23.05

looks like i’m not alone: nixos/systemd-boot: exit status 1 nixos-rebuild fails · Issue #223579 · NixOS/nixpkgs · GitHub