Skip to content

Make the hybrid ISO in one native xorriso run (MX/Debian) - #55

Merged
AdrianTM merged 2 commits into
MX-Linux:mainfrom
fehlix:native-xorriso
Nov 24, 2026
Merged

AdrianTM merged 2 commits into
MX-Linux:mainfrom
fehlix:native-xorriso

Conversation

@fehlix

@fehlix fehlix commented Nov 23, 2026

Copy link
Copy Markdown

src/work.cpp, createIso(), MX/Debian paths (isolinux and --grub-mbr): the xorriso call is a list of native xorriso commands (commented, same as build-iso's make_xorriso_iso), passed via bash "$@" - no shell parsing of paths, umask 022 kept. One run makes the hybrid ISO:

  • isolinux: isohdpfx.bin MBR (package isolinux) + efi.img as GPT/MBR EFI partition (before: separate "isohybrid --uefi" run)
  • --grub-mbr: GRUB's boot_hybrid.img from the template (same GRUB build as its eltorito.img) + efi.img appended as EFI partition. Before there was no GRUB MBR at all (BIOS from USB could not work) and isohybrid ran on a GRUB image it does not know.
  • partition 1 starts at 32 KiB (partition_offset 16), MBR type 0x00 - as Debian's ISOs; fdisk/parted show a clean table
  • Intel Macs (HFS+, APM, blessed boot.efi) automatically when the template carries System/Library/CoreServices/boot.efi The isohybrid step only runs as fallback when isohdpfx.bin is missing. "Make isohybrid" off: plain ISO as before. Arch path unchanged. debian/control: + isolinux (Depends).

Tested: the same xorriso argument list on a split tree like mx-snapshot uses (iso-template + iso-2/antiX/linuxfs), November 2026 ISO + new boot set: QEMU BIOS, UEFI, UEFI Secure Boot, 32-bit UEFI; DVD and USB; menus everywhere; desktop reached. A real snapshot run needs root (to do).

src/work.cpp, createIso(), MX/Debian paths (isolinux and --grub-mbr):
the xorriso call is a list of native xorriso commands (commented, same
as build-iso's make_xorriso_iso), passed via bash "$@" - no shell
parsing of paths, umask 022 kept. One run makes the hybrid ISO:
- isolinux: isohdpfx.bin MBR (package isolinux) + efi.img as GPT/MBR
  EFI partition (before: separate "isohybrid --uefi" run)
- --grub-mbr: GRUB's boot_hybrid.img from the template (same GRUB build
  as its eltorito.img) + efi.img appended as EFI partition. Before there
  was no GRUB MBR at all (BIOS from USB could not work) and isohybrid
  ran on a GRUB image it does not know.
- partition 1 starts at 32 KiB (partition_offset 16), MBR type 0x00 -
  as Debian's ISOs; fdisk/parted show a clean table
- Intel Macs (HFS+, APM, blessed boot.efi) automatically when the
  template carries System/Library/CoreServices/boot.efi
The isohybrid step only runs as fallback when isohdpfx.bin is missing.
"Make isohybrid" off: plain ISO as before. Arch path unchanged.
debian/control: + isolinux (Depends).

Tested: the same xorriso argument list on a split tree like mx-snapshot
uses (iso-template + iso-2/antiX/linuxfs), November 2026 ISO + new boot
set: QEMU BIOS, UEFI, UEFI Secure Boot, 32-bit UEFI; DVD and USB; menus
everywhere; desktop reached. A real snapshot run needs root (to do).

@AdrianTM AdrianTM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This review was written and posted by Claude (Claude Code, an AI assistant) for the account owner. It covers c0f7f40 compared with 43d70b0.

Thanks for moving the hybrid step into a single xorriso run. It fixes GRUB mode with make_isohybrid on: the old path always failed in isohybrid ("boot loader does not have an isolinux.bin hybrid signature"). I tested with xorriso 1.5.6 and the mx-iso-template 26.11.2mx25+1 template. A few issues:

1. A Mac template without .disk_label makes xorriso abort.
The Mac block checks only for boot.efi, then always runs -find /System/Library/CoreServices/.disk_label -exec set_hfs_crtp .... If boot.efi exists and .disk_label doesn't, xorriso exits with code 5:

xorriso : FAILURE : Cannot find path '/System/Library/CoreServices/.disk_label' in loaded ISO image
xorriso : aborting : -abort_on 'FAILURE' encountered 'FAILURE'

The current MX templates have no System/ directory, so this can't happen today. It only affects custom or other-distro templates. Suggested fix: add the .disk_label -find/-exec pair only when QFileInfo::exists(templateDir + "/System/Library/CoreServices/.disk_label").

2. With make_isohybrid=no, Mac files still add HFS+ and an Apple Partition Map.
The Mac block ignores makeIsohybrid. With Mac files and hybrid off, both the ISOLINUX and the GRUB image get a system area holding an APM with an HFSPLUS_Hybrid / Apple_HFS partition. The old commands produced no system area in that configuration on either path. Since an APM is a partition table, I'd put the Mac block under if (settings->makeIsohybrid), unless HFS+ on a plain ISO is intended. If it is intended, a comment saying so would help.

3. The xorriso dependency floor is too low.
-boot_image any iso_mbr_part_type= arrived in libisoburn 1.4.8 (upstream ChangeLog: "New -boot_image bootspec iso_mbr_part_type="). Both binary stanzas in debian/control still say xorriso (>= 1.4.6). Please change both to xorriso (>= 1.4.8). I checked this against the changelog, not a 1.4.6 binary. In practice only stretch-era systems are affected.

4. In the ISOLINUX hybrid image, the backup GPT header is not at the end of the file.
I compared the GPT header's alternate LBA with the file size:

Image Backup GPT header
old (mkisofs + isohybrid --uefi) last sector
this PR 640 sectors before EOF
-padding included only 40 before EOF
no_emul_toc only 600 before EOF
both last sector

This shouldn't stop the image from booting. Once the image is written to a USB stick larger than itself, the backup header isn't at the end of the device in either version. It does make partitioning tools warn when they inspect the .iso itself. Suggested fix: add -padding included and change the compliance rule to -compliance iso_9660_level=3:no_emul_toc. no_emul_toc also matches what the old -as mkisofs command did.

Nit: when boot_hybrid.img is missing in GRUB mode, the warning says "no BIOS boot from USB", but hybridDone stays false. The code then falls back to isohybrid, which fails on a GRUB image and stops the build with the "Could not make the ISO hybrid" dialog. The old code did the same, so this isn't a regression. Either make the warning say so, or skip isohybrid in GRUB mode.

🤖 Generated with Claude Code

- Mac files: add the .disk_label -find/-exec only when the file exists
  (xorriso aborted with "Cannot find path" when a template had boot.efi
  but no .disk_label).
- Mac files only with "make isohybrid": HFS+ brings an Apple Partition
  Map, so a plain ISO (make_isohybrid=no) stays without a system area,
  as before.
- -compliance iso_9660_level=3:no_emul_toc and -padding included: the
  backup GPT header is now in the last sector of the ISO file (as with
  isohybrid before); no_emul_toc as the old -as mkisofs command did.
- debian/control: xorriso (>= 1.4.8) - iso_mbr_part_type= is new in
  libisoburn 1.4.8.
- GRUB mode without boot_hybrid.img: skip isohybrid (it only knows
  isolinux.bin and stopped the build); the warning says the ISO then
  boots from DVD only.
@fehlix

fehlix commented Nov 23, 2026

Copy link
Copy Markdown
Author

Thanks for the careful review - all points confirmed and fixed in the new commit.

  1. .disk_label missing: reproduced (xorriso exit 5, "Cannot find path"). The -find/-exec set_hfs_crtp pair is now only added when System/Library/CoreServices/.disk_label exists. (build-iso had the same block; fixed there too, build-iso-mx PR #90.)

  2. Mac files with make_isohybrid=no: reproduced (APM with HFSPLUS_Hybrid on a plain ISO). The Mac block is now under settings->makeIsohybrid, so a plain ISO stays without a system area, as before.

  3. xorriso floor: confirmed in the libisoburn ChangeLog (iso_mbr_part_type= new in 1.4.8). Both stanzas now xorriso (>= 1.4.8).

  4. Backup GPT header: reproduced (alpha ISO: 668 sectors before EOF; old isohybrid ISO: last sector). Added -padding included and -compliance iso_9660_level=3:no_emul_toc; the backup header is now in the last sector, and sgdisk -v no longer reports "secondary header ... doesn't reside at the end". Same change in build-iso.

Nit: in GRUB mode without boot_hybrid.img isohybrid is now skipped (it cannot handle a GRUB image); the warning says the ISO boots from DVD only.

Tested without root: the exact xorriso argument list for isolinux/GRUB, hybrid on/off, with/without Mac files and .disk_label, and GRUB without boot_hybrid.img - all build, layouts as expected. The package builds with -Werror. A full ISO made with the new options (build-iso, isolinux, Mac files) boots in QEMU with BIOS (USB), UEFI and UEFI Secure Boot (USB), and 32-bit UEFI (DVD).

@AdrianTM AdrianTM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the four review fixes in 6334c6c. Both targets build, all 9 tests pass, and the generated ISO layouts match the requested hybrid and plain modes. Thanks for the fixes.

@AdrianTM
AdrianTM merged commit a23234e into MX-Linux:main Nov 24, 2026
3 checks passed
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.

2 participants