Setting up PXE boot of Ubuntu 12.04 Live CD

Introduction

Sometimes it's nice to boot a complete operating system over a network, and not have to install to a drive or use a CD. This allows you to have diskless machines, or perform operations on an installed drive that can't be done whilst it is mounted.

This tutorial assumes you have already set up a cobbler pxe/dhcp server (see previous posts) and teaches you the final steps for adding a live ubuntu12 image. You will also need to have set up an nfs server.

Steps

    Mount the ubuntu desktop image
    sudo mount -o loop /my/iso/location.iso /mnt
    
    Copy the contents (making sure to include the .disk directory) to your NFS location (this may be on another computer/server, so you may need to perform the previous step on that machine).
    sudo cp -R /mnt/* /my/nfs/location/.
    sudo cp -R /mnt/.disk/ /my/nfs/location/.
    
    Add the distro to cobbler
    sudo cobbler distro add \
    --name=ubuntu-desktop-32 \
    --kernel=/mnt/casper/vmlinuz \
    --initrd=/mnt/casper/initrd.lz
    
    If it is a initrd.gz file, you may have to run this on it first:
    gunzip --decompress initrd.gz
    Add a profile to cobbler
    sudo cobbler profile add \
    --name=ubuntu-desktop-32 \
    --distro=ubuntu-desktop-32 
    
    Sync cobbler
    sudo cobbler sync
    
    Edit the pxelinux boot menu to add a few details (link the nfs)
    sudo editor /var/lib/tftpboot/pxelinux.cfg/default
    
    Add the following details to the ubuntu deskto part of the menu, and remove any unnecessary parts.
    boot=casper netboot=nfs nfsroot=192.168.1.6:/my/nfs/location
    Start up your pxe client, and it should all hopefully go to plan. If it gets stuck on a message like:
    Please provide a name for this Disc, such as
    Then you didn't copy the hidden .disk directory from the cd correctly in the first step.

Possible Problems

Don't forget to have set up your dhcpd server correctly. I have mine set to be mac specific, so you may need to add another host like I did

References

2 comments:

  1. Hi thanks for good valuable post.

    one small typo

    in point 5 .

    it's should be.

    sudo cobbler profile add \
    --name=ubuntu-desktop-32 \
    --distro=ubuntu-desktop-32

    ReplyDelete
    Replies
    1. Thank you so much for pointing this out! I took the liberty of tidying up the post whilst I'm at it.

      Delete