Power Developer eXchange

 View Only

Run your AIX VM on x86 using KVM and QEMU

By Hugo B posted Wed January 17, 2024 04:21 PM

  

Want to learn AIX but don't have a Power system to connect to?

Well, although the ideal is to use an instance on IBM Cloud that you can get from just a few euros a day, there is another method: unsupported, extremely slow, with some bugs but a lot of fun that you can try before making the leap to a real Power with the best UNIX in the world.

In this demo we are using this HW

$ cat /proc/cpuinfo

vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      : Intel(R) Xeon(R) CPU E5-1410 v2 @ 2.80GHz
stepping        : 4

and Ubuntu as OS with standard packages from the official repositories

ubuntu@sixe-dev:~$ lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 23.04
Release:        23.04
Codename:       lunar

In there, we will install all what we need to virtualize and emulate PPC

$ sudo apt install -y qemu-system-ppc qemu-kvm virt-manager virtinst libvirt-clients bridge-utils libvirt-daemon-system

Libvirt will store isos and images on  /var/lib/libvirt/images/ so we'll cd to there

$ cd /var/lib/libvirt/images/

We create a blank disk image for AIX

$ qemu-img create -f qcow2 hdisk0.qcow2 20G

and download to the same directory and AIX 7.2 image that you are entitled to use in accordance with your current contracts with IBM, although I think that this kind of emulation, like Hercules in Z/OS is a bit in no man's land although I don't know the legal implications that may exist.

That said, here is the command to boot the virtual machine from the AIX iso image and using the new disk. 

$ qemu-system-ppc64 -cpu POWER8 -machine pseries -m 4096 -serial stdio -drive file=/var/lib/libvirt/images/hdisk0.qcow2,if=none,id=drive-virtio-disk0 -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=drive-virtio-disk0 -cdrom /var/lib/libvirt/images/aix72.iso -prom-env "boot-command=boot cdrom:" -prom-env "input-device=/vdevice/vty@71000000" -prom-env "output-device=/vdevice/vty@71000000"

There are other possible configurations, but this is the one that worked correctly for me. To the question why not an AIX 7.3 the answer is that it has some easter egg inside that prevents (for now) its booting in qemu.

The rest of the process is the same as in an LPAR, but much, much slower. When the installation is finished, the system enters an infinite loop of reboots that must be aborted with a CTRL + C, and restarting the virtual image without the .iso (DVD). This is the command to do it.

$ qemu-system-ppc64 -cpu POWER8 -machine pseries -m 4096 -serial stdio -drive file=/var/lib/libvirt/images/hdisk0.qcow2,if=none,id=drive-virtio-disk0 -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=drive-virtio-disk0 -prom-env "input-device=/vdevice/vty@71000000" -prom-env "output-device=/vdevice/vty@71000000"

And here you have a video (with the most boring moments doing I/O access at x16). As a spoiler, most things work correctly, you can install software, create a VG, an LV, mount a file system, launch the nmon or create users. However the VM can fail at any time for a thousand reasons, and if you perform any operation that involves disk access go straight for coffee because it will take a while.

Permalink

Comments

Sat April 06, 2024 10:00 PM

Using Hugo B's detailed instructions and inspired after seeing Nigel's post the other day, I decided to try the setup this weekend on my MacBook with the following hardware and software configuration:

  • MacBook Pro M2: macOS v14.14.1, featuring 10 M2 CPU cores (4 efficiency and 6 performance cores), and 32GB of memory.
  • VMware Fusion v13.5.1
  • Ubuntu 64-bit ARM Server v23.10: Allocated with 12GB RAM and 4 CPU cores.
  • AIX 7.2 (7200-05-00-2037): Utilized as the ISO file.

Notably, except for the AIX ISO, all software versions were the latest available versions.

I performed this installation twice, both successfully. While the performance is not on par with native Power hardware, the outcome was satisfactory.

For the first installation, I followed Hugo’s recommendation of a 20G disk and 4G memory setup, which performed similarly to Nigel’s T480 Laptop. 

In the second installation, I increased the disk storage to 50G, the memory to 8G, and adjusted the CPU configuration to a single socket with 2 cores (-smp 2, cores=2, threads=1).

My current QEMU/AIX start command mirrors Hugo's, with modifications for the CPU and additional Memory, and Nigel’s serial recommendation:

qemu-system-ppc64 -cpu POWER8 -machine pseries -smp 2, cores=2, threads=1 -m 8G -serial mon:stdio -drive file=/var/lib/libvirt/images/hdisk0.qcow2, if=none, id=drive-virtio-disk0 -device virtio-scsi-pci, id=scsi -device scsi-hd, drive=drive-virtio-disk0 -prom-env "input-device=/vdevice/vty@71000000" -prom-env "output-device=/vdevice/vty@71000000"

Timing performance after adding more Memory and CPU, jumped:

  • The oslevel -s command execution took 8 seconds.
  • The nmon load metrics were comparable to those of my Power systems.
  • The duration from QEMU start to AIX’s user login prompt was 2 minutes and 20 seconds.

Out of curiosity, I enabled DHCP (vs setting a static IP), and the system picked up an IP with Internet access. I’ll probably use it to download and apply the latest Service Pack.

Rick

Wed March 13, 2024 12:55 PM

I followed this article and it all worked. Hugo B - I am impressed.

I have a Lenovo T480 Laptop @ 1.9 GHz.
Using Windows 11 to run VirtualBox supporting Ubuntu 23.10 virtual machine with 50GB disk & 4GB of memory. Ubuntu claims 3792 Bogomips.
Install AIX 7.2 TL5 sp7 from CDROM .iso file.
Everything worked fine.

A few tips:

When using SMS menu to start AIX install options:
Take the 2 Change Settings options.
Then (I think 5) for More Options and unselect the add all drivers in case you more the VM to alternative hardware.
AIX on QEMU is not using any real adapters so the device drivers are pointless.  This reduces the long install time by ~50% = far fewer packages to install .

I gave the QEMU a little less memory = 3GB: -m 3072
So the Ubuntu has at least 1GB in which to run. I avoided giving Ubuntu 4GB and telling QEMU to use 4GB - that could generate paging. I could be more generous on memory as my Windows 11 has 16GB.

To stop any user Control-C killing QEMU, I changed "-serial stdio"
to: -serial mon:stdio
Otherwise every a stuck AIX command (or just too slow) and my fingers hit Control-C (without me thinking about it) and bang: QEMU halts. I have no idea how the extra "mon:" does that but found the hack works.

I was amazed nmon started in four seconds! :-)
But that nmon developer is a genius. Actually, nmon does very little on start up and only gets the performance data (which takes more I/O and CPU cycles), when you ask to take a look at the statistics on screen.

oslevel -s
takes 30 seconds to run!
Output: 7200-05-07-2346 = 23 -> 2023 and 46 is the week number of that year i.e. early November

I put in .profile
set -o vi
stty erase ^?

for command line editing - or I spend all day typing uneditable typos.

The time and date was perfect - I guess QEMU gets that from the underlying Ubuntu.

AIX 7.3 does not work for me either :-(
All the AIX 7.3 "new stuff" is in my YouTube videos and most of it will not run on QEMU due to it depending on new Hypervisor & System Firmware features of POWER9 or Power10 hardware.

QEMU start to User Login prompt is 6 minutes 20 seconds.


Hope this helps. Cheers, Nigel Griffiths

Thu January 18, 2024 09:34 AM

Some people asked about the TL and SP supported. I used the .iso file with AIX 7.2 TL5 SP6