[BUG] /dev/nvme01px is not a valid luks device. #23

Closed
opened 2025-12-29 04:20:51 +01:00 by adam · 2 comments
Owner

Originally created by @ryan4yin on GitHub (Jan 16, 2024).

After enabling LUKS encryption, NixOS has a high probability of reporting an error on boot:

/dev/nvme01px is not a valid luks device

Multiple restarts can avoid this problem.

Originally created by @ryan4yin on GitHub (Jan 16, 2024). After enabling LUKS encryption, NixOS has a high probability of reporting an error on boot: ``` /dev/nvme01px is not a valid luks device ``` Multiple restarts can avoid this problem.
adam added the bug label 2025-12-29 04:20:51 +01:00
adam closed this issue 2025-12-29 04:20:51 +01:00
Author
Owner

@ryan4yin commented on GitHub (Jan 16, 2024):

NickCao: When you have multiple disks of the same type(SSD/HDD), their disk number is random on every boot.

So the problem is caused by: https://github.com/ryan4yin/nix-config/blob/c4a28eb/hosts/idols/ai/hardware-configuration.nix#L48

  boot.initrd = {
    luks.devices."crypted-nixos" = {
      device = "/dev/nvme0n1p2";
      # ...
    };
  };

Every time I reboot, /dev/nvme0n1 is randomly assigned to any of my hard drives.
NixOS will start properly only if it is correctly assigned to my NixOS's drive.

Resolution: Replace device name with drive UUID in my configuration.

@ryan4yin commented on GitHub (Jan 16, 2024): NickCao: When you have multiple disks of the same type(SSD/HDD), their disk number is random on every boot. So the problem is caused by: https://github.com/ryan4yin/nix-config/blob/c4a28eb/hosts/idols/ai/hardware-configuration.nix#L48 ``` boot.initrd = { luks.devices."crypted-nixos" = { device = "/dev/nvme0n1p2"; # ... }; }; ``` Every time I reboot, `/dev/nvme0n1` is randomly assigned to any of my hard drives. NixOS will start properly only if it is correctly assigned to my NixOS's drive. Resolution: **Replace device name with drive UUID in my configuration**.
Author
Owner

@ryan4yin commented on GitHub (Jan 28, 2024):

fix: failed to boot - replace device name by uuid 0504d0503b

@ryan4yin commented on GitHub (Jan 28, 2024): fix: failed to boot - replace device name by uuid https://github.com/ryan4yin/nix-config/commit/0504d0503ba7d62882f47798ff77c2449d2da4ff
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/nix-config-ryan4yin#23