Run AIX 7.2 on x86 with QEMU

AIX is the UNIX proprietary Operating System (OS) of IBM and unless you have access to IBM expensive machines (Power Series), you won’t have a chance of using or trying the IBM powerful OS.

Nowadays, we virtualize or containerize almost everything on our personal machines or laptops. However, the virtualization is only possible when the processor architecture of the host (your PC) and the guest (the Virtual Machine or VM) is the same.

I have a common Intel (x86) laptop running linux (of course). And I want to run AIX on top of it. AIX is an OS solely purposed for PPC (PowerPC) architecture. Therefore, I knew from inception that there won’t be any virtualization solution for this, but in theory it might be possible to achieve my goal through emulation.

I decided to try it with the best emulator ever: QEMU. I would be forever grateful to Fabrice Bellard, the French brilliant hacker who built this opensource tool that is literally the Swiss Army knife of emulation.

1 – Prerequisites
  • Be Patient during the whole process !!!
    the following procedures can take several minutes or hours and you are likely to start over at many times, so the key word here is: Patience.
  • Download and compile a recent version of Qemu
wget https://download.qemu.org/qemu-5.1.0.tar.xz
tar xvJf qemu-5.1.0.tar.xz
cd qemu-5.1.0
./configure
make

It will take some time …

  • Obtain AIX 7.2 installation media
    Download AIX DVD iso from IBM ESS (Entitlement System Support):
    https://www.ibm.com/servers/eserver/ess/index.wss
    You can create a free account on IBM but you may have to provide details on an existing serial number and Power Series machine model prior to downloading.
    Save the iso file with an adequate name, for e.g. AIX72.iso
2 – Creation of the hard drive of our VM

Create an empty virtual disk:
(in my case I created a folder aixVM where I am creating the disk and dropping the ISO file)

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

3 – Creation of the AIX VM

Define the VM with the below parameters:
cpu = 1 (it can support many cores via the smp parameter as well)
memory = 4G (you can set it to 2G as well)
boot from the CDROM (the AIX 7.2 iso file)

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

Take a long coffee break here …

4 – Boot from the disk

The installation from the CDROM is likely to enter an infinite loop. You’ll notice it by observing the VM monitor. If that’s the case, interrupt the process with CTRL-C.
Then, launch the same command with the disk as boot device instead of the CDrom:

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

At this stage after a successful load of the OS kernel, the process may hang after the activation of the swap partition, like in the below screenshot:

To solve the problem we need to restart the process by setting the verbose flag as in the command below:

qemu-system-ppc64 -cpu POWER8 \
-machine pseries -m 4096 -serial stdio \
-drive file=hdisk0.qcow2,if=none,id=drive-virtio-disk0 \
-device virtio-scsi-pci,id=scsi \
-device scsi-hd,drive=drive-virtio-disk0 \
-cdrom AIX72.iso \
-prom-env "boot-command=boot disk: -s verbose" \
-prom-env "input-device=/vdevice/vty@71000000" \
-prom-env "output-device=/vdevice/vty@71000000"

It appears the fsck64 program is the one crashing.

5 – Solve the fsck64 issue
  • Boot from the CDrom and go into the Maintenance Mode:
  • Go to /sbin/helpers/jfs2 and empty the file fsck64 :
cd /sbin/helpers/jfs2
> fsck64
  • Edit the fsck64 file with the following lines:
    #!/bin/ksh
    exit 0
  • Save and quit the file.
  • Sync the changes to the disk and shutdown the VM
6 – Boot from the disk drive and access the system
qemu-system-ppc64 -cpu POWER8 \
-machine pseries -m 4096 -serial stdio \
-drive file=hdisk0.qcow2,if=none,id=drive-virtio-disk0 \
-device virtio-scsi-pci,id=scsi \
-device scsi-hd,drive=drive-virtio-disk0 \
-cdrom AIX72.iso \
-prom-env "boot-command=boot disk:" \
-prom-env "input-device=/vdevice/vty@71000000" \
-prom-env "output-device=/vdevice/vty@71000000"

Accept the license agreements, change the root password and this time, you should get (finally) the AIX console login prompt.

7 – Post installation tasks : Services, SSH & Network setup

Some default services are not necessarily needed and should be disabled to enable a faster boot of the VM.
You’ll also notice that the VM CPU is almost at 100% utilization; this is also due to some of those services.

rmitab cron
rmitab clcomd
rmitab naudio2
rmitab pfcdaemon
stopsrc -s clcomd
stopsrc -s pfcdaemon
  • Install OpenSSH

Mount the CDROM, copy the required filesets and install:

mount  -v  cdrfs  -o  ro  /dev/cd0  /mnt
mkdir   /tmp/ssh_install
cd  /mnt/installp/ppc
cp  openssh*  /tmp/ssh_install
cd  /tmp/ssh_install
installp -acgXYd . openssh.base openssh.license openssh.man.en_US openssh.msg.en_US

Check if sshd is up and running:

lssrc  -s  sshd
  • Network Setup
    The network activation is a very important piece as you would have noticed that every time we CTRL-C our VM, it shuts it down.
    To setup the VM, we are going to use another magic possibility of QEMU:
    use of a tap device to emulate network bridge.

1 – Add a new tap device in your Linux Host machine

ip tuntap add dev tap0 mode tap

2 – Enable proxy_arp on both devices (the tap device and your LAN/WLAN interface)

echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp
echo 1 > /proc/sys/net/ipv4/conf/wlp0s20f3/proxy_arp

3 – Setup IP settings for the tap device
(My WLAN IP is 192.168.100.4 and I want to give 192.168.100.151 to the AIX VM)

ip addr add 192.168.100.4 dev tap0
ip link set up tap0
ip link set up dev tap0 promisc on
ip route add 192.168.100.151 dev tap0
arp -Ds 192.168.100.151 wlp0s20f3 pub

4 – Restart the AIX VM with the NIC interface defined as tap0

qemu-system-ppc64 -cpu POWER8 \
-machine pseries -m 4096 -serial stdio \
-drive file=hdisk0.qcow2,if=none,id=drive-virtio-disk0 \
-device virtio-scsi-pci,id=scsi \
-device scsi-hd,drive=drive-virtio-disk0 \
-cdrom AIX72.iso \
-net nic -net tap,script=no,ifname=tap0
-prom-env "boot-command=boot disk:" \
-prom-env "input-device=/vdevice/vty@71000000" \
-prom-env "output-device=/vdevice/vty@71000000"

5 – Assign the IP address to the network interface inside the AIX VM

chdev -l en0 -a netaddr=192.168.100.151 -a netmask=255.255.255.0 -a state=up

8 – Final step

Now with SSH active and Network working, we can run our so long QEMU command line in the background !

qemu-system-ppc64 -cpu POWER8 \
-machine pseries -m 4096 \
-drive file=hdisk0.qcow2,if=none,id=drive-virtio-disk0 \
-device virtio-scsi-pci,id=scsi \
-device scsi-hd,drive=drive-virtio-disk0 \
-cdrom AIX72.iso \
-net nic -net tap,script=no,ifname=tap0
-prom-env "boot-command=boot disk:" \
-prom-env "input-device=/vdevice/vty@71000000" \
-prom-env "output-device=/vdevice/vty@71000000" \
--daemonize

Wait for the VM to boot up completely and you can enjoy: now you have the best operating system running on your laptop !!

24 thoughts on “Run AIX 7.2 on x86 with QEMU

  1. To only configure the ppc64 emulation and skip the other dozens of chips:
    change ./configure to
    ./configure –target-list=ppc64-softmmu
    Saved me about an hour.

    Liked by 1 person

  2. Example commands sections all need a space before the line ending “\” – probable a website formatting problem
    The network one (-nic net …) has a missing “\”

    Liked by 1 person

  3. Hi, I have followed your excellent guide step by step but I cannot install the S.O. AIX.
    I obviously have the iso file and also the DVD containing the S.O.
    always goes out with.
    Can you help me, thanks.

    Francesco Vecchio

    —————————-

    AIX Version 7.1
    Illegal Trap Instruction Interrupt in Kernel
    058C1ACC tweqi r0,0 r0=0
    KDB(0)>

    Like

    1. Dear Francesco, sorry for my late reply.
      which qemu version do you use ? and which power architecture have you chosen ? (P8 or P7).
      Not all versions of AIX work with the QEMU emulation. I recommend you do use AIX 7.2.
      Let me however have your feedback on the above.
      Cheers.

      Like

  4. My AIX setup stopped to work.

    AIX 7.2 TL3 ISO install boots up in QEMU 5.2. When I start install, after some minutes I get:

    BOS Install: Could not create the / file system.
    ID# OPTION
    1 Continue
    2 Perform System Maintenance and Then Continue

    When I continue, I get:
    BOS Install: Could not create the /admin file system.
    Later,
    BOS Install: Could not create the /home file system.
    Etc…

    When I go maintenace shell, looks like LVM LVs created. When I tried:
    # mkfs -V jfs2 /dec/hd4
    # mount -V jfs2 /dev/hd4 /mnt
    /sbin/helpers/jfs2: Exec format error

    Looks like, AIX setup can’t mount the created filesystems on the disk.

    Like

    1. HI Tibor,
      Never encountered such an error. and its quite surprising since the disks are actually virtual blocks !
      Or could it come from the ISO ?
      Keep us posted.

      Like

      1. Dear Steve,

        Thank you, If you can help Me.

        Enviroment: Debian 10 (as ESXi 6.7 guest)
        QEMU: QEMU emulator version 5.2.0 (Debian 1:5.2+dfsg-3~bpo10+1)
        Installation media: aix_7200-03-00_1of2_92018.iso

        My ISO, is an official ISO, not made by mksysb.

        CMD:
        qemu-img create -f qcow2 hdisk0.qcow2 20G
        emu-system-ppc64 \
        -cpu power8 \
        -smp 1 \
        -M pseries \
        -m 4096 \
        -nographic \
        -chardev stdio,id=char0,mux=on,logfile=aix72-out.log,signal=off \
        -serial chardev:char0 \
        -mon chardev=char0 \
        -cdrom aix_7200-03-00_1of2_92018.iso \
        -hda hdisk0.qcow2 \
        -prom-env “input-device=/vdevice/vty@71000000” \
        -prom-env “output-device=/vdevice/vty@71000000” \
        -prom-env boot-command=’boot cdrom: -s verbose’

        (Tired disk as virtio-scsi as You, but AIX setup didn’t see hdisk0.)

        Result:
        https://pastebin.com/GzXFe6Z7
        Verbose:
        https://pastebin.com/egWe0wHK

        When I look inside the hdisk0.qcow2, I see LVMs metadata. But I think, JFS2 filesystems not created.
        because “mkfs” (or “mount”) in setup is failed.

        Additional test:
        When I go to Maintenence shell, and I run (as see in end of verbose log):
        /usr/sbin/mkfs -l / -v root -V jfs2 -s 131072 -o name=/ /dev/hd4
        Return instantly without any message.

        After that:
        mount /dev/hd4 /mnt
        Return message:
        /sbin/helpers/jfs2: Exec format error

        Like

  5. I am currently trying to create an AIX 7.2 image using QEMU on Windows following these steps:

    I am now almost at the end — with QEMU booting from the .img file instead of the ISO, but I am stuck at the install process where I have to accept the AIX Software License Agreement (before anyone asks, yes, this is a legal copy of AIX). I am unable to move the cursor to select the “Accept” option – it seems like it’s not accepting the arrow keys. I am able to input other keys though, as previous steps required me to type in choices. For this screen I am also able to select the bottom options like help (Esc-1), refresh (Esc-2) etc.

    I have tried the following:

    Run qemu from Windows prompt, with terminal set to xterm – doesn’t work
    Run qemu from powershell, terminal set to xterm via registry, doesn’t work
    Run qemu from Ubuntu/WSL2, terminal set to xterm, doesn’t work (also tried vt100, doesn’t work)
    I’ve tried adding the -k en-us parameter for keyboard to all iterations above, didn’t work
    I’m using this command:

    ../qemu/qemu-system-ppc64.exe -cpu POWER8 -machine pseries -m 2048 -serial stdio -drive file=aix-hdd.img,if=none,id=drive-virtio-disk0 -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=drive-virtio-disk0 -cdrom aix_7200-04-01-1939_flash_112019.iso -prom-env “boot-command=boot disk:” -display vnc=:1 -k en-us

    I’ve also tried using VNC to connect, but the install options don’t appear in the VNC stream.

    same problem:https://superuser.com/questions/1551232/aix-7-2-install-on-qemu-on-windows-unable-to-accept-arrow-keys

    Like

    1. I have experienced it just like you. But it was successful.
      First, run MobaXterm, then run qemu to start the AIX VM.
      Second, select vt100 on the terminal type selection page.
      Third, on the license agreement page, press the down arrow key and press Enter.
      The highlight doesn’t change on the display you’re looking at. However, after the page changes, the license agreement page is displayed. Perhaps on the screen, there seems to be no immediate response to the arrow keys. The same is true for changing the value. (For example, changing from no to yes)

      Follow the next process in the same way. Finally, you will see a login page.

      good luck.

      Like

  6. Hi, I’m trying to boot with two hard drives but without success, is there anyone who knows if it’s possible ?
    Thank you.

    Like

  7. Dear Abderrazek, it is very possible.
    it’s been a while I haevent played around this but I remenber very well that I used more than a disk.
    * you start by creating a qcow2 (or img) disk file
    * you then add to the startup command the required parameters to specify the scsi drives.
    something like this:
    -drive file=hdisk0.qcow2,if=none,id=drive-virtio-disk0 \
    -device virtio-scsi-pci,id=scsi-0 -device scsi-hd,drive=drive-virtio-disk0 \
    -drive file=hdisk1.qcow2,if=none,id=drive-virtio-disk1 \
    -device virtio-scsi-pci,id=scsi-1 -device scsi-hd,drive=drive-virtio-disk1

    Like

  8. Hi
    I’m stuck here.

    Finished starting tcpip daemons.
    Starting NFS services:
    [STOP] DSO is not supported on KVM systems
    [STOP] DSO is not supported on KVM systems
    [STOP] DSO is not supported on KVM systems
    Completed NFS services.
    Unable to disable probevue : A system call received a parameter that is not valid.
    Unable to enable probevue : Reserved errno was encountered

    Like

      1. Hello Oscar,
        It’s been a while i played with Aix on x86.
        Let me try the emulation later in the day and revert.
        Thanks

        Like

Leave a comment

Design a site like this with WordPress.com
Get started