Dear all
Just putting my notes in public in case of some use.
How to boot the Live CD over PXE
Exact details are given for booting 10.04.3 Desktop, from 10.04.3 Server.
I have tested these instructions and booted these images:
Code:
f63028da38308d917cd1460e14fb8540 ubuntu-10.04.3-desktop-i386.iso
557231ce93ae8e98e214424cb02f8761 ubuntu-10.04.4-desktop-i386.iso
d791352694374f1c478779f7f4447a3f ubuntu-12.04-desktop-i386.iso
5eccab9d5956956c3dc28d5a6c4a2e69 edubuntu-10.04-dvd-i386.iso
In the following instructions, substitute for the green part if you're not using ubuntu-10.04.3-desktop-i386.iso
I've tried this with quite a number of pieces of hardware, including
- HP DL320 G2 server 2 Gbyte RAM
- Lenovo Thinkpad X121e (won't boot 10.04, requires different ethernet driver)
- Many Intel motherboards
Note that I don't unpack the CD-ROM image, I use it as is, (but there's no reason you can't unpack it into the exports directory). I keep them like that so I have a simple directory of all the Live-CD for testing, and the network boot menu offers you the list of versions.
This setup is in live production use on a couple of sites. There is a known bug (at least with this 10.04.3 Desktop) which is that you can't boot several clients simultaneously as there is a bug in the DHCP client.
SERVER PREPARATION
You can use any server. or combination of servers, which provides
DHCP -- you need to specify some extra flags
TFTP -- to deliver the initial kernel and filesystem file
NFS -- to deliver the subsequent files
The following describes how to set that up for 10.03 server.
Packages
The server needs a few pieces of software:
Code:
sudo apt-get install -y dhcp3-server
sudo apt-get install -y tftpd-hpa
sudo apt-get install -y nfs-kernel-server
If you want to use the exact packages that are known to work,, Use ubuntu-10.04.3-server-i386.iso, mount it on /cdrom, and do
DHCPD
Code:
sudo dpkg -i /cdrom/pool/main/d/dhcp3/dhcp3-server_3.1.3-2ubuntu3_i386.deb
TFTPD
Code:
sudo dpkg -i /cdrom/pool/main/t/tftp-hpa/tftpd-hpa_5.0-11ubuntu2.1_i386.deb
NFS
Code:
sudo dpkg -i /cdrom/pool/main/p/portmap/portmap_6.0.0-1ubuntu2.1_i386.deb
sudo dpkg -i /cdrom/pool/main/libe/libevent/libevent-1.4-2_1.4.13-stable-1_i386.deb
sudo dpkg -i /cdrom/pool/main/libg/libgssglue/libgssglue1_0.1-4_i386.deb
sudo dpkg -i /cdrom/pool/main/libn/libnfsidmap/libnfsidmap2_0.23-2_i386.deb
sudo dpkg -i /cdrom/pool/main/libr/librpcsecgss/librpcsecgss3_0.19-2_i386.deb
sudo dpkg -i /cdrom/pool/main/n/nfs-utils/nfs-common_1.2.0-4ubuntu4.1_i386.deb
sudo dpkg -i /cdrom/pool/main/n/nfs-utils/nfs-kernel-server_1.2.0-4ubuntu4.1_i386.deb
DHCP settings, using ISC DHCPD 3
Each of my clients is given a static address: you'll probably have dynamic allocation. The critical part is server-name, and filename. Configuration is done (for this DHCP software) in /etc/dhcp3/dhcpd.conf, and you'll need to edit the red parts to suit your own network.
Code:
host client1 {
hardware ethernet 11:22:33:44:55:66;
fixed-address 192.168.1.66;
option routers 192.168.1.16;
server-name "192.168.1.32";
filename "pxelinux.0";
}
TFTPD
Using tftpd-hpa, didn't need any configuration of itself.
PXE Files
We need pxelinux.0 and vesamenu.c32, which are stored on the TFTP server and run on the client.
Code:
mkdir /tmp/scratch
cd /tmp/scratch
wget http://archive.ubuntu.com/ubuntu/dists/lucid/main/installer-i386/current/images/netboot/netboot.tar.gz
tar xvfz netboot.tar.gz
sudo cp ubuntu-installer/i386/pxelinux.0 ubuntu-installer/i386/boot-screens/vesamenu.c32 /var/lib/tftpboot
sudo mkdir /var/lib/tftpboot/pxelinux.cfg
md5sum /var/lib/tftpboot/pxelinux.0 /var/lib/tftpboot/vesamenu.c32
86d7c19925f7cb5d9f1f54c0dec7812a /var/lib/tftpboot/pxelinux.0
9c05a151103a42f0855f195408509a2e /var/lib/tftpboot/vesamenu.c32
We need a default file /var/lib/tftpboot/pxelinux.cfg/default: you'll need to edit the red part for your own network:
Code:
DEFAULT vesamenu.c32
MENU TITLE Network boot
LABEL ubuntu-10.04.3-desktop-i386
MENU LABEL ubuntu-10.04.3-desktop-i386
KERNEL ubuntu-10.04.3-desktop-i386/vmlinuz
APPEND initrd=ubuntu-10.04.3-desktop-i386/initrd.lz root=/dev/nfs boot=casper netboot=nfs nfsroot=192.168.1.32:/exports/ubuntu-10.04.3-desktop-i386 splash --
CDROM image
I keep the CD-ROM images in /cdroms and mount them as loopback devices.
The IP address needs to be the IP address of your NFS server.
There are two cricital parts:
1. Making available the CD-ROM tree
2. Picking up a couple of the files and putting them in the TFTP directory
Code:
sudo mkdir /cdroms
cd /cdroms
sudo wget http://old-releases.ubuntu.com/releases/10.04.3/ubuntu-10.04.3-desktop-i386.iso
md5sum /cdroms/ubuntu-10.04.3-desktop-i386.iso
f63028da38308d917cd1460e14fb8540 /cdroms/ubuntu-10.04.3-desktop-i386.iso
That CD-ROM is exported here:
Code:
sudo mkdir /exports/ubuntu-10.04.3-desktop-i386
Add the following to /etc/fstab to auto-mount on reboot
Code:
/cdroms/ubuntu-10.04.3-desktop-i386.iso /exports/ubuntu-10.04.3-desktop-i386 iso9660 ro,loop,auto 0 0
Mount it
Following for /etc/exports to allow clients to read this directory
Code:
/exports/ubuntu-10.04.3-desktop-i386 192.168.1.1/24(ro,no_root_squash,no_subtree_check,async)
Rexport
if you've copied the contents of the CD-ROM to /exports/ubuntu-10.04.3-desktop-i386 you won't need the mount; you'll still need the line in /etc/exports
Make PXEBOOT area for this and put the files in it
Code:
sudo mkdir /var/lib/tftpboot/ubuntu-10.04.3-desktop-i386
sudo cp /exports/ubuntu-10.04.3-desktop-i386/casper/vmlinuz /var/lib/tftpboot/ubuntu-10.04.3-desktop-i386
sudo cp /exports/ubuntu-10.04.3-desktop-i386/casper/initrd.lz /var/lib/tftpboot/ubuntu-10.04.3-desktop-i386
At this point you should be able to boot successfully.
CLIENT
You have to ensure that your client can boot PXE. Sometimes you have to put this in the boot order of your computer in your BIOS, sometimes you have to press a key, often F12.
Typically the boot sequence looks like this:
1. DHCP messages from the PXE boot firmware
2. Tries to TFTP fetch various files, eventually using "default" (usually too fast to see)
3. Menu of your single Ubuntu image
4. Select it
5. Loads kernel then the init file (with dots, 5 secs)
6. Splash screen (lasts perhaps 50 sec)
7. Ubuntu desktop
If the splash screen stays a long time (or you're impatient) press escape to see the text screen with messages, and escape to get back to the graphical screen.
OPTIONAL: If you have to change the initial file system (initrd.lz)
First we unpack the .lz:
Code:
sudo mount -o loop /exports/ubuntu-10.04.3-desktop-i386/casper/filesystem.squashfs /mnt
sudo mkdir /tmp/newroot
cd /tmp/newroot
lzcat -S .lz /exports/ubuntu-10.04.3-desktop-i386/casper/initrd.lz | sudo cpio -i
OPTIONAL STEP: In my case I needed to add some ether drivers (for Dell Poweredge R210-II), which you will probably skip:
Code:
sudo cp -R /mnt/lib/firmware/2.6.32-33-generic/bnx2 lib/firmware/2.6.32-33-generic
sudo cp /mnt/lib/modules/2.6.32-33-generic/kernel/drivers/net/bnx2.ko lib/modules/2.6.32-33-generic/kernel/drivers/net
sudo depmod -b `pwd` 2.6.32-33-generic
Build the new initial file system:
Code:
sudo sh -c "find . | cpio --dereference -o -H newc | lzma -9 > /var/lib/tftpboot/ubuntu-10.04.3-desktop-i386/initrd.lz"
OPTIONAL: Edits to the Boot Filesystem
The boot filesystem is a squashfs filesystem as a big file on the CD-ROM. if you need to change anything on this you have to unpack, edit, repack. I needed to change rc.local of the booted system.
You must have squashfs tools and also mkisofs
Code:
sudo apt-get install squashfs-tools
Assuming (as above) the tree is mounted already, copy it to a temporary directory
Code:
mkdir /tmp/newimage
cd /exports/ubuntu-10.04.3-desktop-i386
# following careful copy from current directory includes .disk and any hidden 'dot' files
sudo cp -Rp . /tmp/newimage
Unpack the squashfs system
Code:
cd /tmp/newimage/casper
sudo unsquashfs filesystem.squashfs
Add the extra files
Code:
cd squashfs.root
cd etc
# whatever edits you need
vi rc.local
Repack the squashfs
Code:
cd /tmp/newimage/casper
sudo rm filesystem.squashfs
sudo mksquashfs squashfs-root filesystem.squashfs
sudo chmod 444 filesystem.squashfs
Then repack the CD-ROM image. (Or leave it as a normal directory tree under /exports).
Code:
sudo mkisofs -D -r -V "FIXED" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../ubuntu-10.04.3-desktop-i386-fixed.iso .
(adjust filenames in mounts and exports if necessary)
I hope that helps someone.
Kind regards,
Jonathan
Bookmarks