Add debug to packer build

This commit is contained in:
Audiobuzz
2026-06-15 12:02:50 +00:00
parent da78ddbd29
commit 2037531771
2 changed files with 21 additions and 12 deletions
+10 -12
View File
@@ -210,22 +210,20 @@ build {
# No local bootloader regeneration wanted on kernel updates inside CI
"command -v grub2-mkconfig >/dev/null && echo 'GRUB updates not used on diskless hosts' || true",
# ---- DEBUG (temporary): why isn't nvmf-connect.service landing? -----
"echo '=== 95dot1x-macsec module dir on build VM ==='; ls -la /usr/lib/dracut/modules.d/95dot1x-macsec/ || true",
"echo '=== module-setup.sh nvmf/unitdir lines ==='; grep -n 'nvmf-connect\\|_unitdir\\|systemdsystemunitdir' /usr/lib/dracut/modules.d/95dot1x-macsec/module-setup.sh || echo NONE",
# ---- Build the fleet-generic initramfs ------------------------------
# %%{ escapes the rpm query tags so Packer's HCL template engine treats
# them as literals (a bare %{...} is parsed as a template directive).
"KVER=$(rpm -q --qf '%%{VERSION}-%%{RELEASE}.%%{ARCH}\\n' kernel | sort -V | tail -1)",
"dracut --debug -f --no-hostonly --kver \"$KVER\" /boot/initramfs-generic.img 2>/tmp/dracut.log",
"echo '=== ALL nvmf-connect mentions in dracut.log (install AND any later removal) ==='; grep -n 'nvmf-connect' /tmp/dracut.log || echo NONE",
"echo '=== final image: nvmf/dot1x survivors ==='; lsinitrd /boot/initramfs-generic.img | grep -iE 'nvmf|dot1x|sbin/nvmf' || echo 'NO nvmf/dot1x files survived'",
"lsinitrd /boot/initramfs-generic.img | grep -E 'macsec|wpa_supplicant|tpm2_nvread|nvme.tcp|erofs|veritysetup' ",
# Assert the test-mode NVMe-oF connect unit made it in (the dracut module
# installs it; this initramfs is systemd-driven so the connect is a
# systemd unit, not a dracut hook). Hard-fail if missing.
"lsinitrd /boot/initramfs-generic.img | grep -q 'nvmf-connect.service' || { echo 'ERROR: nvmf-connect.service missing from initramfs' >&2; exit 1; }",
"dracut -f --no-hostonly --kver \"$KVER\" /boot/initramfs-generic.img",
# Capture the listing to a file and grep THAT — never `lsinitrd | grep -q`.
# grep -q closes the pipe on first match, lsinitrd dies of SIGPIPE, and
# under pipefail the pipeline reports failure even when the file is
# present (a false negative that wrongly failed the build for many runs).
"lsinitrd /boot/initramfs-generic.img > /tmp/lsinitrd.txt",
"grep -E 'macsec|wpa_supplicant|tpm2_nvread|nvme.tcp|erofs|veritysetup' /tmp/lsinitrd.txt",
# Assert the test-mode NVMe-oF connect unit made it in (systemd-driven
# initramfs → the connect is a systemd unit, not a dracut hook).
"grep -q 'nvmf-connect.service' /tmp/lsinitrd.txt || { echo 'ERROR: nvmf-connect.service missing from initramfs' >&2; exit 1; }",
# ---- Build hygiene ---------------------------------------------------
"dnf clean all",