Live CDs are great. In particular, they’re a great way to try out software, knowing that the chances of damaging the host system are minimal and you can throw away the entire system if you want to.

Sometimes you want to use a live CD environment without a CD. CDs are slow, get lost and scratched, and require a CD drive. If you’re going to use live environments a lot, you’d probably prefer to boot them over the network from a machine with a hard disk and a cache.

Luckily, Ubuntu’s live CD includes all the necessary support to do this easily, if you know how to use it. Unfortunately, it’s not really documented as far as I can tell. Please correct me if I’m wrong about this.

I managed to make the live CD boot over the network on a PXE client using the following steps.

  • set your DHCP server up to hand off to a TFTP server. For example, add the following lines to your subnet definition in /etc/dhcp3/dhcpd.conf:
  • next-server 10.0.156.34;
    filename "pxelinux.0";
    
  • get a copy of pxelinux.0 from the pxelinux package and put it in the tftproot of your TFTP server.
  • copy the casper directory off the CD and put it into your tftproot as well.
  • get an NFS server on your network to loopback-mount the Desktop ISO (e.g. ubuntu-8.04.2-desktop-i386.iso) and export the mount directory through NFS. Let’s say your NFS server is 1.2.3.4 and the ISO is mounted at /var/nfs/ubuntu/live. Edit /etc/exports on the server and export the mount directory to the world by adding the following line:
  • /var/nfs/ubuntu/live *(ro,all_squash,no_subtree_check)
    
  • put the following section into your tftproot/pxelinux.cfg/default file:
  • DEFAULT live-804
    LABEL live-804
      kernel casper/vmlinuz
      append file=/cdrom/preseed/ubuntu.seed boot=casper initrd=ubuntu/ubuntu-8-04/casper/initrd.gz netboot=nfs nfsroot=1.2.3.4:/var/nfs/ubuntu/live quiet splash --
    
  • test that the PXE client boots into the live CD environment
  • if it doesn’t, remove the “quiet splash” from the end of the “append” line and boot it again, to see where it gets stuck.

I hope this helps someone, and that NFS-booting a live environment will be properly documented (better than this!) one day.

(Also filed on Ubuntu bug 296089.)