Skip to content

iso-patch: fail loudly when the Ubuntu ISO's minimal.squashfs has no kernel (refs #66) - #122

Open
adihanifsdr wants to merge 1 commit into
jamesstringer90:mainfrom
adihanifsdr:fix/iso-patch-missing-kernel
Open

iso-patch: fail loudly when the Ubuntu ISO's minimal.squashfs has no kernel (refs #66)#122
adihanifsdr wants to merge 1 commit into
jamesstringer90:mainfrom
adihanifsdr:fix/iso-patch-missing-kernel

Conversation

@adihanifsdr

Copy link
Copy Markdown

Refs #66 (Ubuntu 24.04 ISO hangs at "Installing Linux"). @jamesstringer90 — this doesn't add 24.04 support, it just turns the silent hang into an immediate, explained failure.

What happens today

do_ubuntu_to_vhdx ingests casper/minimal.squashfs and takes the kernel version from the first /boot/vmlinuz-* seen during the walk. On the 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 — so kernel_ver stays empty and the bootstrap grub.cfg is written as:

linux  /boot/vmlinuz- root=UUID=... ro console=tty0 console=ttyS0,115200
initrd /boot/initrd.img-

GRUB can't load that. The guest sits at the GRUB prompt (1 vCPU at ~30 %, the other 7 at 0 %, ~24 MB of guest RAM touched, nothing on the COM1 serial pipe because the kernel never starts), the agent never connects, and the UI shows "Installing Linux" forever. Nothing in the log says why, because run_iso_patch_ubuntu only parses PROGRESS: / ERROR: / DONE: and drops iso-patch's STATUS: lines.

Full-ingest evidence from ubuntu-24.04.4-desktop-amd64.iso with this patch applied:

STATUS:Source squashfs: E:\casper\minimal.squashfs
STATUS:ingest: walk=0 files=85075 dirs=9287 syms=29728 special=8 errors=0 bytes=4901.4 MiB
ERROR:no kernel (/boot/vmlinuz-*) found in E:\casper\minimal.squashfs - the disk would not boot. Only Ubuntu Desktop 26.04 LTS ISOs are supported.
EXITCODE:1        (VHDX deleted by cleanup)

Changes

  • tools/iso-patch/ubuntu_vhdx.c — after the squashfs ingest, an empty kernel version is a hard error: log_err() names the image that lacked /boot/vmlinuz-* and states that only Ubuntu Desktop 26.04 LTS ISOs are supported; exit_code stays 1 so cleanup deletes the VHDX. On success the detected kernel is logged as a STATUS: line.
  • src/backend_win/asb_core.c (run_iso_patch_ubuntu) — forward iso-patch STATUS: and ERROR: lines into the app log as iso-patch: .... The Windows --to-vhdx path intentionally ignores STATUS: 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.

With both, a 24.04 ISO now fails the create step in ~70 s with the error surfaced in the UI log and as the create error, instead of leaving a VM that never finishes.

Considered and dropped

A cheap pre-flight on casper/minimal.manifest (refuse before the ingest if no linux-image-* line) would have saved the ~70 s, but the manifest lists no linux-image-* package on the 26.04 and 26.04.1 ISOs either (checked via range reads against releases.ubuntu.com), so it can't discriminate. The post-ingest check reads the real squashfs contents and only rejects builds that would have been unbootable anyway — there is no path where a currently-working 26.04 build is affected.

Testing

  • Built iso-patch.vcxproj and AppSandbox.sln Release|x64 (VS 2026 Community). Only pre-existing warnings (xz_crc64_init in prefetch_build_deps.c, DwmSetWindowAttribute in vm_display_idd.c).
  • iso-patch.exe --ubuntu-to-vhdx ubuntu-24.04.4-desktop-amd64.iso --output ... --size-gb 16 (elevated): full ingest, then the new error, exit code 1, no VHDX left behind (log excerpt above).
  • Reproduced the original hang on Windows 11 26200 / RTX 3070 with the same ISO before the patch: VM stuck 1.5 h at "Installing Linux" with the vCPU/memory/serial signature described above.

🤖 Generated with Claude Code

…kernel

Refs jamesstringer90#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 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant