How to network boot (pxe) the ubuntu livecd

How to network boot (pxe) the ubuntu livecd

With Ubuntu’s latest release out the door, we thought we’d celebrate by showing you how to make it centrally available on your network by using network boot (PXE).

Overview

We already showed you how to setup a PXE server in the “What Is Network Booting (PXE) and How Can You Use It?” guide, in this guide we will show you how to add the Ubuntu LiveCD to the boot options.

If you are not already using Ubuntu as your number one “go to” for troubleshooting, diagnostics and rescue procedures tool… it will probably replace all of the tools you are currently using. Also, once the machine has booted into the Ubuntu live session, it is possible to perform the OS setup like you normally would. The immediate up shut of using Ubuntu over the network, is that if your already using the CD version, you will never again be looking for the CDs you forgot in the CD drives.

Prerequisites

  • It is assumed that you have already setup the FOG server as explained in our “What Is Network Booting (PXE) and How Can You Use It?” guide.
  • All the prerequisites for the FOG setup guide apply here as well.
  • This procedure has been used to make Ubuntu 9.10 (Karmic Koala) up to and including 11.04 (Natty Narwhal) network bootable. It may work for other Ubuntu like distributions (like Linux Mint) but hasn’t been tested.
  • You will see me use VIM as the editor program, this is just because I’m used to it… you may use any other editor that you’d like.

How does it work?
In general the Ubuntu LiveCD boot process that we all know is like so:

  • You put a CD into the cdrom drive the BIOS knows how to use the cdrom enough to get the boot program on the cdrom (isolinux).
  • Isolinux is responsible for the menu options. Once you select a boot entry like “Start or install Ubuntu”, it calls the kernal + initrd (initial ram disk) files, copies them into memory and passes parameters to them.
  • The now in RAM and in control kernel + initrd start the boot process, while using the parameters that where passed to them to determine things like: should the splash screen be shown? should the output be verbose?.
  • When the inirtrd scripts have finished loading drivers and device information, they look for the Ubuntu liveCD files to continue the boot process. The normal behavior is to look in the local physical cdrom drive.

For network boot:

  • Instead of a local media such as a CD, the client is booted using it’s network card (PXE) and is supplied with PXElinux over TFTP.
  • Just like Isolinux, PXElinux is responsible for the menu options. Once you select a boot entry, it calls the Ubuntu kernal + initrd files, copies them into memory and passes parameters to them.
  • The now in RAM and in control kernel + initrd start the boot process, with our additional information that they should not be looking for the boot files in the client’s local physical cdrom drive, but rather in an NFS share on our FOG server.

This is possible because the Ubuntu creators have enabled networking by integrating, network cards drivers and protocols into the kernel + initrd files. For such an act, we can only say thank you to the Ubuntu team.

Make the Ubuntu files available on the server

The first step is to make the Ubuntu files available on the server. You may opt to simply copy them from the CD drive, or extract them from the ISO, and that will work just fine. With that said, we will make the ISO auto-mounted. While not a must, doing this will enable you to use our “How to Upgrade your Ubuntu ISO Without Re-downloading” guide, to upgrade the Ubuntu version of your network boot without going through all the procedures from scratch or alternatively, replace a single file to update the entire entry.

With the above said, This author likes keeping a couple of past versions around, until the new one has been proven absolutely stable and issues free. That is why we will make a sub-directory and mount point according to version, but know that you could bypass that to have your single point of update.

  1. Copy the ISO into the “/tftpboot/howtogeek/linux” directory
  2. Create the mount point:

sudo mkdir -p /tftpboot/howtogeek/linux/ubuntu/

/tftpboot/howtogeek/linux/ubuntu-11.04-desktop-amd64.iso /tftpboot/howtogeek/linux/ubuntu/11.04 udf,iso9660 user,loop 0 0

Note: Despite representation, this is one unbroken line.
Test that the mount point works by issuing:

ls -lash /tftpboot/howtogeek/linux/ubuntu/11.04/

Create an NFS share

While the boot procedure starts by using PXE, the actual heavy lifting is done by the NFS share on the server. As we are basing this guide on our FOG server, the NFS components and some configurations have already been done for us by the FOG team, and all we have to do is add to them our Ubuntu share.

    Edit the “exports” file to add the new share:

sudo /etc/init.d/nfs-kernel-server restart

PXE menu setup

Edit the “Linux stuff” menu:

sudo vim /tftpboot/howtogeek/menus/linux.cfg

Append to it the following:

LABEL Ubuntu Livecd 11.04
MENU DEFAULT
KERNEL howtogeek/linux/ubuntu/11.04/casper/vmlinuz
APPEND root=/dev/nfs boot=casper netboot=nfs nfsroot= :/tftpboot/howtogeek/linux/ubuntu/11.04 initrd=howtogeek/linux/ubuntu/11.04/casper/initrd.lz quiet splash —

The above may look messy at first glance but all you have to do is replace * with the IP of your server NFS/PXE server.

For a clearer geek understanding, the text above will:

  • Create a new PXE entry in the“Linux” sub-menu called “Ubuntu 11.04”.
  • Because of the “MENU DEFAULT” parameter, this entry will be automatically selected when entering the “Linux” sub-menu.
  • Point the client to take the kernel + initrd files usinf TFTP from the relative path in the “/tftproot” directory of “howtogeek/linux/ubuntu…”
  • Point the initrd scripts to mount the “root” filesystem from the NFS share on the absolute path of “ :/tftpboot/howtogeek…”

Note: I have tried (and failed) to use a DNS name instead of an IP for the “ ”, I’m guessing that at that stage of the boot process there simply still isn’t support for DNS… success stories are welcomed.

Possible procedures

You should now be able to boot a client into Ubuntu from PXE (Usually F12).

At this stage we suggest you take the time to review some of the things you can do with this outstanding tool:

One last thing, If you create your Ubuntu ISO, using this online builder, you will be able to slipstream all of the articles above into your PXE bootable Ubuntu.

Has anyone attempt to run Ubuntu via a PXE boot instead of a LiveCD?

I was going to do a 8 server install using USB drives for the OS, disable SWAP, and using SSH for most everything, but man it’s slow! (and I mean sloooooow), once I start the processes I need the machine to run, they preform as expected, but attempting to use Gnome/ another gui with apps is terrible. SSH is slow (though I expected package installs to be slow, obviously).

How about PXE? I have only used PXE for ESXi. – so i’m not sure how an O/S with packages installed would preform. Any input? Else I may just break down and buy some cheap 30/32GB SSDs by kingston or ADATA – along with the hard drive sleds. Kind of a bummer at $10 per usb drive vs $60

for a SSD that isn’t quite necessary.

  • Are you smarter than most IT pros?
  • Help Desk Server JFrog Signature Verification
  • Ubuntu-vg consumes 100%, no files showing
  • Mount multiple locations as a single access point?

The help desk software for IT. Free.

Track users’ IT needs, easily, and with only the features you need.

25 Replies

How about Clonezilla with the image on a server?

CloneZilla is used for deploying an image to hardware from a livecd. I wan’t to boot from PXE to a liveCD, never installing the OS onto the physical server. If I create a new image and save older the old one on a TFTP server for PXE, I can reboot the machine and it will load the new Ubuntu image. I don’t think CloneZilla is quite what I am looking for.

I guess I’m missing something here (sorry been a long day already).

Do you want to image these systems with ubuntu or do you want to run diskless.

My apologies, I misunderstood.

If you are doing that why not clone the live CD putting one in each server and change the BIOS on the servers to use the CD/DVD drive as the first boot option.

Look at http://www.ltsp.org/. There is ways of making it work but your servers need some power!

If you want to use USB sticks just have the local machine’s boot from USB. Each machine should have at least 2gigs ram and you will need 1 or 2 gig USB drives. To speed it up you can set the GRUB loader to shove the OS all into the local RAM and it is VERY fast in there. I have done this a couple of times and it is a bit slow to load but smoking fast once it does.

You can PXE boot using Fog to a live Ubuntu Desktop, Mint, etc.

I use this sometimes to test hardware

I don’t want to deal with the sluggishness of a LiveCD, I believe they are about the same as installing on a USB, I think?

That looks like an all in one packages solution – I will definitely check that out. That may be easier to implement than setting up everything individually. Thank you!

Every box has 2 – 4 CPUs and 16 or 34gb of RAM (though I am likely going to pull the DIMMs and run single channel per CPU), All I need is the CPU power from these boxes. So using GRUB shouldn’t be an issue. I will check out using the loader as you mentioned. I have of course used grub before on a number of pre-packaged utilities, but I have never configured a loader myself. This may be the ‘simplest’ option as right now I have USB sticks, an image, and can easily clone a handful. However, I am likely going to use some blade servers (16 nodes) that do not have local storage, or USB ports, they can boot from a SAN or DAS system if I add a controller, or PXE – which is why I wanted to look into PXE. Maybe ltsp can do this – I will see if it leverages PXE or if it uses some sort of liveCD/ USB to launch a loader which is probably more likely.

I’ll ask the question again:

Do you want to image these systems with ubuntu (clone one image to many) or do you want to run diskless.

I’ll ask the question again:

Do you want to image these systems with ubuntu (clone one image to many) or do you want to run diskless.

That is still a question. I have the setups to freeze the system using a DeepFreeze type script, I have the instructions to also build them as kiosk machines as well if your just using one program.

Here is a section from a manual I made for setting up a kiosk system to boot diskless and run all from the RAM:

Creating a portable USB and installing the Kiosk system

For this I will be using unetbootin. There are many other .iso to USB installers out, most should work easily.
Format the USB drive to FAT32 to clean it off
Start unetbootin and select the .iso produced earlier Install to USB drive

At this point the USB can be used to boot a machine and run. There will be the unetbootin menu when first started and the system is running from the USB. There are a few more changes needed to clean up the boot process to eliminate the menu and have the system run entirely from RAM so the USB drive can be removed. This may be helpful in that once a machine is started with and the USB drive can be removed and used to start another machine with no ill effects to the first one. If the drive is removed without the changes unpredictable errors may occur.

– Insert the USB drive into your primary system and let it fully mount.
– Open the drive and look for the syslinux.cfg file
– Right-click and copy the file to the same location as a backup
– Open the file for editing
– In the first section you can change the “menu title” if you wish, this is optional
– Change the timeout from 100 to 1
– In the second section you can change the “label” and “menu label” but this is optional
– To the “append” line add toram between splash and — so it looks like “splash toram –”
– Delete all other sections
– Save and close the file

The system can now be used to boot a machine. With these modifications the boot time is a little longer because it is copying the full system to the RAM in the machine and will run independently from there making it safe to remove the USB drive once booted.

I have removed all references to the program I used