Systemd bootloader failed during switch in 20.09 renders system unbootable

I didn’t catch this before doing a restart but systemd bootloader setup python script failed during switch which apparently removes all entries from the list and there’s no shell option to force load an old entry based on kernel or otherwise that I can recover from. Is there a method short of finding a bootable media (I’m in housing and don’t have easy access) to recover from such a situation?

I’m sure I’m missing details but I’ve also lost access to the machine with those details so I’ll do my best.

Thanks.

I’ve managed to find boot media but it’s a tad outdated and my WiFi doesn’t work. I don’t have access to an Ethernet connection that I’m aware of but I can at least see that the machine is still there (as I expected). Is there a way to boot the machine using this live environment or manually add the bootloader entries to get booted back in?

I don’t know your exact situation (what you have or not in the outdated media) but lets break it down- you need to do two things:

You need to load linux kernel, and an initrd. Now how to go about doing that-- I don’t remember the exact way to load Linux kernel in NixOS from EFI but ultimately remember that all modern Linux kernel images are EFI binaries. If there is a way for you to tell you firmware to run an EFI binary, you can tell it to “run” linux kernel (with appropriate params that you’ll have to research).

Another way is much simpler- get your hands on a grub EFI binary- once you’re in grub the commands are much more well known.

Remember with Linux it doesn’t matter whether at the time of installation you were MBR or GPT and whether you were “BIOS” or UEFI, what matters is what you have now.

Focus on getting to a bootable grub somehow (I don’t know if your outdated media has syslinux or grub. In any case your outdated media must have “grub-install” command, just instlal grub on a 20 MB partition and proceed from there).

Thanks for the ideas. I built this recovery media using nix and didn’t see grub but will double check. If I have grub I should be able to figure it out. Thanks for the thoughts! I’ll report back if that works.

Does your firmware allow you to execute arbitrary efi’s? If so,

  1. EFI is universal and I have a grub standalone EFI binary you could run (easier path).

  2. (As I said earlier) Your kernel is an EFI (difficult path).

Hmm, I don’t think this bootloader is grub but it does have a menu. It gives me access to rEFInd but since my EFI partition has no entries nothing is bootable. When I select the kernel it immediately panics (must bypass initrd which loads ZFS). So assuming I don’t have any “installed kernels” the only recourse seems to be to get a successful nixos-rebuild that lays down the EFI entries.

I have no mechanism for changing the boot media I have on hand until I can get this computer functioning again. The irony of this failure is palpable. :wink:

Does rEInd come with an EFI shell? From an EFI shell you can execute arbitrary EFI binaries.

Of course you don’t just select a kernel, it needs parameters (initrd image, also nixos system root).

Your 10 minute hosting is my grub EFI, see if you can get this to execute.

I have no network access on this machine so getting that in would be difficult. If I had network access I’d simply do a nixos-rebuild --upgrade boot from the mounted location or even a nixos-install. I don’t have an EFI shell through my firmware or rEFInd. I’ll see if I can muster a physical connection a bit later.

Try the solution in this link:

EDIT: https://github.com/nbp/nixos/blob/bd4050cad3a4fd194823e55fbe1d1f745b646c00/modules/installer/efi-boot-stub/efi-boot-stub-builder.sh#L60

1 Like

Again, without network access that’s not going to work. The challenge here is I’m cut off from network with limited resources at my disposal.

You translate it and enter as the command in your firmware list.

I haven’t seen the option to enter commands in my firmware list as I have uEFI rather than proper EFI. I’ll see if I can figure that out but will try an Ethernet connection later today or tomorrow as well. Thanks again for all of the advice.