This note is a summary of my experience of installing Ubuntu for IBM s390x on Qemu on a macOS host. This is just a personal experience. There may be other ways.
If you wonder why I had the silly idea of installing an IBM s390x virtual machine on macOS, 1) because it is possible, 2) because it is a big endian system which can be useful to test the portability of some applications.
For simplicity, all files will be copied in one single dedicated directory and all commands will be run from that current directory.
Initial reference: https://community.ibm.com/community/user/ibmz-and-linuxone/blogs/timothy-sipples1/2020/04/28/run-ubuntu-z-linuxone
Install qemu (using HomeBrew on macOS):
$ brew install qemu
....
$ qemu-system-s390x --version
QEMU emulator version 8.2.0
Copyright (c) 2003-2023 Fabrice Bellard and the QEMU Project developers
Download the lastest Ubuntu Server image for s390x:
$ wget https://cdimage.ubuntu.com/releases/23.10/release/ubuntu-23.10-live-server-s390x.iso
Create a virtual disk drive for the VM (30 GB in that case):
$ qemu-img create -f raw vm-s390x-hdd.raw 30G
Extract the kernel from the downloaded ISO image:
- Mount the ISO image. On macOS, simply double-click on the ISO image from the Finder.
- Copy the two file
boot/initrd.ubuntu
andboot/kernel.ubuntu
in the same directoy as the VM files. - You may dismount the ISO. On macOS, "eject" from the Finder.
Just checking:
$ ls -l
-r--r--r-- [...] 30016812 [...] initrd.ubuntu
-r--r--r-- [...] 9900600 [...] kernel.ubuntu
-rw-r--r-- [...] 1107175424 [...] ubuntu-23.10-live-server-s390x.iso
-rw-r--r-- [...] 32212254720 [...] vm-s390x-hdd.raw
Boot the VM on the ISO image:
$ qemu-system-s390x \
-machine s390-ccw-virtio \
-cpu max,zpci=on \
-smp 8 \
-nographic \
-m 4096 \
--cdrom ubuntu-23.10-live-server-s390x.iso \
-kernel kernel.ubuntu \
-initrd initrd.ubuntu \
-drive file=vm-s390x-hdd.raw,format=raw \
-nic user,hostfwd=tcp::2222-:22
The boot is quite slow (this is emulation) but works. Specifically, you may see messages such as "waiting for cloud init...". Don't worry and just wait.
- Initial menu: "continue in basic mode / rich mode". Because you probably run qemu from a decent terminal window, it has the capability to display menus and colors. Select "rich mode".
- Select the installation language (typically "English"), then keyboard layout and variant (in my case: "French" and "French - French (Macintosh)").
- Choose the base for the installation. Use "Ubuntu Server".
- Zdev setup. Not sure about this. Keep the default, move to "Continue".
- Network connections: DHCP should display an allocated address. Keep it, select "Done".
- Configure proxy. None in my case.
- Configure Ubuntu archive mirror. A default local URL is provided. The message "The mirror location is being tested" runs for a while, until "This mirror location passed tests". Select "Done".
- Storage configuration: Select "Use an entire disk" and deselect "Set up this disk as an LVM group" (we don't need LVM). Select "Done" and accept the proposed disk layout. Confirm "destuctive" action, select "Continue".
- Create a user and password. Select a host name, eg. "vms390x".
- Select "Install OpenSSH server".
- Ignore "Featured snaps".
- The device setup and system installation run for a rather long time (again, this is emulation). The qemu process uses 100 to 200% CPU on the host system.
- The installation may continue with "downloading and installing security updates".
- At some point, the choice "Reboot Now" appears. Select it.
- The shutdown process takes some time. Then, the qemu command exits.
Use the following command to boot the installed system. It is probably a good idea to keep it in a shell script.
$ qemu-system-s390x \
-machine s390-ccw-virtio \
-cpu max,zpci=on \
-smp 8 \
-nographic \
-m 4096 \
-drive file=vm-s390x-hdd.raw,if=none,id=drive-virtio-disk0,format=raw,cache=none \
-device virtio-blk-ccw,devno=fe.0.0002,drive=drive-virtio-disk0,bootindex=1 \
-nic user,hostfwd=tcp::2222-:22
Again, the boot is quite slow because of the emulation.
Because of the -nic
option at the end of the qemu command, the TCP port 2222 on the host is redirected to port 22 (ssh port) on the virtual machine. Therefore, logging to the VM is done this way:
$ ssh -p 2222 user@localhost
where user
is the name of the user you specified during installation.