debian-cd: that xorriso command in full
In trying to reverse-engineer the crufty debian-cd-image-building process, my simple model so far has been: most of the content is simply a filesystem tree that can be prepared in one place, and then converted to a CD filesystem (iso9660). But the parts that make the CD bootable are special, in that they don't live within that filesystem tree, but are somehow attached specially to the CD image.
The effort is not helped by debian-cd's attempts to not tell you what commands it's running, while spewing megabytes of garbage on standard error. But for the command to go from filesystem tree and booty bits to a CD image, it kindly tucks it away in $TMP/bullseye/CD1/.disk/mkisofs or similar depending on release codename.
Having just built a Debian 11 53G iso which appears to be bootable, the command thus stashed is:
xorriso -as mkisofs -r -checksum_algorithm_iso sha256,sha512 -V 'Debian 12.0.0 amd64 1' -o /home/debian-iso/dcdgit.out/debian-12.0.0-amd64-CD-1.iso -md5-list /home/debian-iso/dcdgit.tmp/bullseye/checksum-check -jigdo-force-md5 /pool/ -jigdo-min-file-size 1024 -jigdo-exclude 'README*' -jigdo-exclude /doc/ -jigdo-exclude /md5sum.txt -jigdo-exclude /.disk/ -jigdo-exclude /pics/ -jigdo-exclude 'Release*' -jigdo-exclude 'Packages*' -jigdo-exclude 'Sources*' -jigdo-force-md5 /pool/ -jigdo-jigdo /home/debian-iso/dcdgit.out/debian-12.0.0-amd64-CD-1.jigdo -jigdo-template /home/debian-iso/dcdgit.out/debian-12.0.0-amd64-CD-1.template -jigdo-map Debian=/debian/debian-mirror/ -jigdo-exclude boot1 -J -joliet-long -cache-inodes -isohybrid-mbr syslinux/usr/lib/ISOLINUX/isohdpfx.bin -b isolinux/isolinux.bin -c isolinux/boot.cat -boot-load-size 4 -boot-info-table -no-emul-boot -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat -isohybrid-apm-hfsplus boot1 CD1
which looks huge, but removing jigdo noise (is this jigdo thing really built in to xorriso?), it's just:
xorriso -as mkisofs -r -checksum_algorithm_iso sha256,sha512 -V 'Debian 12.0.0 amd64 1' -o /home/debian-iso/dcdgit.out/debian-12.0.0-amd64-CD-1.iso -md5-list /home/debian-iso/dcdgit.tmp/bullseye/checksum-check -J -joliet-long -cache-inodes -isohybrid-mbr syslinux/usr/lib/ISOLINUX/isohdpfx.bin -b isolinux/isolinux.bin -c isolinux/boot.cat -boot-load-size 4 -boot-info-table -no-emul-boot -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat -isohybrid-apm-hfsplus boot1 CD1
The options which may relate to bootability are:
- -isohybrid-mbr
- -b
- -c
- -boot-load-size 4
- -boot-info-table
- -no-emul-boot
- -eltorito-alt-boot
- -e
- -no-emul-boot (again -- does the second one change anything?)
- -isohybrid-gpt-basdat
- -isohybrid-apm-hfsplus
so the next step is read about each of these in xorriso(1). It's good to see mention of isohybrid, which I think is what makes it bootable both as CD and as HDD.
Of the other options, some are clearly necessary. Some may be cruft that it's not necessary to cargo-cult into any fresh tools, or ancient wisdom that genuinely supports a wider range of platforms.
On another debian host where I tried to build a similar image, the resulting image was not bootable, and the stashed command there was:
xorriso -as mkisofs -r -checksum_algorithm_iso sha256,sha512 -V 'Debian 11.1.0 amd64 1' -o /tj/images-out/debian-11.1.0-amd64-CUSTOM-1.iso -checksum-list /tj/tmp/bullseye/checksum-check -jigdo-checksum-algorithm md5 -jigdo-force-checksum /pool/ -jigdo-min-file-size 1024 -jigdo-exclude 'README*' -jigdo-exclude /doc/ -jigdo-exclude /md5sum.txt -jigdo-exclude /.disk/ -jigdo-exclude /pics/ -jigdo-exclude 'Release*' -jigdo-exclude 'Packages*' -jigdo-exclude 'Sources*' -jigdo-force-md5 /pool/ -jigdo-jigdo /tj/images-out/debian-11.1.0-amd64-CUSTOM-1.jigdo -jigdo-template /tj/images-out/debian-11.1.0-amd64-CUSTOM-1.template -jigdo-map Debian=/tj/debmirror/ -jigdo-exclude boot1 -J -joliet-long CD1
or removing jigdo noise:
xorriso -as mkisofs -r -checksum_algorithm_iso sha256,sha512 -V 'Debian 11.1.0 amd64 1' -o /tj/images-out/debian-11.1.0-amd64-CUSTOM-1.iso -checksum-list /tj/tmp/bullseye/checksum-check -J -joliet-long CD1
which doesn't contain anything boot-related. This at least explains why that other image is not bootable. But the tooling is so lacking here. I didn't configure it to not be bootable, and if it can't make it bootable, I'd rather it stopped with a clear error message, rather than proceeding to make 55G of unusable image and pretend everything is okay, all the while spewing endless garbage on standard error.
There are several differences between the two setups, including:
- host is debian 10 (bootable) vs debian 11 (non-bootable), but this shouldn't make a difference
- full mirror ~1.1T (bootable) vs partial mirror made with debmirror ~83G (non-bootable)
so there would be more investigation to understand what's causing the difference.
Comments
Post a Comment