I thought I would install NixOS on a USB stick in case something goes wrong with my computer, so I can easily boot on some kind of rescue system.
I used my current NixOS config as a base, adapting the paths to the disks to point to the correct partitions on the new disk. But when booting on the USB disk, I get the following message, and the boot fails:
Waiting 10 seconds for device /dev/disk/by-uuid/defc30d1-57be-4b69-9519-b39812a04172 to appear… failure
/dev/disk/by-uuid/defc30d1-57be-4b69-9519-b39812a04172 is unavailableAn error occurred in stage 1 of the boot process, which must mount the root filesystem on /mnt-root and then start stage 2.
Plugging the USB disk while on my live system, I can see the partition is reachable under this path (it’s a luks partition, and cryptsetup luksOpen
it works correctly). The luks configuration looks like this:
boot.initrd.luks.devices = {
root = {
device = "/dev/disk/by-uuid/defc30d1-57be-4b69-9519-b39812a04172";
preLVM = true;
};
};
I’ve tried adding all the modules I could find to boot.initrd.kernelModules
([ "dm-snapshot" "usb_storage" "sd_mod" "ehci_pci" "ohci_pci" "usbhid" "ahci" "sata_nv" "dm_mod" "dm_crypt" "cryptd" "xhci_hcd" ] ++ config.boot.initrd.luks.cryptoModules
) to no avail.
Am I missing something obvious? Is there a way that would help me identify the source of the issue?