If you want to install a virtual machine from a CD, but you need to pass extra parameters to the Linux kernel, how can you do it?
Virt-install has an option to pass extra parameters to the kernel, but it doesn’t work with CD images because Linux CDs contain their own boot configuration system called ISOLINUX. Of course you can manually type in the extra parameters at the boot prompt, but that cannot be automated.
I was asked today can we use libguestfs to edit the ISOLINUX configuration inside the ISO directly? My first answer was yes, just do:
guestfish -a boot.iso -m /dev/sda edit /isolinux/isolinux.cfg
Unfortunately this doesn’t work for CD ISOs formatted using the standard ISO9660 filesystem. The kernel driver that guestfish uses is read-only, and you’ll get an error when the edit command tries to save the file. (As an aside, it should just work on UDF-formatted ISOs such as DVD images, but I didn’t try it).
Still, all is not lost and we can use guestfish to make the edit and still not require root. We just have to unpack the ISO, make the edit, and pack it up again, like this:
mkdir /tmp/iso cd /tmp/iso guestfish -a ../boot.iso -m /dev/sda tar-out / - | tar xvf - vi isolinux/isolinux.cfg mkisofs [flags - see comments] -o ../newboot.iso .