Skip to content

Commit 1211e98

Browse files
Maurice Zhougmelikov
Maurice Zhou
authored andcommitted
NixOS Root on ZFS: Do not bind mount /boot/efi
Previously we used a bind mount from /boot/efis/*-part1 to /boot/efi to facilitate bootloader configuration. Recent reports indicate that this bind mount prevents the system from booting. This pull request removes the bind mount. Closes #383. Signed-off-by: Maurice Zhou <[email protected]>
1 parent 0aaa233 commit 1211e98

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

docs/Getting Started/NixOS/Root on ZFS/2-system-installation.rst

-3
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,3 @@ System Installation
128128
mkdir -p /mnt/boot/efis/${i##*/}-part1
129129
mount -t vfat ${i}-part1 /mnt/boot/efis/${i##*/}-part1
130130
done
131-
132-
mkdir -p /mnt/boot/efi
133-
mount -t vfat $(echo $DISK | cut -f1 -d\ )-part1 /mnt/boot/efi

docs/Getting Started/NixOS/Root on ZFS/3-system-configuration.rst

+9-9
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ System Configuration
2828

2929
sed -i '/boot.loader/d' /mnt/etc/nixos/configuration.nix
3030
sed -i '/services.xserver/d' /mnt/etc/nixos/configuration.nix
31+
tee -a /mnt/etc/nixos/zfs.nix <<EOF
32+
boot.loader.efi.efiSysMountPoint = "/boot/efis/$(echo $DISK | cut -f1 -d\ | sed 's|/dev/disk/by-id/||')-part1";
33+
EOF
3134
tee -a /mnt/etc/nixos/zfs.nix <<-'EOF'
32-
boot.loader.efi.efiSysMountPoint = "/boot/efi";
3335
boot.loader.efi.canTouchEfiVariables = false;
3436
boot.loader.generationsDir.copyKernels = true;
3537
boot.loader.grub.efiInstallAsRemovable = true;
@@ -38,16 +40,9 @@ System Configuration
3840
boot.loader.grub.copyKernels = true;
3941
boot.loader.grub.efiSupport = true;
4042
boot.loader.grub.zfsSupport = true;
41-
boot.loader.grub.extraPrepareConfig = ''
42-
mkdir -p /boot/efis
43-
for i in /boot/efis/*; do mount $i ; done
44-
45-
mkdir -p /boot/efi
46-
mount /boot/efi
47-
'';
4843
boot.loader.grub.extraInstallCommands = ''
4944
ESP_MIRROR=$(mktemp -d)
50-
cp -r /boot/efi/EFI $ESP_MIRROR
45+
cp -r ${config.boot.loader.efi.efiSysMountPoint}/EFI $ESP_MIRROR
5146
for i in /boot/efis/*; do
5247
cp -r $ESP_MIRROR/EFI $i
5348
done
@@ -69,6 +64,11 @@ System Configuration
6964
sed -i 's|fsType = "zfs";|fsType = "zfs"; options = [ "zfsutil" "X-mount.mkdir" ];|g' \
7065
/mnt/etc/nixos/hardware-configuration.nix
7166

67+
#. Mount EFI partitions on demand::
68+
69+
sed -i 's|fsType = "vfat";|fsType = "vfat"; options = [ "x-systemd.idle-timeout=1min" "x-systemd.automount" "noauto" "nofail" ];|g' \
70+
/mnt/etc/nixos/hardware-configuration.nix
71+
7272
#. Set root password::
7373

7474
rootPwd=$(mkpasswd -m SHA-512 -s)

0 commit comments

Comments
 (0)