From a68150f7f0436e8260c9c0257f98b3a0a07b629a Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Wed, 21 Jan 2026 00:33:42 -0600 Subject: Use zfs-import-scan instead of zfs-import-cache for boot Switch to the recommended pool import method that uses blkid to scan for pools instead of relying on zpool.cache. This eliminates the complexity of managing cachefile paths with altroot during installation. Changes: - Remove cachefile setup from create_zfs_pool() and configure_zfs_services() - Enable zfs-import-scan.service instead of zfs-import-cache.service - Set cachefile=none on the pool since it's not needed - Update full-test.sh to verify zfs-import-scan is enabled This approach is recommended per the Arch Wiki and doesn't require the cachefile to be present in the initramfs. --- custom/install-archzfs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'custom/install-archzfs') diff --git a/custom/install-archzfs b/custom/install-archzfs index e93186d..5c2380a 100755 --- a/custom/install-archzfs +++ b/custom/install-archzfs @@ -773,6 +773,7 @@ create_zfs_pool() { fi # Create pool (with or without encryption) + # Note: We use zfs-import-scan at boot which doesn't require a cachefile if [[ "$NO_ENCRYPT" == "yes" ]]; then warn "Creating pool WITHOUT encryption (testing mode)" zpool create -f \ @@ -810,13 +811,6 @@ create_zfs_pool() { fi info "ZFS pool created successfully." - - # Set cachefile property - required for initramfs ZFS hook to import pool at boot - # Without this, mkinitcpio won't include zpool.cache and boot will fail with - # "cannot import '(null)': no such pool available" - info "Setting pool cachefile for boot..." - zpool set cachefile=/etc/zfs/zpool.cache "$POOL_NAME" - zpool status "$POOL_NAME" } @@ -1167,7 +1161,10 @@ configure_zfs_services() { step "Configuring ZFS Services" arch-chroot /mnt systemctl enable zfs.target - arch-chroot /mnt systemctl enable zfs-import-cache + # 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 arch-chroot /mnt systemctl enable zfs-import.target @@ -1175,10 +1172,8 @@ configure_zfs_services() { # Note: hostid is generated in configure_bootloader, so it always exists here cp /etc/hostid /mnt/etc/hostid - # Generate zpool cache - mkdir -p /mnt/etc/zfs - zpool set cachefile=/etc/zfs/zpool.cache "$POOL_NAME" - cp /etc/zfs/zpool.cache /mnt/etc/zfs/ + # Disable cachefile - we use zfs-import-scan which doesn't need it + zpool set cachefile=none "$POOL_NAME" # Set bootfs zpool set bootfs="$POOL_NAME/ROOT/default" "$POOL_NAME" -- cgit v1.2.3