Skip to content

DIsko failed to install bootloader #1123

@RedJ1ve

Description

@RedJ1ve

I'm having an issue when trying to use disko-install from nixpkgs. Looked through issues but the only similar issue was with bcachefs and changing --mode didnt fix anything for me.

The installation fails with the following error at the bootloader installation step:

efiSysMountPoint = '/boot' is not a mounted partition. Is the path configured correctly?

Traceback (most recent call last):
  File "/nix/store/fnbphh5spf2a1yydylpx0z4jl04yr6s3-systemd-boot/bin/systemd-boot", line 448, in <module>
    main()
  File "/nix/store/fnbphh5spf2a1yydylpx0z4jl04yr6s3-systemd-boot/bin/systemd-boot", line 428, in main
    run([CHECK_MOUNTPOINTS])
  File "/nix/store/fnbphh5spf2a1yydylpx0z4jl04yr6s3-systemd-boot/bin/systemd-boot", line 57, in run
    return subprocess.run(cmd, check=True, text=True, stdout=stdout)
  File "/nix/store/iyff8129iampdw13nlfqalzhxy8y1hi9-python3-3.13.6/lib/python3.13/subprocess.py", line 577, in run
    raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/nix/store/il12adhgpk1xnqk56jl28f1g1pcjaifp-check-mountpoints']' returned non-zero exit status 1.

Failed to install bootloader  
disko-install failed  
rmdir: failed to remove '/mnt/disko-install-root': Directory not empty

Full log excerpt

Click to expand
umount: /mnt/disko-install-root: not mounted
++ realpath /dev/nvme0n1
+ disk=/dev/nvme0n1
+ lsblk -a -f
...
+ cryptsetup -q luksFormat /dev/disk/by-partlabel/disk-main-luks --key-file /tmp/clevis.key
Failed to open key file.
+ rm -rf /tmp/tmp.PgkzLT1qo1
Copying store paths
Loading nix database
installing the boot loader...
setting up /etc...

Configuration

{ inputs, pkgs, ... }: {
  imports = [ inputs.disko.nixosModules.default ];

  disko.devices = {
    disk.main = {
      type = "disk";
      device = "/dev/sda";
      content = {
        type = "gpt";
        partitions = {
          ESP = {
            size = "500M";
            type = "EF00";
            content = {
              type = "filesystem";
              format = "vfat";
              mountpoint = "/boot";
              mountOptions = [ "umask=0077" ];
            };
          };
          luks = {
            size = "100%";
            content = {
              type = "luks";
              name = "crypted";
              settings = {
                allowDiscards = true;
                keyFile = "/tmp/clevis.key";
              };
              content = {
                type = "lvm_pv";
                vg = "pool";
              };
              preCreateHook = ''
                echo "[*] Generating random keyfile..."
                ${pkgs.coreutils}/bin/dd if=/dev/urandom of=/tmp/keyfile bs=1 count=64
              '';
              postCreateHook = ''
                echo "[*] Binding LUKS volume with Clevis (TPM2 + FIDO2)..."
                ${pkgs.clevis}/bin/clevis-luks-bind -k /tmp/keyfile -d /dev/disk/by-partlabel/luks -s 1 \
                  '{"t":2,"pins":{"tpm2":{"pcr_ids":"0,2,4,7"},"fido2":[{},{}]}}'

                echo "[*] Shredding temporary keyfile..."
                ${pkgs.coreutils}/bin/shred -u /tmp/keyfile
              '';
            };
          };
        };
      };
    };

    lvm_vg.pool = {
      type = "lvm_vg";
      lvs = {
        swap = {
          size = "4G";
          content = {
            type = "swap";
            discardPolicy = "both";
            resumeDevice = true;
          };
        };
        btrfs = {
          size = "100%";
          content = {
            type = "btrfs";
            mountpoint = "/";
            subvolumes = {
              "/root" = { mountpoint = "/"; };
              "/home" = { mountpoint = "/home"; mountOptions = [ "compress=zstd" ]; };
              "/nix" = { mountpoint = "/nix"; mountOptions = [ "compress=zstd" "noatime" ]; };
              "/persist" = { mountpoint = "/persist"; mountOptions = [ "compress=zstd" ]; };
              "/log" = { mountpoint = "/var/log"; mountOptions = [ "compress=zstd" ]; };
            };
            postCreateHook = ''
              echo "[*] Creating root-blank snapshot..."
              MNTPOINT=$(mktemp -d)
              mount /dev/mapper/pool-btrfs "$MNTPOINT"
              trap 'umount "$MNTPOINT"; rm -rf "$MNTPOINT"' EXIT
              btrfs subvolume snapshot -r "$MNTPOINT/root" "$MNTPOINT/root-blank"
              echo "[+] Snapshot created: /root-blank"
            '';
          };
        };
      };
    };
  };
}

Any help would be much appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions