Netbooting the Live Server Installer via UEFI PXE on Arm (aarch64, arm64) and x86_64 (amd64)

This document provides the steps needed to install an system via netbooting and subiquity in UEFI mode with Ubuntu 20.04 (or later). The process is applicable to both of the architectures, arm64 and amd64. This process is inpired by this Ubuntu Discourse post for legacy mode, which is UEFI’s predecessor. Focal (20.04, 20.04.2) and Groovy (20.10) have been tested with the following method.

Configuring TFTP

This article assumes that you have setup your tftp (and/or DHCP/bootp if necessary, depending on your LAN configuration) by following this Ubuntu Discourse post, or you could also consider build your own tftp in this way if your DNS and DHCP is already well configured:

$ sudo apt install tftpd-hpa

If the installation is successful, check the corresponding TFTP service is active by this command:

$ systemctl status tftpd-hpa.service

It is expected to show active (running) from the output messages. We will also assume your tftp root path is /var/lib/tftpboot in the remaining of this article.

Serving Files

You can skip the whole section of the following manual setup instruction by using this non-official tool. The tool will setup your TFTP server to serve necessary files for netbooting.

Necessary Files

There are several files needed for this process. The following files are needed:

  • Ubuntu live server image
    • For arm64 architecture, its image name has a -arm64 suffix. For example, ubuntu-20.04.2-live-server-arm64.iso.
    • For amd64 architecture, its image name has a -amd64 suffix. For example, ubuntu-20.04.2-live-server-amd64.iso.
  • grub efi binary (and the corresponding grub.cfg, which is a txt file)
    • For arm64 architecture, it is grubnetaa64.efi.signed.
    • For amd64 architecture, it is grubnetx64.efi.signed.
  • initrd extracted from your target Ubuntu live server image (use hwe-initrd instread if you want to boot with HWE kernel)
  • vmlinuz extracted from your target Ubuntu live server image (use hwe-vmlinuz instead if you want to boot with HWE kernel)

Examples

In the following sections, we will take arm64 image as an example. This means the following files are used:

Please replace the corresponding files when you want to work on amd64 image. For example, your files may be:

Download and Serve Grub EFI Binary

The grub binary helps us redirect the downloading path to the target files via grub.cfg. You may refer to this discourse post to get more information about the PXE process and why we need this binary.

$ sudo wget http://ports.ubuntu.com/ubuntu-ports/dists/focal/main/uefi/grub2-arm64/current/grubnetaa64.efi.signed -O /var/lib/tftpboot/grubnetaa64.efi.signed

Please note you may need to change the archive dists name from focal to your target distribution name.

Download and Serve More Files

Fetch the installer by downloading a Ubuntu arm server iso, e.g. 20.04.2 live server arm64 iso. Please note the prefix live is significant. We will need the files available only in the live version.

Mount the iso and copy the target files we need to the TFTP folder

$ sudo mount ./ubuntu-20.04.2-live-server-arm64.iso /mnt
$ sudo mkdir /var/lib/tftpboot/grub /var/lib/tftpboot/casper
$ sudo cp /mnt/boot/grub/grub.cfg /var/lib/tftpboot/grub/
$ sudo cp /mnt/casper/initrd /var/lib/tftpboot/casper/
$ sudo cp /mnt/casper/vmlinuz /var/lib/tftpboot/casper/

So, the TFTP root folder should look like this now:

$ find /var/lib/tftpboot/
/var/lib/tftpboot/
/var/lib/tftpboot/grub
/var/lib/tftpboot/grub/grub.cfg
/var/lib/tftpboot/grubnetaa64.efi.signed
/var/lib/tftpboot/casper
/var/lib/tftpboot/casper/initrd
/var/lib/tftpboot/casper/vmlinuz

Finally, let’s customize the grub menu so we could install our target image by fetching it directly over the internet.

$ sudo chmod +w /var/lib/tftpboot/grub/grub.cfg
$ sudo vi /var/lib/tftpboot/grub/grub.cfg

Add an new entry

menuentry "Install Ubuntu Server (Focal 20.04.2) (Pull the iso from web)" {
        set gfxpayload=keep
        linux   /casper/vmlinuz url=http://cdimage.ubuntu.com/ubuntu/releases/20.04.2/release/ubuntu-20.04.2-live-server-arm64.iso only-ubiquity ip=dhcp ---
        initrd  /casper/initrd
}

ip=dhcp is for the dhcp management setup in the lab. url is used to point to your target image download url. Remember to change them according to your scenario.

If everything goes well, you should get into the expected grub menu of the ephemeral live prompt. Select the entry you just put in grub.cfg, which is Install Ubuntu Server (Focal 20.04.2) (Pull the iso from web) in our example. Waiting a bit for downloading the iso and then you will see the subiquity welcome message. Enjoy the installation!

Appendix

Always Make Sure of the Serving File Names

For example, please make sure the target file name for linux and initrd is correct. For example, the default initrd binary file name of 20.04.2 is initrd, and it is initrd.lz for 20.10. Always make sure you serve the right file names. This is a frequent troubleshooting issue. Pay attention on this detail could save a lot of your time.

Booting Screenshots

If your setup is correct, your grub.cfg should redirect the process to an ephemeral environment to download your target image assigned in the grub entry of grub.cfg. You will see a screen like this if you are able to access console or monitor device of your target machine:

Wait a bit to complete downloading. If you see this subiquity welcome page, the installer is successfully launched via your UEFI PXE setup. Configurations!!

Last updated 2 months ago. Help improve this document in the forum.