Fix ARM64 boot: use official archiso mkinitcpio hooks from releng profile

The custom simplified hooks we were writing to the airootfs overlay
overwrote the official hooks shipped in the releng profile. The official
hooks handle uname -m for the aarch64 squashfs path, include all required
modules (squashfs, overlay, iso9660, loop, dm-snapshot, nls_*) and
binaries (blkid, findfs, losetup, switch_root), and wire up mount_handler
correctly. Our stripped-down hooks caused the overlay to mount empty,
producing the "Root device mounted successfully, but /sbin/init does not
exist" panic at boot.

Fix: stop overwriting the official hooks; keep only the mkinitcpio.conf
(which lists the hook names, not their implementation). Also remove
plymouth from initramfs HOOKS to reduce boot complexity.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
nmemmertandClaude Sonnet 4.6 committed 2026-07-27 08:23:23 -04:00
1 parent e56412ecdd
commit 22b311790e
1 file changed
+6 -67
+6 -67
View File
@@ -146,79 +146,18 @@ rm -f "$PROFILE/packages.x86_64"
# ── 3. airootfs overlay — files that land in the live system ─────────
AIROOTFS="$PROFILE/airootfs"
# ── Ship our own archiso mkinitcpio hooks ────────────────────────────
mkdir -p "$AIROOTFS/usr/lib/initcpio/hooks"
mkdir -p "$AIROOTFS/usr/lib/initcpio/install"
cat > "$AIROOTFS/usr/lib/initcpio/hooks/archiso" <<'HOOK'
run_hook() {
export mount_handler="archiso_mount_handler"
}
archiso_mount_handler() {
local _newroot="${1}"
local _dev _sfs _i
[ -z "${archisobasedir}" ] && archisobasedir="arch"
if [ -z "${archisolabel}" ]; then
echo "ERROR: archisolabel not set"
return 1
fi
_i=0
while [ "${_i}" -lt 30 ]; do
_dev=$(blkid --match-token LABEL="${archisolabel}" --output device 2>/dev/null | head -1)
[ -n "${_dev}" ] && break
sleep 1
_i=$((_i + 1))
done
if [ -z "${_dev}" ]; then
echo "ERROR: archiso: cannot find device with label '${archisolabel}'"
return 1
fi
mkdir -p /run/archiso/bootmnt
mount -r "${_dev}" /run/archiso/bootmnt
# aarch64 squashfs path
_sfs="/run/archiso/bootmnt/${archisobasedir}/aarch64/airootfs.sfs"
mkdir -p /run/archiso/airootfs
mount -r -t squashfs "${_sfs}" /run/archiso/airootfs
mkdir -p /run/archiso/cowspace
mount -t tmpfs -o "size=75%,mode=0755" tmpfs /run/archiso/cowspace
mkdir -p /run/archiso/cowspace/upper /run/archiso/cowspace/work
mount -t overlay overlay \
-o "lowerdir=/run/archiso/airootfs,upperdir=/run/archiso/cowspace/upper,workdir=/run/archiso/cowspace/work" \
"${_newroot}"
}
HOOK
cat > "$AIROOTFS/usr/lib/initcpio/install/archiso" <<'INSTALL'
build() {
add_runscript
add_binary blkid
add_binary sleep
add_module squashfs
add_module overlay
add_module iso9660
add_module vfat
add_dir /run/archiso/bootmnt
add_dir /run/archiso/airootfs
add_dir /run/archiso/cowspace
}
help() {
echo "Mounts the archiso squashfs for live boot."
}
INSTALL
# The releng profile already ships official archiso mkinitcpio hooks at
# $PROFILE/airootfs/usr/lib/initcpio/{hooks,install}/archiso.
# Do NOT overwrite them — the official hooks handle uname -m arch detection,
# correct squashfs paths, all required modules/binaries, and mount_handler
# wiring. Our simplified custom hooks were causing "sbin/init not found".
mkdir -p "$AIROOTFS/etc/mkinitcpio.conf.d"
cat > "$AIROOTFS/etc/mkinitcpio.conf.d/archiso.conf" <<'MKCONF'
MODULES=()
BINARIES=()
FILES=()
HOOKS=(base udev plymouth archiso block filesystems keyboard)
HOOKS=(base udev archiso block filesystems keyboard)
MKCONF
cat > "$AIROOTFS/etc/hostname" <<'EOF'