Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disko-install error "'/boot' is not a mounted partition" #983

Open
nothingnesses opened this issue Feb 23, 2025 · 0 comments
Open

disko-install error "'/boot' is not a mounted partition" #983

nothingnesses opened this issue Feb 23, 2025 · 0 comments

Comments

@nothingnesses
Copy link

Hello. I've been trying to use disko-install to install NixOS on to my system, but I'm running into an error. Here is my set up:

/tmp/install/disko/disko-install/configuration.nix

{ config, lib, pkgs, ... }:
{
  imports =
    [
      ./hardware-configuration.nix
    ];
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  networking.wireless.iwd.enable = true;
  time.timeZone = "Europe/London";
  i18n.defaultLocale = "en_GB.UTF-8";
  console = {
    keyMap = "uk";
  };
  services.xserver.enable = false;
  services.xserver.xkb.layout = "gb";
  services.pipewire = {
    enable = true;
    pulse.enable = true;
  };
  users.users.a = {
    isNormalUser = true;
    extraGroups = [ "wheel" ];
    packages = with pkgs; [
    ];
  };
  environment.systemPackages = with pkgs; [
  ];
  system.stateVersion = "24.11";
}

/tmp/install/disko/disko-install/flake.nix

{
  inputs.nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
  inputs.disko.url = "github:nix-community/disko/latest";
  inputs.disko.inputs.nixpkgs.follows = "nixpkgs";
  outputs = { self, disko, nixpkgs }: {
    nixosConfigurations.mymachine = nixpkgs.legacyPackages.x86_64-linux.nixos [
      ./configuration.nix
      disko.nixosModules.disko
      {
        disko.devices = {
          disk = {
            main = {
              type = "disk";
              device = "/dev/nvme0n1";
              content = {
                type = "gpt";
                partitions = {
                  ESP = {
                    size = "8G";
                    type = "EF00";
                    content = {
                      type = "filesystem";
                      format = "vfat";
                      mountpoint = "/boot";
                      mountOptions = [ "umask=0077" ];
                    };
                  };
                  root = {
                    size = "100%";
                    content = {
                      type = "luks";
                      name = "crypted";
                      passwordFile = "/tmp/secret.key";
                      settings = {
                        allowDiscards = true;
                      };
                      content = {
                        type = "filesystem";
                        format = "bcachefs";
                        mountpoint = "/";
                      };
                    };
                  };
                };
              };
            };
          };
        };
      }
    ];
  };
}

/tmp/install/disko/disko-install/install.sh

#!/bin/sh
source="/tmp/install/disko/disko-install";
destination="/tmp/config/etc/nixos";
echo -n 'password' > /tmp/secret.key;
nixos-generate-config --root /tmp/config --no-filesystems;
cp -f "${source}/configuration.nix" "${destination}/";
cp -f "${source}/flake.nix" "${destination}/";
sudo script -c "nix --extra-experimental-features 'nix-command flakes' run 'github:nix-community/disko/latest#disko-install' -- --write-efi-boot-entries --flake '${destination}#mymachine' --disk main /dev/nvme0n1" "${source}/log";

To start the installation, first I run a live NixOS environment from a Ventoy flash drive on the system. Then I mount another flash drive containing the above files at mountpoint "/tmp/install/". Then I run the shell script above with sh /tmp/install/disko/disko-install/install.sh. These are the outputs:

/tmp/install/disko/disko-install/log (truncated)

...
depmod: WARNING: could not open modules.builtin.modinfo at /nix/store/wz1r9l458bj8apf0vsbybkb4mgjpwpbr-linux-6.13.3-modules-shrunk/lib/modules/6.13.3: No such file or directory
building '/nix/store/2fmcnjdylkk6wf32x5kqvkk2qgfz9jxi-initrd-linux-6.13.3.drv'...
building '/nix/store/xwhcl77c1hxh0q9ardd5mbin40pdn66h-boot.json.drv'...
building '/nix/store/s72wk2a56akg38qmyy4s7mm8kfhi72kh-nixos-system-nixos-25.05pre-git.drv'...
building '/nix/store/cbmgn6mbz44n8xr6ryvqgy8p8qbq988n-closure-info.drv'...
structuredAttrs is enabled
umount: /mnt/disko-install-root: not mounted
++ realpath /dev/nvme0n1
+ disk=/dev/nvme0n1
+ lsblk -a -f
NAME        FSTYPE      FSVER            LABEL                      UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
loop0       squashfs    4.0                                                                                    0   100% /nix/.ro-store
loop1                                                                                                                   
loop2                                                                                                                   
loop3                                                                                                                   
loop4                                                                                                                   
loop5                                                                                                                   
loop6                                                                                                                   
loop7                                                                                                                   
sda                                                                                                                     
├─sda1      exfat       1.0              Ventoy                     4E21-0000                                           
│ ├─ventoy  iso9660     Joliet Extension nixos-minimal-24.11-x86_64 1980-01-01-00-00-00-00                     0   100% /iso
│ └─sda1    exfat       1.0              Ventoy                     4E21-0000                                           
└─sda2      vfat        FAT16            VTOYEFI                    2205-E719                                           
sdb                                                                                                                     
└─sdb1      vfat        FAT32                                       2459-9AAA                              14.6G     0% /tmp/install
nvme0n1                                                                                                                 
├─nvme0n1p1                                                                                                             
├─nvme0n1p2 vfat        FAT32                                       1FCB-69A0                                           
└─nvme0n1p3 crypto_LUKS 2                                           f040e70d-1437-4335-8028-2932c5e7f9a8                
+ lsblk --output-all --json
+ bash -x
++ dirname /nix/store/3ys93zsghig63qpcs67vc37x0rwn1zhl-disk-deactivate/disk-deactivate
+ jq -r --arg disk_to_clear /dev/nvme0n1 -f /nix/store/3ys93zsghig63qpcs67vc37x0rwn1zhl-disk-deactivate/disk-deactivate.jq
+ set -fu
++ type zdb
++ zdb -l /dev/nvme0n1p1
++ sed -nr 's/ +name: '\''(.*)'\''/\1/p'
+ zpool=
+ [[ -n '' ]]
+ unset zpool
+ wipefs --all -f /dev/nvme0n1p1
+ wipefs --all -f /dev/nvme0n1p2
/dev/nvme0n1p2: 8 bytes were erased at offset 0x00000052 (vfat): 46 41 54 33 32 20 20 20
/dev/nvme0n1p2: 1 byte was erased at offset 0x00000000 (vfat): eb
/dev/nvme0n1p2: 2 bytes were erased at offset 0x000001fe (vfat): 55 aa
+ wipefs --all -f /dev/nvme0n1p3
/dev/nvme0n1p3: 6 bytes were erased at offset 0x00000000 (crypto_LUKS): 4c 55 4b 53 ba be
/dev/nvme0n1p3: 6 bytes were erased at offset 0x00004000 (crypto_LUKS): 53 4b 55 4c ba be
++ type zdb
++ zdb -l /dev/nvme0n1
++ sed -nr 's/ +name: '\''(.*)'\''/\1/p'
+ zpool=
+ [[ -n '' ]]
+ unset zpool
++ lsblk /dev/nvme0n1 -l -p -o type,name
++ awk 'match($1,"raid.*") {print $2}'
+ md_dev=
+ [[ -n '' ]]
+ wipefs --all -f /dev/nvme0n1
/dev/nvme0n1: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54
/dev/nvme0n1: 8 bytes were erased at offset 0x1d1c1115e00 (gpt): 45 46 49 20 50 41 52 54
/dev/nvme0n1: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa
+ dd if=/dev/zero of=/dev/nvme0n1 bs=440 count=1
1+0 records in
1+0 records out
440 bytes copied, 0.000202269 s, 2.2 MB/s
+ lsblk -a -f
NAME       FSTYPE   FSVER            LABEL                      UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
loop0      squashfs 4.0                                                                                    0   100% /nix/.ro-store
loop1                                                                                                               
loop2                                                                                                               
loop3                                                                                                               
loop4                                                                                                               
loop5                                                                                                               
loop6                                                                                                               
loop7                                                                                                               
sda                                                                                                                 
├─sda1     exfat    1.0              Ventoy                     4E21-0000                                           
│ ├─ventoy iso9660  Joliet Extension nixos-minimal-24.11-x86_64 1980-01-01-00-00-00-00                     0   100% /iso
│ └─sda1   exfat    1.0              Ventoy                     4E21-0000                                           
└─sda2     vfat     FAT16            VTOYEFI                    2205-E719                                           
sdb                                                                                                                 
└─sdb1     vfat     FAT32                                       2459-9AAA                              14.6G     0% /tmp/install
nvme0n1                                                                                                             
++ mktemp -d
+ disko_devices_dir=/tmp/tmp.bgbtesscLi
+ trap 'rm -rf "$disko_devices_dir"' EXIT
+ mkdir -p /tmp/tmp.bgbtesscLi
+ device=/dev/nvme0n1
+ imageName=main
+ imageSize=2G
+ name=main
+ type=disk
+ device=/dev/nvme0n1
+ efiGptPartitionFirst=1
+ type=gpt
+ blkid /dev/nvme0n1
+ sgdisk --clear /dev/nvme0n1
Creating new GPT entries in memory.
The operation has completed successfully.
+ sgdisk --align-end --new=1:0:+8G --change-name=1:disk-main-ESP --typecode=1:EF00 /dev/nvme0n1
The operation has completed successfully.
+ partprobe /dev/nvme0n1
+ udevadm trigger --subsystem-match=block
+ udevadm settle
+ sgdisk --align-end --new=2:0:-0 --change-name=2:disk-main-root --typecode=2:8300 /dev/nvme0n1
The operation has completed successfully.
+ partprobe /dev/nvme0n1
+ udevadm trigger --subsystem-match=block
+ udevadm settle
+ device=/dev/disk/by-partlabel/disk-main-ESP
+ extraArgs=()
+ declare -a extraArgs
+ format=vfat
+ mountOptions=('umask=0077')
+ declare -a mountOptions
+ mountpoint=/boot
+ type=filesystem
+ blkid /dev/disk/by-partlabel/disk-main-ESP
+ grep -q TYPE=
+ mkfs.vfat /dev/disk/by-partlabel/disk-main-ESP
mkfs.fat 4.2 (2021-01-31)
+ additionalKeyFiles=()
+ declare -a additionalKeyFiles
+ askPassword=
+ device=/dev/disk/by-partlabel/disk-main-root
+ extraFormatArgs=()
+ declare -a extraFormatArgs
+ extraOpenArgs=()
+ declare -a extraOpenArgs
+ initrdUnlock=1
+ keyFile=
+ name=crypted
+ passwordFile=/tmp/secret.key
+ settings=(['allowDiscards']='1')
+ declare -A settings
+ type=luks
+ blkid /dev/disk/by-partlabel/disk-main-root
+ blkid /dev/disk/by-partlabel/disk-main-root -o export
+ grep -q '^TYPE='
+ cryptsetup -q luksFormat /dev/disk/by-partlabel/disk-main-root --key-file /dev/fd/63
++ set +x
+ cryptsetup open /dev/disk/by-partlabel/disk-main-root crypted --allow-discards --key-file /dev/fd/63 --persistent
++ set +x
+ device=/dev/mapper/crypted
+ extraArgs=()
+ declare -a extraArgs
+ format=bcachefs
+ mountOptions=('defaults')
+ declare -a mountOptions
+ mountpoint=/
+ type=filesystem
+ blkid /dev/mapper/crypted
+ grep -q TYPE=
+ mkfs.bcachefs /dev/mapper/crypted
Refusing to format when using libblkid 2.39.4
libblkid >= 2.40.1 is required to check for existing filesystems
Earlier versions may not recognize some bcachefs filesystems.

+ rm -rf /tmp/tmp.bgbtesscLi
Copying store paths
Loading nix database
installing the boot loader...
setting up /etc...
efiSysMountPoint = '/boot' is not a mounted partition. Is the path configured correctly?
Traceback (most recent call last):
  File "/nix/store/7vkvjqgs6rzh2g80lcn3wn5qim286bfc-systemd-boot/bin/systemd-boot", line 431, in <module>
    main()
  File "/nix/store/7vkvjqgs6rzh2g80lcn3wn5qim286bfc-systemd-boot/bin/systemd-boot", line 411, in main
    run([CHECK_MOUNTPOINTS])
  File "/nix/store/7vkvjqgs6rzh2g80lcn3wn5qim286bfc-systemd-boot/bin/systemd-boot", line 58, in run
    return subprocess.run(cmd, check=True, text=True, stdout=stdout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/0l539chjmcq5kdd43j6dgdjky4sjl7hl-python3-3.12.8/lib/python3.12/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/nix/store/jpd5q73wqvbiq39yihp35m1aklp85a47-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

Script done on 2025-02-23 09:29:23+00:00 [COMMAND_EXIT_CODE="1"]

This is the full log file.

I'm not sure what disko-install is supposed to do exactly, but I'm assuming it's supposed to mount the partitions it creates to mountpoints in "/mnt/disko-install-root/" (so it can later use something like chroot/proot to use that as "/" and proceed with the rest of the installation), which it didn't seem like it did (since there's the line saying "umount: /mnt/disko-install-root: not mounted").

Please can you tell me what I'm doing wrong and what I should do to make the installation proceed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant