The Debian Installer has a USB boot image that is supposed to be written raw to the USB stick. Problem is that means the image has a fixed size, 256 MB, and all the other gigabytes on your typical USB stick are unusable after writing this image to it. It's a bit of a cheat for me to blog about this, since I'm slighly responsible for the thing that I'm working around. But still.
The real problem is not the fixed size of the image, but that it is written to the USB stick as a "super floppy", without any partition table. If there were a partition table, you could make a second partition in the rest of the space of the USB stick, and use it to store files, etc. So, let's set that up. It's not really hard:
- Use your favorite partition tool to partition the USB stick. Make a 256 MB DOS partition, that will be used to hold the installer, and set it bootable. Make a second, or more partitions for your own use.
- Unplug and replug the USB stick so the device files show up, and
write the installer image to the first partition (/dev/sda1 in this
example).
zcat boot.img >/dev/sda1
- Make the USB stick bootable by installing the
mbr
package, and runninginstall-mbr /dev/sda
- Copy a Debian ISO image to the USB stick somewhere. You can put it on the first partition, as ususal, or if you prefer, can put it on one of the later, larger partitions. That's useful if you want to use a larger ISO than the netinst. The installer should find it anywhere.
The short answer is that d-i's image build process does not run as root. It's easy to do this as root; creating a partition in a loopback file as non-root and copying files into it, is not as easy. There are no tools I know of that can do it, actually. Though it's obviously doable.
Other problem is that, after writing that image to the whole USB key, you'd need to unplug and replug the key in order for the partition devices to show up, in order to mount it and copy in the ISO that d-i uses.
Now, one possibility would be for debian-cd to take the image from d-i, and automate copying in the netinst iso it builds, and grafting in a partition table. Although as noted such a partition table would still need to be tweaked to take advantage of the full device.
Which brings us back around to a script to set up the key, running on the user's machine. Which has some merit although the commands I show are pretty easy anyhow.
I suppose it's also worth noting that I want to put a Debian live .img file on the same key, using MBR to choose which partition to boot. However, Debian Live comes as a full disk image with partition table, so I can't just cat it to /dev/sda2. I need to manually pull the partition out of it, and figure out how to put syslinux on that partition (instead of the image's mbr) so it's bootable.
So ironically the more sophisticated image provided by Debian Live is harder to set up in this case than the simplistic one provided by d-i.