I recently spent a little time adding support for isohybrid images to d-i. isohybrid is a tricksy boot sector hack that allows copying a CD image direct to a USB stick and booting it.

I used it in anger for the first time yesterday, and it worked so well compared with the old method of booting d-i from USB sticks that I feel I need to blog about it so others can enjoy the fun..

The documentation on the web site has not caught up yet, but this is already usable with current d-i daily builds. For now only in the netboot mini.iso. That can be written directly to a USB stick or USB disk to make it boot d-i.

cat mini.iso > /dev/sdX

The netboot mini.iso is so named because it's functionally identical to netbooting d-i. Except without the need to set up a tftp server. Besides being a 16mb download that will fit on even your oldest USB stick, another advantage to using the mini.iso is that you don't even need to use a separate USB stick to boot the installer. You can write the mini.iso directly to the same disk that d-i will be installing to! (Particularly handy for installing debian to USB disks.)

(This is also very handy for d-i development and testing, since a mini.iso can be written out to a USB key about as fast as a test machine will post..)

adding firmware

I also arranged for there to be a second partition on the mini.iso. The firmware partition is most easily accessed by unplugging and replugging the drive after writing the mini.iso to it -- then it will show up as /dev/sdX2 (or "Firmware" in a GUI). If you need to add firmware to d-i, you can just mount it and extract the firmware tarball into it. d-i will then automatically find, use, and install the firmware.

isohybrid with other Debian CD images

All this will also work with other larger Debian CD images, but we're not yet building the larger images with isohybrid, due to issues with jidgo. However, you can just run isohybrid yourself (from the syslinux package) on the CD image you download, and if it's got a recent version of d-i on it, d-i will be able to find and use the hybrid CD image after booting.

That doesn't add the firmware partition to the image. If you need to do that, you could use this script.

Writable?
isohybrid modifies an existing .iso image to make it work like a USB disk image, but the resulting image once booted doesn't allow mounting read/write, does it?
Comment by Josh
comment 2
isohybrid adds a partition table to the iso (while also keeping it a valid iso). So additional, writable partitions can be appended.
Comment by joey
comment 4
Not currently. Making the installer look for a preseed file in the firmware partition would not be very hard. Any of the usual methods for supplying preseed files while netbooting of course work. (For example, passing an url at the boot prompt.)
Comment by joey
comment 5

The script referenced in the last line of the post is no longer where it used to be, due to d-i's svn->git migration. Having chased down the new link, I thought I'd comment it here:

http://git.debian.org/?p=d-i/debian-installer.git;a=blob;f=build/util/geniso_hybrid_plus_firmware_partition

Comment by Max
GRUB dislikes hybridised USB sticks .

The combination of cat-ing mini.iso to a USB stick, booting it and then installing Debian to the same device is briliiant. Except GRUB refuses to co-operate, complaining it has detected an iso 9660 filesystem and refusing to have anything to do with it.

dd if=/dev/zero of=/dev/sdX bs=512 count=2000

prior to partitoning was my way of getting on GRUB's good side.

I don't know whether d-i should or could handle this but some documentation wouldn't go amiss. Now, would it be debian-boot or debian-doc I should raise this in?

Comment by Brian