Waiting for device /dev/disk/by-label/NIXOS_SD to appear

Hey y’all. Just realized NixOS has “support” for the RPi 4, and have devised a plan as to what my board’s fate will be - nixification.

Until, of course, it didn’t work.

I followed the configuration.nix on the RPi4 wiki page, but am now given the following error:

Waiting for device /dev/disk/by-label/NIXOS_SD to appear...
* lots of irrelevant logs here about xhci_hcd and usb 1-1.3 *
Timed out waiting for device /dev/disk/by-label/NIXOS_SD, trying to mount anyway.

An error occured in stage 1 of the boot process, which must mount the
root filesystem on `/mnt-root` and then start stage 2. Press one
of the following keys:

  r) to reboot immediately
  *) to ignore the error and continue

After some research, it seems like others have had a similar error even on non-RPi devices - but a lot of the time, they get a few more options: namely, to enter an interactive shell, in which you can just mount /mnt-root yourself and carry on with your day/boot process/evil plan for your nixification.

Unfortunately, I don’t have these options. What makes this even funnier is that when I do try to press r for reboot, nothing happens at all - the key isn’t echoed into stdout, and the device stays exactly how it is. A few seconds ago I was typing away with this keyboard plugged directly into the Pi, but now it seems to not see it.

Thanks for the help in advance, I’d really like to proceed with my evil plan of Pi nixification.

Cheers,

Bob.

The missing shell option is because boot.kernelParams doesn’t contain "boot.shell_on_fail". You can see all supported kernelParams here nixpkgs/stage-1-init.sh at 91b77fe6942fe999b1efbe906dc98024d1917c0d · NixOS/nixpkgs · GitHub

As for the boot problem it seems like the media you are booting from isn’t configured how the configuration.nix you are using is expecting. Or the kernel is having problems finding the media. Is it on USB or SD?

I am curious how you got here. Am I correct in this sequence of events?

  1. You booted the raspberry pi 4 special image
  2. You copied the configuration.nix from the wiki and ran nixos-rebuild switch
  3. The reboot after that failed

Because if that is the case there are only two possible causes.

  1. The special image does not contain a partition with label NIXOS_SD and you need to adjust the configuration.nix
  2. There is a problem with the media. Like the kernel can’t find it which might mean that it is bad or there is some difference in the kernel of special image and the one used by configuration.nix
1 Like

Hi Griff,

Thank you for your response!

Re: missing shell option: Perfect. Booted up, reverted to before the broken rebuild, added to my configuration.nix and rebuilt. Time for some juicy answers.

Re: sequence of events: yes precisely. RPi 4 special built image from Hydra, grabbed the configuration.nix from the RPi 4 wiki page, and switched. If I tried to use sudo, I’d get something along the lines of “User is not in the password database”. A quick logout and login would fix it, and it makes sense why. Sadly, a reboot after this came up with this error.

Now, I added these params to my config and rebuilt - now I have two more options!

 i) to launch an interactive shell
 f) to start an interactive shell having pid 1 (needed if you want to
    start stage 2's init manually)
 r) ... the usual options ...

The problem is, the system doesn’t seem to be handling my input - no matter what letters I press, nothing happens.

Above the error there are some dmesg-like logs along the lines of:

[      2.xxxxxx] xhci_hcd error: unexpected setup context command completion code 0x11.
[      2.yyyyyy] usb 1-1.1: hub failed to enable device, error -22
... the same error a few times ...
 [     4.zzzzzz] usb 1-1-port1: unable to enumerate USB device
... Timed out waiting for device /dev/disk/by-label/NIXOS_SD on /mnt-root/ failed ...

If I unplug and re-plug in my USB receiver, the same log is spat out.

Once I get input and am able to get to a shell, I’ll just ls /dev/disk/by-label and work our way from there.

Any ideas on what the problem is now?

Cheers!