From 8525cd331c88b8d0f6b1be2c0207f4e68c449834 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 20 Jan 2026 19:23:50 -0600 Subject: Fix ZFS boot failure: set cachefile property after pool creation - Add zpool set cachefile=/etc/zfs/zpool.cache after pool creation - Without this, initramfs ZFS hook can't import pool at boot - Causes "cannot import '(null)': no such pool available" error - Add cachefile property test to full-test.sh --- custom/install-archzfs | 7 ++++ docs/session-context.org | 84 +++++++++++++++++++++++++++--------------------- scripts/full-test.sh | 9 ++++++ 3 files changed, 63 insertions(+), 37 deletions(-) diff --git a/custom/install-archzfs b/custom/install-archzfs index 202732d..e93186d 100755 --- a/custom/install-archzfs +++ b/custom/install-archzfs @@ -810,6 +810,13 @@ 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" } diff --git a/docs/session-context.org b/docs/session-context.org index a172717..06f18c5 100644 --- a/docs/session-context.org +++ b/docs/session-context.org @@ -1,40 +1,50 @@ #+TITLE: Session Context #+DATE: 2026-01-20 -* Previous Session: Monday 2026-01-20 - -** Completed - -*** Fixed hostid mismatch bug (commit 0524467) -- Root cause: ~hostid~ command returned value X, then ~zgenhostid~ created /etc/hostid with value Y -- Fix: Call ~zgenhostid~ FIRST in configure_bootloader(), then read consistent value -- Verified: GRUB and /etc/hostid match after installation - -*** Added Avahi mDNS to installed systems (commit f62bf9b) -- Packages: avahi, nss-mdns added to pacstrap -- Service: avahi-daemon enabled -- Matches archsetup implementation -- Systems now accessible as .local after install - -*** Added Avahi validation to test scripts (commit 7b6c409) -- sanity-test.sh: Check avahi-daemon enabled and running -- test-install.sh: Verify packages and service on installed system - -*** Fixed full-test.sh bug (commit a774bae) -- Bug: ((TESTS_PASSED++)) returns exit code 1 when starting at 0 -- Fix: Use pre-increment ((++TESTS_PASSED)) - -** Test Results -- Sanity test: 15/15 passed -- Single-disk install: PASS -- Mirror install: PASS -- RAIDZ1 install: PASS - -** ISO Distributed -- ~/Downloads/isos/ -- truenas.local:/mnt/vault/isos/ -- /dev/sda (ARCHZFS USB boot drive) -- /dev/sdb1 (Ventoy) - -** Notes -- ratio needs reinstall with fixed ISO (or manual hostid fix) +* Current Session: Tuesday 2026-01-20 @ ~11:00 CST + +** Status: REBUILDING ISO + +Build in progress with the following fixes: +- Added /etc/hosts with archzfs hostname entries +- Added /etc/nsswitch.conf with mdns_minimal for mDNS resolution +- Added inetutils package (provides hostname command) +- Updated sanity test to use `cat /etc/hostname` instead of `hostname` + +** Changes Made This Session (ALL UNCOMMITTED) + +*** build.sh +- Added safe_cleanup_work_dir() function and trap (from interrupted session) +- Fixed shadow file handling (sed instead of replace) +- Added /etc/hosts file creation +- Added nsswitch.conf configuration for nss-mdns +- Added inetutils to package list + +*** scripts/sanity-test.sh +- Added test: "Root password is set" +- Added test: "Avahi package installed" +- Added test: "nss-mdns configured" +- Added test: "Hostname is archzfs" +- Changed hostname test to use `cat /etc/hostname` + +*** ~/code/archsetup/inbox/console-display-issues.txt (NEW FILE) +Documented 5 potential console issues from earlier investigation. + +** After Build Completes + +1. Write ISO to USB drives (/dev/sda and /dev/sdb) +2. Wait for Craig's confirmation before testing on ratio +3. Commit changes after successful test + +** Commit Message (After Testing Succeeds) + +#+begin_src bash +git add -A +git commit -m "Fix mDNS, hostname, and build safety + +- Add safe_cleanup_work_dir() to prevent /dev corruption on interrupted builds +- Fix shadow file: use sed to modify root entry instead of replacing file +- Add /etc/hosts and /etc/nsswitch.conf for proper hostname/mDNS +- Add inetutils package for hostname command +- Add sanity tests for password, avahi, mdns, and hostname" +#+end_src diff --git a/scripts/full-test.sh b/scripts/full-test.sh index 811dfa6..9537411 100755 --- a/scripts/full-test.sh +++ b/scripts/full-test.sh @@ -448,6 +448,15 @@ CONF" fi $VERBOSE && info "Genesis snapshot exists" + # Check cachefile property is set (required for boot) + local cachefile=$(ssh_cmd "zpool get -H -o value cachefile zroot" 2>/dev/null) + if [[ "$cachefile" != "/etc/zfs/zpool.cache" ]]; then + fail "$test_name: Pool cachefile not set (was: '$cachefile', need: '/etc/zfs/zpool.cache')" + cleanup + return 1 + fi + $VERBOSE && info "Pool cachefile property set correctly" + # Check kernel local kernel=$(ssh_cmd "uname -r" 2>/dev/null) if [[ "$kernel" != *"lts"* ]]; then -- cgit v1.2.3