Heyo! This may be a long one
The issue is that upon boot, the block device for the root partition cannot be found – and after 10 seconds, it times out, states an error, and asks me to reboot.
I’m somewhat new to nixos, been using it about a month on my laptop, but would like to install it on a desktop pc as well. I had some spare drives lying around, so for this machine want to run a mdadm raid5 between four drives for the primary partition. I’ve tried to give as much info as I can that may be relevant in figuring out what’s going on. At this point I’m running out of ideas.
Error during boot
When booting, it gives a Waiting 10 seconds for device /dev/disk/by-uuid/xxxxxxxx-...
, I believe this is the boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/c6f71789-640b-4035-8093-bd28044c7207";
failing to find the raid drive.
Comparing against my laptop I think there’s a chance that line should be changed to reference the uuid of the raid, once assembled, as opposed to the uuid of the encrypted partition once luks opened. – But changing this to match gave the same results. There’s also a chance I’m misinterpreting the lsblk.
System setup
I’m using four drives, each with a 1Gb partition at the front, and the remainder being part of the raid5 root partition. One drive has it’s 1Gb leading partition set to be the system boot partition, with the 1Gb of the other drives in a raid1. [I’m ignoring that for now] Both raids are then luks encrypted, with btrfs on top of that. – Then some subvol stuff, but it’s not getting that far.
I’m aware that which nvme gets mapped to sda,sdb,sdc,sdd is unpredictable, I’m trying to reference the drives using either their uuid or /dev/disk/by-id/ path.
What I’ve tried / Related resources
My main guide for this has been this discourse post, from someone with almost exactly the same issue. I’ve tried to mirror their config, and have compared /etc/mdadm.conf 's with other non-nix computers.
Nixos discourse topic: I want to create a raid0 for /var, but I’m unable to figure how to load mdamd on boot
From what I can gather, boot.initrd.services.swraid.enable needs to be set to true, and boot.initrd.services.swraid.mdadmConf should be set with the results of mdadm --detail --scan
. I’m also writing that to /etc/mdadm.conf, but that may not be necessary.
See:
I cant really access a terminal after the boot fails, which is the biggest thing causing me difficulties debugging. I suspect it’s a drive uuid mismatch, or mdadm.conf is being set to the wrong stuff from my config
My config / System info
Relevant part of the hardware config file:
let
mdadmconfigfile = ''
ARRAY /dev/md126 metadata=1.2 UUID=e4329e79:b9f4456f:ba33392e:48db946f # raid5
ARRAY /dev/md127 metadata=1.2 UUID=0f7f0286:d3228196:553e1da4:9f310130 # raid1
'';
in
{
[...]
# Establish raids
#boot.initrd.services.swraid.enable = {
boot.swraid = {
enable = true;
mdadmConf = mdadmconfigfile;
};
environment.etc = { "mdadm.conf".text = mdadmconfigfile; };
# Luks devices
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/c6f71789-640b-4035-8093-bd28044c7207";
#boot.initrd.luks.devices."cryptvault".device = "/dev/disk/by-uuid/1b13dd53-9f3a-4580-b960-09a2b472f860";
# Filesystems
fileSystems."/" = {
device = "/dev/disk/by-uuid/a55a1d94-03ab-4080-be60-c2bae6fafa81";
fsType = "btrfs";
options = [
"subvol=@"
"compress=zstd"
"noatime"
];
};
My lsblk -f as shown to the installer:
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
loop0 squashfs 4.0 0 100% /nix/.ro-store
sda
├─sda1 linux_raid_member 1.2 nixos:1 0f7f0286-d322-8196-553e-1da49f310130
│ └─md127 crypto_LUKS 2 1b13dd53-9f3a-4580-b960-09a2b472f860
│ └─cryptvault btrfs 8fd7aafd-419d-4216-9e9e-4dad90e32724
└─sda2 linux_raid_member 1.2 nixos:0 e4329e79-b9f4-456f-ba33-392e48db946f
└─md126 crypto_LUKS 2 c6f71789-640b-4035-8093-bd28044c7207
└─cryptroot btrfs a55a1d94-03ab-4080-be60-c2bae6fafa81 1.2T 5% /mnt/persist
/mnt/home
/mnt/swap
/mnt/nix
/mnt
sdb
├─sdb1 linux_raid_member 1.2 nixos:1 0f7f0286-d322-8196-553e-1da49f310130
│ └─md127 crypto_LUKS 2 1b13dd53-9f3a-4580-b960-09a2b472f860
│ └─cryptvault btrfs 8fd7aafd-419d-4216-9e9e-4dad90e32724
└─sdb2 linux_raid_member 1.2 nixos:0 e4329e79-b9f4-456f-ba33-392e48db946f
└─md126 crypto_LUKS 2 c6f71789-640b-4035-8093-bd28044c7207
└─cryptroot btrfs a55a1d94-03ab-4080-be60-c2bae6fafa81 1.2T 5% /mnt/persist
/mnt/home
/mnt/swap
/mnt/nix
/mnt
sdc
├─sdc1 linux_raid_member 1.2 nixos:1 0f7f0286-d322-8196-553e-1da49f310130
│ └─md127 crypto_LUKS 2 1b13dd53-9f3a-4580-b960-09a2b472f860
│ └─cryptvault btrfs 8fd7aafd-419d-4216-9e9e-4dad90e32724
└─sdc2 linux_raid_member 1.2 nixos:0 e4329e79-b9f4-456f-ba33-392e48db946f
└─md126 crypto_LUKS 2 c6f71789-640b-4035-8093-bd28044c7207
└─cryptroot btrfs a55a1d94-03ab-4080-be60-c2bae6fafa81 1.2T 5% /mnt/persist
/mnt/home
/mnt/swap
/mnt/nix
/mnt
sdd
├─sdd1 vfat FAT32 DF95-8003
└─sdd2 linux_raid_member 1.2 nixos:0 e4329e79-b9f4-456f-ba33-392e48db946f
└─md126 crypto_LUKS 2 c6f71789-640b-4035-8093-bd28044c7207
└─cryptroot btrfs a55a1d94-03ab-4080-be60-c2bae6fafa81 1.2T 5% /mnt/persist
/mnt/home
/mnt/swap
/mnt/nix
/mnt
sde
├─sde1 exfat 1.0 Ventoy 4E21-0000
│ └─ventoy iso9660 Joliet Extension nixos-minimal-24.05-x86_64 1980-01-01-00-00-00-00 0 100% /iso
├─sde2 vfat FAT16 VTOYEFI 3F32-27F5
└─sde3 ext4 1.0 f537b3bf-fbf2-4b95-863a-5bbfc740b0f0 40.8G 29% /fd
My full config files if they may help:
Github permalink to current config
Version wise, I’m on a fresh install of nixos 24.05
Thank you!