Skip to content

boot.initrd.systemd.enable on 23.05 breaks raid configurations #236213

Description

@gpl

Describe the bug

I'm attempting to utilize systemd in initrd.

Steps To Reproduce

Steps to reproduce the behavior:

set boot.initrd.systemd.enable = true on a system with ext4(luks(raid1(disk)))

lsblk output:

NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
nvme2n1     259:0    0 186.3G  0 disk
└─nvme2n1p1 259:1    0 186.3G  0 part
nvme1n1     259:2    0 894.3G  0 disk
├─nvme1n1p1 259:4    0   512M  0 part
│ └─md127     9:127  0 511.9M  0 raid1 /boot
└─nvme1n1p2 259:5    0 893.8G  0 part
  └─md126     9:126  0 893.6G  0 raid1
    └─nixos 254:0    0 893.6G  0 crypt /nix/store
                                       /
nvme0n1     259:3    0 894.3G  0 disk
├─nvme0n1p1 259:6    0   512M  0 part
│ └─md127     9:127  0 511.9M  0 raid1 /boot
└─nvme0n1p2 259:7    0 893.8G  0 part
  └─md126     9:126  0 893.6G  0 raid1
    └─nixos 254:0    0 893.6G  0 crypt /nix/store
                                       /

Upon setting boot.initrd.systemd.enable = true; the system claims there are no arrays in /proc/mdstat. There are no md devices in /dev/disk/by-id but the raw block devices are present.

    initrd = {
      availableKernelModules = [ "dummy" "sha1" "sha256" "aes" "xts" "encrypted_keys" "cryptd" "dm_crypt" "dm_mod" "mlx5_core" "bonding" "8021q" "wireguard" ];
      kernelModules = [ "cryptd" "dm_crypt" "dm_mod" "vhost_vsock" "overlay" "raid1" ];
      systemd.enable = true;
      systemd.network.enable = true;
      systemd.emergencyAccess = true;
      network = {
        flushBeforeStage2 = true;
        enable = true;
        ssh = {
          enable = true;
          port = 2222;
          hostKeys = [
              "/etc/secrets/initrd/ssh_host_ed25519_key"
          ];
        };
      };
    };

Expected Behavior

system prompts to unlock md devices; instead it drops to emergency mode

Metadata

 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.31, NixOS, 23.05 (Stoat), 23.05.553.e7603eba51f`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.3`
 - channels(root): `"nixos-23.05, nixos-unstable"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions