How to install Ubuntu Linux onto PC Engines apu4d4 using PXE


I have recently installed Ubuntu 20.04 with the same steps.

In this post, I will particularly show how to install Ubuntu 18.04 on PC Engines apu4d4 onto its mSATA SSD module (msata16g) using network/PXE boot and serial console. I guess all or part of this post can be applied in many different cases. There are six small steps:

  • Setup DHCP for PXE
  • Setup TFTP for PXE
  • Modify PXE boot config for serial console
  • Enable Network/PXE boot and boot with PXE
  • Install Ubuntu
  • Modify GRUB config for serial console

I assume:

  • You have access to a DHCP server where you can set DHCP options. I was using Ubiquiti EdgeRouter 4 when I wrote this post. Now I am using pfSense.
  • You have access to a TFTP server. I was using tftpd-hpa on Ubuntu when I wrote this post. Now I am using pfSense.
  • You have access to the serial console of the computer, which means it is connected to a computer with a serial cable (possibly thru a USB serial adapter). I am using PC Engines usbcom1a adapter with apu4d4.
  • The computer to install Ubuntu is connected to the same wired ethernet network as your DHCP and TFTP.


I am using macOS and normally I use screen to connect to the serial port. However, after PXE, during Ubuntu installation, I see strange characters with screen but minicom works fine. I do not know the reason yet -they are using the same settings-, but if you experience such a thing, try a different program.

If you are using the same board, it will be extremely helpful to connect a reset switch.

Setting up DHCP for PXE

You need to set PXE server and PXE boot file options. On EdgeRouter 4, it is done like this:

service {
    dhcp-server {
        shared-network-name XXX {
            subnet YYY {
                bootfile-name pxelinux.0
                bootfile-server tftp_server_IP

On pfSense, on DHCP Server options:

  • enable Network Booting
  • type tftp_server_IP to Next Server
  • type pxelinux.0 to Default BIOS file name

Setting up TFTP for PXE

Download relevant netboot files. I am using Ubuntu 18.04 amd64 netboot.tar.gz.

Extract netboot.tar.gz into the folder served by the TFTP server.

Modifying PXE boot config for serial console

By default, the configuration that comes with Ubuntu assumes you have a display. So in order to use the serial console, create another menu item:

  • Go to ubuntu-installer/amd64/boot-screens

  • Add the following to the very end of txt.cfg:

label ser
	menu label ^Serial-console install
	kernel ubuntu-installer/amd64/linux
	append initrd=ubuntu-installer/amd64/initrd.gz console=ttyS0,115200n8

This creates another menu option called Serial-console install passing the console parameter to the kernel instead of vga. ttyS0 is the serial console.

Enable Network/PXE boot and boot with PXE

Booting from network or with PXE might be disabled by default as is the case for apu4d4. This is what to be done for apu4d4:

When you reboot apu4d4, you will see these briefly:

PC Engines apu4
coreboot build 20193012
BIOS version v4.11.0.2

then when you see the prompt below, press F10 to see the boot menu:

SeaBIOS (version rel-

Press F10 key now for boot menu

and press 3 to enter setup:

Select boot device:

1. AHCI/0: SATA SSD ATA-11 Hard-Disk (15272 MiBytes)
2. iPXE
3. Payload [setup]
4. Payload [memtest]

Press n to enable Network/PXE boot and then Press s to save.

Booting from CBFS..ERROR: No keyboard controller found!

### PC Engines apu4 setup v4.6.16 ###
Boot order - type letter to move device to top.

  a USB
  c mSATA
  d SATA
  e mPCIe1 SATA1 and SATA2
  f iPXE

  r Restore boot order defaults
  n Network/PXE boot - Currently Enabled
  u USB boot - Currently Enabled
  t Serial console - Currently Enabled
  k Redirect console output to COM2 - Currently Disabled
  o UART C - Currently Enabled
  p UART D - Currently Enabled
  m Force mPCIe2 slot CLK (GPP3 PCIe) - Currently Disabled
  h EHCI0 controller - Currently Disabled
  l Core Performance Boost - Currently Enabled
  i Watchdog - Currently Disabled
  j SD 3.0 mode - Currently Disabled
  v IOMMU - Currently Disabled
  w Enable BIOS write protect - Currently Disabled
  x Exit setup without save
  s Save configuration and exit

It will restart and you will see PXE boot option now. Press N.

SeaBIOS (version rel-

Press F10 key now for boot menu, N for PXE boot

When you press N, the following information will pass very quickly, you might not be able to see it (I captured it with screen -L):

Booting from ROM...
iPXE starting execution...ok
iPXE initialising devices...ok

iPXE 1.0.0+ (ebf2) -- Open Source Network Boot Firmware --

and iPXE boot menu will be shown. Select autoboot (and it is the default setting with a short timeout):

 ---------------- iPXE boot menu ----------------
   ipxe shell

again these will pass very quickly:

net0: 00:0d:b9:55:66:08 using i211 on 0000:01:00.0 (open)
  [Link:up, TX:0 TXE:0 RX:0 RXE:0]
Configuring (net0 00:0d:b9:55:66:08)...... ok
net0: gw
Next server:
Filename: pxelinux.0
tftp:// ok
pxelinux.0 : 41612 bytes [PXE-NBP]

PXELINUX 6.03 PXE 20190218 Copyright (C) 1994-2014 H. Peter Anvin et al

as you see above, the server and file name is correct and it is fetched from TFTP. Finally you will see the Installer menu.

                     │     Installer boot menu      │
                     │ Install                       │
                     │ Command-line install          │
                     │ Serial-console install        │
                     │ Advanced options            > │
                     │ Help                          │
                     │                               │
                     │                               │
                     │                               │
                     │                               │
              Press ENTER to boot or TAB to edit a menu entry

You can see the option we created, Serial-console install.

Install Ubuntu

Select Serial-console install and install Ubuntu as usual.

It is easier to do the next step if you install SSH server during the installation, but it can be skipped too.

Modifying GRUB config for serial console

If you are not able to access to the computer using SSH

If you did not install SSH server or if you cannot connect to the computer using SSH, reset the computer and press ESC (repeatedly) in serial console during reboot and you will see the GRUB menu:

                             GNU GRUB  version 2.02

 |*Ubuntu                                                            |
 | Advanced options for Ubuntu                                       |
 |                                                                   |
 |                                                                   |

      Use the ^ and v keys to select which entry is highlighted.
      Press enter to boot the selected OS, `e' to edit the commands
      before booting or `c' for a command-line.

press e to edit the commands, and add “console=ttyS0,115200n8” to the end of the line starting with linux:

 |        linux        /boot/vmlinuz-4.15.0-76-generic root=UUID=d52897ed-fb9\|
 |9-46ce-90e0-9b99f05c87c6 ro  quiet splash $vt_handoff console=ttyS0,115200n\|
 |8                                                                           |

then press Ctrl-x or F10 to boot. You will have the serial console, but in order to persist this setting, do the next step.

When you have access to the computer

If you have installed SSH, login to the computer. If you did not, do the steps above to login on serial console.

Now modify /etc/default/grub. These are the default settings (do not change the other settings, just these two):


modify them to:


Then run sudo update-grub and reboot the computer. Now the serial console will always be available.