From 269fb778396f9c5188e9995b61280bfd12e738b8 Mon Sep 17 00:00:00 2001 From: Adi Hanif Date: Thu, 3 Sep 2026 10:01:04 +0700 Subject: [PATCH] iso-patch: fail loudly when the Ubuntu ISO's minimal.squashfs has no kernel Refs #66. do_ubuntu_to_vhdx builds the rootfs from casper/minimal.squashfs and picks the kernel version up from the first /boot/vmlinuz-* it sees during the walk. On the Ubuntu 26.04 desktop ISO that layer carries the kernel; on 24.04 it does not (the kernel lives only in the minimal.standard.live overlay). A full ingest of ubuntu-24.04.4-desktop-amd64.iso walks 85,075 files / 4.9 GiB and never sees a vmlinuz, so kernel_ver stays empty and the bootstrap grub.cfg is written as: linux /boot/vmlinuz- root=UUID=... ro ... initrd /boot/initrd.img- GRUB cannot load that, the guest sits at the GRUB prompt with one vCPU busy and ~24 MB of RAM touched, the agent never comes up, and the UI shows "Installing Linux" forever with nothing in the log explaining why. Two changes: * tools/iso-patch/ubuntu_vhdx.c: after the squashfs ingest, treat an empty kernel version as a hard error. log_err() reports which image lacked /boot/vmlinuz-* and that only Ubuntu Desktop 26.04 LTS ISOs are supported; exit_code stays 1 so cleanup deletes the VHDX. Also log the detected kernel version as a STATUS line on success. * src/backend_win/asb_core.c (run_iso_patch_ubuntu): forward iso-patch STATUS: and ERROR: lines into the app log. The Windows --to-vhdx path deliberately ignores STATUS lines because the in-guest installer logs are available later; the Linux build has no such fallback, so these lines are the only host-side record of how the disk was built. A cheaper pre-flight on casper/minimal.manifest was considered and dropped: the manifest lists no linux-image-* package on the 26.04 and 26.04.1 ISOs either, so it cannot tell bootable from unbootable images. The post-ingest check reads the actual squashfs contents and only rejects builds that would have produced an unbootable disk. Co-Authored-By: Claude Fable 5.1 --- src/backend_win/asb_core.c | 8 ++++++++ tools/iso-patch/ubuntu_vhdx.c | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/backend_win/asb_core.c b/src/backend_win/asb_core.c index dc7e0f5..d69fc86 100644 --- a/src/backend_win/asb_core.c +++ b/src/backend_win/asb_core.c @@ -2119,11 +2119,19 @@ static HRESULT run_iso_patch_ubuntu(const wchar_t *iso_path, if (g_progress_cb && pvm) g_progress_cb(vm_handle(pvm), pct, is_staging, g_progress_ud); } else if (strncmp(line, "ERROR:", 6) == 0) { + asb_log(L"iso-patch: ERROR: %S", line + 6); if (error_msg && error_msg[0] == L'\0') MultiByteToWideChar(CP_ACP, 0, line + 6, -1, error_msg, (int)error_msg_cap); result = E_FAIL; } else if (strncmp(line, "DONE:", 5) == 0) { result = S_OK; + } else if (strncmp(line, "STATUS:", 7) == 0) { + /* Unlike the Windows --to-vhdx path there is no + in-guest installer log to fall back on, so the + iso-patch status lines (source squashfs, detected + kernel, ingest totals, ...) are the only host-side + record of how the Linux disk was built. */ + asb_log(L"iso-patch: %S", line + 7); } } start = ci + 1; diff --git a/tools/iso-patch/ubuntu_vhdx.c b/tools/iso-patch/ubuntu_vhdx.c index 696650f..929e66d 100644 --- a/tools/iso-patch/ubuntu_vhdx.c +++ b/tools/iso-patch/ubuntu_vhdx.c @@ -2081,6 +2081,22 @@ int do_ubuntu_to_vhdx(const wchar_t *iso_path_arg, goto cleanup; } strncpy(kernel_ver, pl.kernel_version, sizeof(kernel_ver) - 1); + if (kernel_ver[0] == 0) { + /* No /boot/vmlinuz-* was seen during the walk. minimal.squashfs + carries the kernel on the 26.04 desktop ISO, but on 24.04 it + lives only in the minimal.standard.live overlay, so the rootfs + built here has nothing to boot. Writing the bootstrap + grub.cfg with an empty version produces a disk that hangs at + the GRUB prompt while the UI shows "Installing Linux" forever + (jamesstringer90/appsandbox#66). Fail loudly instead; + exit_code stays 1 so cleanup deletes the VHDX. */ + log_err(L"no kernel (/boot/vmlinuz-*) found in %s - the disk would not boot. " + L"Only Ubuntu Desktop 26.04 LTS ISOs are supported.", sqfs_path); + sqfs_close(sq); + ext4_writer_close(ew); + goto cleanup; + } + log_msg(L"kernel: %hs", kernel_ver); sqfs_close(sq); }