Nixos enters emergency mode on startup

I reformatted and encrypted a hard drive that was previously setup in my configuration to automount, and my system then went into emergency mode after rebooting. I’ve tried changing my configuration, but I can’t find a way to apply the fix in emergency mode, and unplugging the drive doesn’t fix the issue either.

How can I get the system to stop trying to mount the drive on boot?

1 Like

Is there any reason you can’t boot from a separate NixOS installer disk (over USB or whatever) and fix your configuration from there?

If there is then I don’t know the answer but I think whoever does is going to want to know which bootloader you’re using - probably systemd, if you have UEFI?

Unfortunately, right now the system isn’t fully functional enough for a nixos-rebuild when it boots into emergency mode (I would like to fix this though). You should be able to disable the failing mount by pressing the e key in the boot menu and adding the systemd.mask= parameter specifying the mountpoint. i.e. systemd.mask=/data/foo-bar. That should allow the system to successfully boot and allow you to edit your configuration and apply it.

2 Likes

It says “entry does not support editing the command line” when I try that.

Are you doing secure boot / lanzaboote or something? Or do you have boot.loader.systemd-boot.editor or something set to false?