Install NixOS on Raspberry Pi 4 SSD

I am failing to install NixOS 22.05 onto a 4GB RPi4B v1.1. The process fails with the following message when trying to boot the image on the SSD:

Net:    eth0: ethernet07d580000
PCIe BRCM: Link up, 5.0 Gbps x1 (SSC)
starting USB...
Bus xhci_pci: Register 5000420 NbrPorts 5
Starting the controller
scanning bus xhci_pci for devices... Unexpected XHCI event TRB, skipping...
BUG at drivers/usb/host/xhci-ring.c:503/abort_td()!


BOOTLOADER: up to date
   CURRENT: Tue Jan 25 02:30:41 PM UTC 2022 (1643121041)
    LATEST: Tue Jan 25 02:30:41 PM UTC 2022 (1643121041)
   RELEASE: default (/nix/store/kamvn40ksgr3cpivvbxbkp926mi9x7az-raspberrypi-eeprom-unstable-2022-03-10/share/rpi-eeprom/default)
            Use raspi-config to change the release.

  VL805_FW: Dedicated VL805 EEPROM
     VL805: up to date
   CURRENT: 000138a1
    LATEST: 000138a1
  • List item The configuration.nix file I’ve been using:
{ config, pkgs, lib, ... }:

  user = "matt";
  password = "********";
  hostname = "berry";
in {
  imports =
      ./hardware-configuration.nix # Include the results of the hardware scan.
      "${fetchTarball "" }/raspberry-pi/4"

  system.stateVersion = "22.05";

  boot.loader.grub.enable = false;
  boot.loader.generic-extlinux-compatible.enable = true;

  boot.initrd.availableKernelModules = [ "xhci_pci" "usbhid" "uas" "usb_storage" ];

  networking = {
    hostName = hostname;
    wireless.enable = false;

  time.timeZone = "America/New_York";

  environment.systemPackages = with pkgs; [

  services.openssh = {
    enable = true;

  users = {
    mutableUsers = false;
    users."${user}" = {
      isNormalUser = true;
      password = password;
      extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.

Hey there!
Looking at the output of your first code snippet:
This is UBOOT Output, which is the Bootloader of RPI4 that starts from hardware eeprom before the NixOS bootloader even gets loaded.
So probably no amount of tweaking in the NixOS config will fix that issue for you.
I just installed NixOS on my RPI4B, it was a bumpy ride :grinning:
My guess would be that this is one of the infamous USB boot bugs described here:

One thing you could try which fixed my boot generation reset bug (different issue you will encounter after you have solved this one :upside_down_face:) is including all-hardware in your config like so:

  imports = [

Good luck! :smiley:

Thanks for the future tip! Yes, I was assuming that u-boot is most of the files in /boot of the SD image. Weirdly, when I manually created my SSD image I had to copy those from the SD card image since Nix didn’t create them when I built the SSD image from the configuration.nix. It put other stuff in the /boot folder, but not the u-boot files. This of course got me examining the difference between the u-boot files supplied by NixOS and Ubuntu. There’s a lot in common, so maybe the issue is that NixOS’s u-boot files are from a different fork of u-boot than Ubuntu ( My next step is to see if I can find the NixPkg for u-boot and the one from Ubuntu.

It might also be helpful to know if there is anything I could put in the /boot/config.txt that would enable more granular error messages.

You could try the following:

  • Different USB Media
  • Including all-hardware into the config (see above)

I can also recommend this repo as a starting point, my config bases off of that but is not USB booted, maybe it works for you.

Regarding the general USB Boot issue I have also found this PR which was sent to me by someone at nix-bitcoin. This is not required if you have all-hardware imported though

The RPI4 Platform is really a pain to work with :upside_down_face:

Actually, I just got the unit to boot from the SSD! I switched from u-boot to UEFI booting. I’m working on tidying up my notes so I can post them here and in the github issue to which you linked. :slight_smile: :upside_down_face: :slight_smile:

1 Like

Nice, congrats!
Looking forward to reading them!

Having the same problem with USB boot and I would be very interested in your UEFI notes. Any news on that? Thanks.