Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


apu_ubuntu

PC Engines APU2 - Ubuntu 18.04 LTS server

Install Ubuntu 18.04 LTS on a PC Engines APU2 board.

If you're using an APU1 board, try the section Prepare a USB drive (optional) to create a prepared USB-drive first. Then boot from USB (press F12, during boot) and select Command-line install and proceed with the installation.

Install Ubuntu 18.04

  • dd Ubuntu server netinstall (mini.iso) to USB drive https://www.ubuntu.com/download/alternative-downloads, be sure to select the amd64 arch.
  • Connect the USB drive to the APU2 board and boot from USB, press F10 at boot.
  • Select Install, then TAB.
  • Change kernel options to linux initrd=initrd.gz console=ttyS0,115200
  • When asked to unmount mounted partitions choose Yes.
  • Install options as you like.
  • Reboot after install.

Post installation steps

GRUB

  • At the grub menu, press 'e'.
  • Scroll to the line starting with linux and add:
    console=ttyS0,115200n8
  • Then press 'ctrl-x' to boot.
  • You can now log in with your user account.
  • Modify grub:
    sudo vi /etc/default/grub
    GRUB_CMDLINE_LINUX="console=ttyS0,115200n8"
    
    sudo update-grub
  • Reboot to test the update grub configuration.

Networking

  • Edit /etc/netplan/01-netcfg.yaml
    # This file describes the network interfaces available on your system
    # For more information, see netplan(5).
    network:
      version: 2
      renderer: networkd
      ethernets:
        enp1s0:
          addresses:
            - 10.10.10.2/24
          gateway4: 10.10.10.1
          nameservers:
              search: [mydomain, otherdomain]
              addresses: [10.10.10.1, 1.1.1.1]
  • Apply config:
    netplan apply

Misc

  • Install and start openssh:
    apt install openssh-server
  • Enable firewall:
    ufw allow ssh
    ufw enable
  • Multi-user target (not graphical):
    sudo systemctl set-default multi-user.target
  • Configure timezone:
    dpkg-reconfigure tzdata
  • Configure locale:
    dpkg-reconfigure locales

Watchdog

It seems the sp5100_tco module is blacklisted by default in /lib/modprobe.d. We need to override that and blacklist some conflicting modules.

  • Blacklist conflicting modules:
    cat >> /etc/modprobe.d/blacklist-i2c-ccp.conf <<EOF
    blacklist i2c_piix4
    blacklist ccp
    EOF
  • Update the initramfs:
    update-initramfs -u
  • Install watchdog:
    apt install watchdog
  • Add module to config:
    vi /etc/default/watchdog 
    # Load module before starting watchdog
    watchdog_module="sp5100_tco"
  • Edit /etc/watchdog.conf:
    watchdog-device = /dev/watchdog
  • Reboot to test:
    dmesg | grep sp5100_tco
  • Kill watchdog, it should restart your system after some time:
    pkill -9 watchdog
    # if wd_keepalive is started, also kill that
    pkill -9 wd_keepalive

PC speaker

  • Install beep:
    apt install beep
  • Comment or remove pcspkr from /etc/modprobe.d/blacklist.conf.

LEDs

Power / reset button, J2

  • ACPId is already installed and should be working.
    • Short press: shutdown
    • Long press: hard power off
    • When powered off, short press, will power on.
  • You can add a beep, just before shutdown.
    cat >> /etc/systemd/system/beeponshut.service <<EOF
    [Unit]
    Description=beep
    
    [Service]
    Type=oneshot
    RemainAfterExit=true
    ExecStart=/bin/true
    ExecStop=/usr/bin/beep -f500 -l50 -r3 -n -f1 -l50 -n -f400
    
    [Install]
    WantedBy=multi-user.target
    EOF
    
    systemctl daemon-reload
    systemctl enable beeponshut

Prepare a USB drive (optional)

  • Install required packages:
    apt install xorriso isolinux
  • Extract downloaded ISO and copy the files to a temporary location:
    sudo mkdir /mnt/iso
    sudo mount -o loop ~/Downloads/mini.iso /mnt/iso
    cd /mnt
    tar -cvf - iso | (cd /var/tmp/ && tar -xf - )
    cd /var/tmp/iso
  • Modify isolinux.cfg
    serial 0 115200
    console 0
    path
    include menu.cfg
    default vesamenu.c32
    prompt 0
    timeout 0
  • Modify cli / Command-line install: txt.cfg
    #From:
    append tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false vga=788 initrd=initrd.gz --- quiet 
    
    #To:
    append tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false vga=off initrd=initrd.gz console=ttyS0,115200n8 ---
    
  • Create a new ISO file:
    #Fedora host:
    xorriso -as mkisofs -R -J -V "Ubuntu-Server 18.04 LTS amd64" \
    -o ~/file.iso -b isolinux.bin -c boot.cat -no-emul-boot \
    -boot-load-size 4 -boot-info-table \
    -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin .
    
    #Ubuntu host:
    xorriso -as mkisofs -R -J -V "Ubuntu-Server 18.04 LTS amd64" \
    -o ~/file.iso -b isolinux.bin -c boot.cat -no-emul-boot \
    -boot-load-size 4 -boot-info-table \
    -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin .
    
    
    
  • Write the new image to the USB drive:
    sudo dd if=~/file.iso of=/dev/sdX bs=4M
apu_ubuntu.txt · Last modified: 2021/10/09 15:14 by 127.0.0.1