Stuck Waiting 10 seconds for luks device

Hi :wave: ,

I know this is not a direct issue with disko per say, but more my usage of it. I am struggling to get to decrypt a LUKs device when using disko and would love some help to see what I am doing wrong.

I am getting the following error:

waiting 10 seconds for device /dev/disk/by-partlabel/luks to appear ......... - failure /dev/disk/by-partlabel/luks is unavailable

Disko Config for device
disko.devices = {
  disk = {
    nvme0n1 = {
      type = "disk";
      device = "/dev/vda";
      # device = "/dev/nvme0n1";
      content = {
        type = "gpt";
        partitions = {
          ESP = {
            label = "boot";
            name = "ESP";
            size = "512M";
            type = "EF00";
            content = {
              type = "filesystem";
              format = "vfat";
              mountpoint = "/boot";
              mountOptions = [
                "defaults"
              ];
            };
          };

          swap = {
            label = "swap";
            size = "32G";
            content = {
              type = "swap";
              resumeDevice = true;
              randomEncryption = true;
            };
          };

          luks = {
            size = "100%";
            label = "luks";
            content = {
              type = "luks";
              name = "cryptroot";
              extraOpenArgs = [
                "--allow-discards"
                "--perf-no_read_workqueue"
                "--perf-no_write_workqueue"
              ];
              # https://0pointer.net/blog/unlocking-luks2-volumes-with-tpm2-fido2-pkcs11-security-hardware-on-systemd-248.html
              #settings = { crypttabExtraOpts = [ "fido2-device=auto" "token-timeout=10" ]; };
              content = {
                type = "btrfs";
                extraArgs = [ "-L" "nixos" "-f" ];
                subvolumes = {
                  "/root" = {
                    mountpoint = "/";
                    mountOptions = [ "subvol=root" "compress=zstd" "noatime" ];
                  };
                  "/home" = {
                    mountpoint = "/home";
                    mountOptions = [ "subvol=home" "compress=zstd" "noatime" ];
                  };
                  "/nix" = {
                    mountpoint = "/nix";
                    mountOptions = [ "subvol=nix" "compress=zstd" "noatime" ];
                  };
                  "/persist" = {
                    mountpoint = "/persist";
                    mountOptions = [ "subvol=persist" "compress=zstd" "noatime" ];
                  };
                  "/log" = {
                    mountpoint = "/var/log";
                    mountOptions = [ "subvol=log" "compress=zstd" "noatime" ];
                  };
                };
              };
            };
          };
        };
      };
    };
  };
};

fileSystems."/persist".neededForBoot = true;

Grub config
{ pkgs
, inputs
, ...
}: {
boot = {
  loader = {
    efi = {
      canTouchEfiVariables = true;
      efiSysMountPoint = "/boot";
    };
    grub = {
      enable = true;
      efiSupport = true;
      theme = inputs.grub-theme + "/src/catppuccin-mocha-grub-theme";
      device = "nodev";
    };
  };
  kernelPackages = pkgs.linuxPackages_latest;
};
}

I have a custom ISO which has an install script which partitions the drive during running the script:

          sudo nix run github:nix-community/disko \
          --extra-experimental-features "nix-command flakes" \
          --no-write-lock-file \
          -- \
          --mode zap_create_mount \
          "$HOME/dotfiles/hosts/$TARGET_HOST/disks.nix"
Previous initrd config
boot = {
  loader = {
    systemd-boot.enable = true;
    efi.canTouchEfiVariables = true;
  };
  initrd.luks.devices = {
    root = {
      device = "/dev/disk/by-uuid/0c07218e-5df9-4312-b0da-06b5881c1236";
      preLVM = true;
    };
  };
};

:heart: Any ideas what I am missing here ? I believe luks automatically adds an entry to the initrd for us: https://github.com/nix-community/disko/blob/98a6ab9b52f8b06db9c3116b1761bbeaf9484408/lib/types/luks.nix#L66-L70

Device Config: hosts/framework/configuration.nix · 80483732a327990126cf289a30690e8607bce36e · Haseeb Majid / dotfiles · GitLab

Related Issue on Github: Waiting 10 seconds for luks device · Issue #386 · nix-community/disko · GitHub (or rather a copy paste :sweat: )

1 Like

In case you haven’t figured it out yet, I recently ran into this and in my case turned out I was missing

If you’re booting from a NixOS live USB image, run nixos-generate-config --show-hardware-config and grab the boot.initrd.availableKernelModules list.

I’m not running on a framework yet, but I believe I was missing the nvme module (among other things). :slight_smile:

1 Like

Thanks a lot.
I did check, but obviously sloppy.
I missed the “nvme”

1 Like