In my most recent post, I covered how I was able to successfully install Ubuntu 20.04 LTS for s390x on an emulated mainframe using QEMU. While I have physical hardware for AMD64, ARM64 and RISC-V, there is another currently-supported processor architecture for Ubuntu that I don’t have the hardware for and that is IBM POWER. This CPU is the latest evolution of the PowerPC RISC CPU that was developed by IBM and Motorola in the 90’s and that was the core of Apple laptops and desktops for many years.
The current version of this architecture is available as the iSeries from IBM and has many variants still used in industrial and automotive applications as well as on some gaming consoles in the recent past. Given my success with Ubuntu 20.04 LTS on s390x with QEMU, I’m going to try replicating that for this platform as well. If I am successful, I will then have all of the processor architectures covered for Ubuntu Server.
First off, I installed the QEMU bits I needed:
$ sudo apt install qemu-system-ppc64 qemu
A quick peek in /usr/bin shows that “qemu-system-ppc64le” is installed. The “little endian” (a CS term that refers to how bytes in a word are stored physically in memory with the least significant byte first and the most significant byte last) version is how the POWER architecture version of Ubuntu is implemented.
In order to get our POWER guest connected to the network, we need to reconfigure this machine to use a bridge interface just like we did for the s390x. Do this by editing your /etc/netplan/*.yaml file as follows:
# This is the network config written by 'subiquity' network: ethernets: eth0: dhcp4: no bridges: br0: dhcp4: no addresses: - 192.168.1.199/24 gateway4: 192.168.1.1 nameservers: addresses: - 192.168.1.1 search: - example.com interfaces: - eth0 version: 2
Apply the changes:
$ sudo netplan apply --debug
Set up the tunneling support needed by QEMU:
$ sudo apt install qemu-kvm bridge-utils $ sudo ip tuntap add tap0 mode tap $ sudo brctl addif br0 tap0
Now create the virtual storage device that we will be installing Ubuntu LTS onto:
$ qemu-img create -f qcow2 ubuntu-run.qcow2 10G
At this point, we need to download the installer and extract the kernel and initrd images from it, just like we did with s390x:
$ wget https://old-releases.ubuntu.com/releases/22.04/ubuntu-22.04-beta-live-server-ppc64el.iso
Then, create a script to launch the installer:
#! /usr/bin/bash emu-system-ppc64le -machine pseries -cpu power9 -nodefaults -nographic -serial telnet::4441,server -m 8192 -smp 2 -cdrom ubuntu-22.04-beta-live-server-ppc64el.iso -drive file=ubuntu-run.qcow2,format=qcow2 -net nic,model=virtio-net-pci -net tap,ifname=tap0,script=no,downscript=no
After you run this, it will wait for a telnet connection to proceed. In a separate ssh into the host, you need to enable the network:
$ ip link set up dev tap0 $ ip a # confirm that tap0 shows "up"
Now, you can telnet into the virtual serial console and run the install as you normally do:
$ telnet localhost 4441
After the install finishes and reboots, kill the qemu session with a CTRL+C in its ssh terminal and modify your run script:
#! /usr/bin/bash qemu-system-ppc64le -machine pseries -cpu power9 -nodefaults -nographic -serial telnet::4441,server -m 8192 -smp 2 -drive file=ubuntu-run.qcow2,format=qcow2 -net nic,model=virtio-net-pci -net tap,ifname=tap0,script=no,downscript=no
Then, create a systemd service file for it as /etc/systemd/system/ppc64le.service:
[Unit] Description=Launch ppc64le emulator session After=getty.target Before=ppc64le-network.service [Service] Type=simple RemainAfterExit=yes ExecStart=/root/run-ubuntu.sh TimeoutStartSec=0 [Install] WantedBy=default.target
Create a script file called /root/tuntap.sh to bring up the qemu network interface (don’t forget to chmod +x the file):
#! /usr/bin/bash sleep 15 brctl addif br0 tap0 ip link set up dev tap0
Then create a systemd service file for it as /etc/systemd/system/ppc64le-network.service:
[Unit] Description=Enable ppc64le networking After=getty.target [Service] Type=simple RemainAfterExit=no ExecStart=/root/tuntap.sh TimeoutStartSec=0 [Install] WantedBy=default.target
Finally enable and start the services:
$ sudo systemctl enable ppc64le-network.service $ sudo systemctl start ppc64le-network.service $ sudo systemctl enable ppc64le.service $ sudo systemctl start ppc64le.service
A reboot should automatically show the two new services running and you should be able to ssh into your new POWER machine running Ubuntu 22.04 over the network as if it were physical hardware. It might be a bit slow, but it works!