Boot CD Restoring with Cobbler

Cobbler is growing quickly and my changes have been accepted. They’re available in the official packages. This page is here for nostalgic purposes only.

Cobbler is a Linux provisioning system. It’s pretty snazzy in a PXE environment and with virtual machines, but with real machines in a non-PXE environment, it leaves some to be desired. Using the CGI script presented as well as the small edits to a standard isolinux environment, Cobbler can be used to restore real machines from bare metal given a network connection without PXE.

The CGI Script
Cobbler serves the kickstart (automated install instruction) files over http. My script simply returns the appropriate kickstart file. The kickstart can be specified manually, with parameters appended to the url–?profile=foo or ?system=baz–or with no parameters, the script will look the requesting IP address up through an XML-RPC call to Cobbler to find the appropriate system, and use that kickstart.

The Boot CD
The main idea behind the boot CD is simple–append ks=http://path/to/the/cgi/script.py to the isolinux.cfg file on the right boot CD. I use the Fedora rescue disks. They’re fairly small, under 100 megs, and have some useful things built in.

However, you can do some cool stuff beyond adding the kickstart url.

To make this CD, I only made a few changes to the Fedora 7 Rescue disk.

After downloading the image, mount it loopback on your system with mount -o loop disk.iso path/to/mount. Then create a directory to store the new rescue disk. Let’s call it rawdisk/. Copy the files from the cd to rawdisk/, and you’ll see there isn’t much inside a rescue disk. Inside the root is some GPL stuff. Inside images/ is a stage2.img. If you use a custom stage2.img with your cobbler setup, copy it from your cobbler install tree into that directory.

Inside isolinux is the isolinux boot stuff. The first changes we’ll make are inside isolinux/isolinux.cfg. The label sections at the bottom are different entries in the boot screen. We can add one at the beginning with the following content:


label cobbler
menu default
menu label Install a system with ^Cobbler
kernel vmlinuz
append initrd=initrd.img ks=http://cobbler.example.org/cgi-bin/installer.py

menu default makes this entry the default one. If you want this, remove the menu default from any other entry. The ^ in ^Cobbler makes the C be highlighted when the highlight bar is over the entry. It may also serve as a keyboard shortcut for that entry.The ks=http://cobbler.example.org/cgi-bin/installer.py pointsf Anaconda to download the kickstart file for the installation from that location–it should be changed to where the CGI script above is located on the web.

I also edited the menu title in isolinux.cfg, changing it to “Welcome to the Cobbler Restore CD!” There’s other information in the .msg files that you can edit if you desire.
If you don’t want to run the standard rescue disk kernel and initrd, you should use the kernel and initrd from your distro specification within Cobbler. These are located at /var/www/cobbler/images/distro_name/ They need to be copied into the isolinux/ directory, and pointed at in the label cobbler section instead of vmlinuz and initrd.img.

The last thing I edited was the splash image. If you open up splash.jpg in the isolinux directory, it’s the bluish Fedora balloon in the sky. I think if you’ve read this far, you’re pretty excited about Cobbler. To make the background I had in the screenshot, I just took the Cobbler logo from the Cobbler site, and threw it on a black 640×480 jpg with the Gimp.

These files need to be wrapped back up into an iso. I did it by changing directory to my rawdisk/ directory, and executing the following command:

mkisofs -o ../cobbler.iso -r -b isolinux/isolinux.bin
-c isolinux/boot.cat -no-emul-boot -boot-load-size 4
-boot-info-table -V Cobbler Install Disk -R -J -v -T .

Conclusion
If DHCP isn’t set up, Cobbler can provide that. Without DHCP, this whole process won’t work.

After these changes, Cobbler becomes a much stronger provisioning system for real machines when PXE isn’t available. I believe they’ll be accepted into Cobbler proper very soon, but either way the changes will remain here.

One final tip: If your hardware is old enough to not support USB booting, see if the BIOS has a boot menu. This lets you select the boot device for the next boot only. Without it, you’ll end up in an infinite reinstall loop–the install will succeed, and then reboot back into the reinstaller.

Feel free to contact me either through the email address in the script or through my contact form.

[tags]cobbler, pxe, boot cd, koan, isolinux [/tags]