Upgrading to 21.05 failed while writing boot files; not sure what to do

I tried to upgrade my 20.09 desktop machine to 21.05 today and it crashed while writing the /boot files without any clear instructions or even an actual error message. I’m not sure what to do next.

Here’s what I did: first I added the new channel:

sudo nix-channel --add https://nixos.org/channels/nixos-21.05 nixos

Then ran sudo nixos-rebuild --upgrade boot and it ran for quite a while but ultimately crashed and it doesn’t seem to give any indication of what I should do next.

Here’s the end of the output:

root module: dm_mod
  copying dependency: /nix/store/bvx8hjj772v68x4xixhpp972a3qv165s-linux-5.10.43-modules/lib/modules/5.10.43/kernel/drivers/md/dm-mod.ko.xz
firmware for /nix/store/bvx8hjj772v68x4xixhpp972a3qv165s-linux-5.10.43-modules/lib/modules/5.10.43/kernel/drivers/usb/host/xhci-pci.ko.xz: renesas_usb_fw.mem
WARNING: missing firmware renesas_usb_fw.mem for module /nix/store/bvx8hjj772v68x4xixhpp972a3qv165s-linux-5.10.43-modules/lib/modules/5.10.43/kernel/drivers/usb/host/xhci-pci.ko.xz
building '/nix/store/90fvig3jy3npznyhwmfl22xbb6shjcfp-stage-1-init.sh.drv'...
checking syntax
building '/nix/store/0mww3g520fkf70048cb9f6ynfyr1mp6a-initrd-linux-5.10.43.drv'...
37414 blocks
building '/nix/store/syk5418f9vbbl6d26sm1j0rm3yv66psy-nixos-system-pluto-21.05.1076.bad3ccd099e.drv'...
updating systemd-boot from 246 to 247
Copied "/nix/store/6417c02xz6mfk6v21g3d8df04r92hjg9-systemd-247.6/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/EFI/systemd/systemd-bootx64.efi".
Copied "/nix/store/6417c02xz6mfk6v21g3d8df04r92hjg9-systemd-247.6/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/EFI/BOOT/BOOTX64.EFI".
Traceback (most recent call last):
  File "/nix/store/77v3sacdkwqbh61fzdhl2wpqag7xpf68-systemd-boot", line 274, in <module>
    main()
  File "/nix/store/77v3sacdkwqbh61fzdhl2wpqag7xpf68-systemd-boot", line 229, in main
    subprocess.check_call(["/nix/store/6417c02xz6mfk6v21g3d8df04r92hjg9-systemd-247.6/bin/bootctl", "--path=/boot", "update"])
  File "/nix/store/ibzil11xfiz695dbalq2swj4wf42g7ad-python3-3.8.9/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/nix/store/6417c02xz6mfk6v21g3d8df04r92hjg9-systemd-247.6/bin/bootctl', '--path=/boot', 'update']' returned non-zero exit status 1.
warning: error(s) occurred while switching to the new configuration

I’m concerned that I won’t be able to reboot now, since it appears to have crashed while writing the new boot configuration. Should I just try nixos-rebuild again? Any help appreciated!!

It shouldn’t hurt to re-run it. That being said, I am not sure the result will be different.

I would check bootctl status and see if everything is well. As long as it is fundamentally working you can always put into a prior generation as long as you aren’t being overly aggressive with garbage control.

The output of bootctl status shows systemd-boot 246 and not 247 and the default boot loader entry is NixOS 20.09 running kernel 5.4.122, so yeah, the update did not succeed. It’s reassuring that the boot setup appears to be in a good state, but I’m still dead in the water as far as updating goes. :frowning:

Well I ran nixos-rebuild again and got minimal output… I forget what now, but it did not appear to write anything new. That surprised me so I made sure the channel was set and ran it again… same couple lines of output. Checked bootctl again and saw 21.05 in it so I rebooted and everything went fine. I’m now in Gnome 40 and so far everything seems to be working fine. Weird that there didn’t appear to be anything else to do in the upgrade even though it crashed that first time. But whatever… I’ll take it!

2 Likes