From 555fd551aacd5578a22bd6e205b811b622c5508f Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Wed, 21 Jan 2026 03:06:11 -0600 Subject: Fix ZFS boot failures: service conflicts, cachefile, and GRUB duplicate root Three bugs were preventing installed systems from booting: 1. ZFS package preset (50-zfs.preset) enables zfs-import-cache by default, overriding our attempt to use zfs-import-scan. Now explicitly disable zfs-import-cache before enabling zfs-import-scan. 2. zfs-import-scan has ConditionFileNotEmpty=!/etc/zfs/zpool.cache which prevents it from running if cachefile exists. Now remove cachefile after setting cachefile=none. 3. GRUB_CMDLINE_LINUX contained root=ZFS=... but grub-mkconfig also auto-detects ZFS root, causing duplicate root= parameters. Removed manual root= since grub-mkconfig handles it correctly. All 22 tests pass (19 sanity + 3 installation configs). --- custom/install-archzfs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'custom/install-archzfs') diff --git a/custom/install-archzfs b/custom/install-archzfs index 5c2380a..7081a5b 100755 --- a/custom/install-archzfs +++ b/custom/install-archzfs @@ -1091,7 +1091,7 @@ GRUB_DEFAULT=0 GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="Arch Linux (ZFS)" GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3" -GRUB_CMDLINE_LINUX="root=ZFS=$POOL_NAME/ROOT/default spl.spl_hostid=0x$host_id" +GRUB_CMDLINE_LINUX="spl.spl_hostid=0x$host_id" GRUB_PRELOAD_MODULES="part_gpt part_msdos zfs" GRUB_TERMINAL_OUTPUT="console" GRUB_DISABLE_OS_PROBER=true @@ -1161,11 +1161,15 @@ configure_zfs_services() { step "Configuring ZFS Services" arch-chroot /mnt systemctl enable zfs.target + # Use zfs-import-scan instead of zfs-import-cache # This is the recommended method - it uses blkid to scan for pools # and doesn't require a cachefile - arch-chroot /mnt systemctl enable zfs-import-scan - arch-chroot /mnt systemctl enable zfs-mount + # Note: ZFS package preset enables zfs-import-cache by default, so we must + # explicitly disable it before enabling zfs-import-scan + arch-chroot /mnt systemctl disable zfs-import-cache.service + arch-chroot /mnt systemctl enable zfs-import-scan.service + arch-chroot /mnt systemctl enable zfs-mount.service arch-chroot /mnt systemctl enable zfs-import.target # Copy hostid to installed system (ZFS uses this for pool ownership) @@ -1173,7 +1177,10 @@ configure_zfs_services() { cp /etc/hostid /mnt/etc/hostid # Disable cachefile - we use zfs-import-scan which doesn't need it + # Also remove any existing cachefile since zfs-import-scan has a condition + # that prevents it from running if /etc/zfs/zpool.cache exists zpool set cachefile=none "$POOL_NAME" + rm -f /mnt/etc/zfs/zpool.cache # Set bootfs zpool set bootfs="$POOL_NAME/ROOT/default" "$POOL_NAME" -- cgit v1.2.3