| tags:linux pxe casper syslinux bootloader http ubuntu categories:Linux
Booting Ubuntu 20.04 live via http
PXE boot concepts are often complicated chains of many stages. Init ramdisks contaning casper 1.445 can load a ISO over http as rootfs.
Most Linux distros offer an ISO file which could either be burned on CD or copied to an USB stick. Although [grub2] can handle such ISO files directly, SYSLINUX can’t and it’s part PXELINUX still used in a lot of PXE environments.
The idea behind PXE is that a small program is stored on the network card which obtains an IP address and then loads a system over the network (eg. FTP) As second stage PXELINUX is often used as bootloader which then loads a linux kernel and an initramfs. Once they are booted there is a whole lot of possible further bootpaths. Ubuntu uses the casper scripts to handle the actual boot sequence. Since casper version 1.445 which is packaged in Ubuntu 20.04 (Focal Fossa) it is capable to mount the rootfs not only via SMB/CIFS and NFS but it’s also possible to specify a http link to a ISO file which is then loaded and mounted as root filesystem.
I saw a lot of PXE setups which load the kernel and mount the root filesystem via NFS and for those which load the kernel via HTTP I wanted to eliminate NFS as a second necessary protocol. I had to experiment a bit to get this working, cause the manpage of casper suggested false default. But here is the PXELINUX configuration which worked eventually:
/srv/tftp/pxelinux.cfg/default
LABEL rescue-live-system
MENU LABEL Rescue Live System
KERNEL http://fileserver.local/rescuei.iso-mounted/casper/vmlinuz
APPEND initrd=http://fileserver.local/rescue.iso-mounted/casper/initrd.lz boot=casper ip=dhcp netboot=url url=http://fileserver.local/rescue.iso console=tty0 console=ttyS1,115200
First lets go through the casper options:
boot=casper
tells that casper should be used inside the initrd (under/scripts/casper
)ip=dhcp
although the manpage of casper says DHCP is default, this option is mandatorynetboot=url
instead of smb or nfs we want to netboot from a HTTP urlurl=http://fileserver.local/rescue.iso
well the path to the ISO which is booted.
If you want to server the files from a local fileserver you need to extract the kernel and the initrd file from the iso and serve them seperatly. To do that just mount the ISO and copy the files:
mount -o loop ubuntu-20.10-desktop-amd64.iso /mnt
cp -av /mnt/casper/{initrd,vmlinux} /var/www/path/to/fileserver/
umount -l /mnt
If you have internet access you can also boot an ubuntu image directly from ubuntu.com.
But be careful since there is no HTTPS support!
Useful links
- Howto from Ubuntu.com https://discourse.ubuntu.com/t/netbooting-the-live-server-installer/14510