Running AIX 7.2 TL3SP1 on x86_64 via qemu-system-ppc64

Who would not wish to run the best operating system on earth on his pity Intel Laptop ? I will describe here what I have done with the help of others and share some of my findings and recommendations how to get this going.

For this exercise Im using Linux Mint 19 x86_64 and current qemu compiled from source which you can get from here https://github.com/qemu/qemu

One should get the similar output from the compilation

$ git clone git://git.qemu.org/qemu.git
$ cd gemu 
$ mkdir build
$ cd build
$ ../configure
$ make
$ su 
# make install 
# exit 
$  qemu-system-ppc64 --version
QEMU emulator version 3.0.50 (v3.0.0-614-g19b599f766-dirty)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers

So once we have qemu installed we can then move on to get an actual AIX ISO, which I cannot obviously share, but I will link some already made documentation how to get it done if you already have a Power environment with AIX on

https://www.ibm.com/developerworks/community/blogs/cgaix/resource/AIX_QEMU_blog.pdf?lang=en_us

Next I will share my tun-tap scripts as well as the installer loader and normal loader scripts for the AIX

Here is my standard Linux networking script that I use for various VMs and simulators (VirtualBox, Alphavm-free, simh, hercules )

#Setup tap and bridge 
tunctl -t tap0 -u user
ifconfig tap0 up
brctl addbr br0
brctl addif br0 enp0s25 vboxnet0 
brctl setfd br0 0
ifconfig enp0s25 10.0.2.1 up 
ifconfig br0 10.0.2.2 netmask 255.255.255.0 broadcast 10.0.2.255 up
brctl addif br0 tap0 vboxnet0 
ifconfig tap0 0.0.0.0
sysctl net.ipv4.ip_forward=1
iptables -A FORWARD --in-interface enp0s25 -j ACCEPT
iptables --table nat -A POSTROUTING --out-interface wlp9s0 -j MASQUERADE

Please change accordingly to your need, enp0s25 is eth0, wlp9s0 is wlan0 that is internet connected.

Here is a slightly modified /etc/qemu-ifup

#! /bin/sh
# Script to bring a network (tap) device for qemu up.
# The idea is to add the tap device to the same bridge
# as we have default routing to.

# in order to be able to find brctl
PATH=$PATH:/sbin:/usr/sbin
ip=$(which ip)

if [ -n "$ip" ]; then
ip link set "$1" up
else
brctl=$(which brctl)
if [ ! "$ip" -o ! "$brctl" ]; then
echo "W: $0: not doing any bridge processing: neither ip nor brctl utility not found" >&2
exit 0
fi
ifconfig "$1" 0.0.0.0 up
fi

switch=$(ip route ls |
awk '/^default / {
for(i=0;i<NF;i++) { if ($i == "dev") { print $(i+1); next; } }
}'
)

switch=br0

# only add the interface to default-route bridge if we
# have such interface (with default route) and if that
# interface is actually a bridge.
# It is possible to have several default routes too
for br in $switch; do
if [ -d /sys/class/net/$br/bridge/. ]; then
if [ -n "$ip" ]; then
ip link set "$1" master "$br"
else
brctl addif $br "$1"
fi
exit # exit with status of the previous command
fi
done

echo "W: $0: no bridge for guest interface found" >&2

Next is my AIX 7.2 TL3SP1 installation loader script

qemu-system-ppc64 -cpu POWER8 -machine pseries -m 2048 -serial stdio -drive file=disk.img,if=none,id=drive-virtio-disk0 -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=drive-virtio-disk0 -cdrom aix.iso -prom-env "boot-command=dev / 0 0 s\" ibm,aix-diagnostics\" property boot cdrom:\ppc\chrp\bootfile.exe -s verbose" -net nic -net tap -display vnc=:1

And here is the simulation loader script

qemu-system-ppc64 -cpu POWER8 -machine pseries -m 2048 -serial stdio -drive file=disk.img,if=none,id=drive-virtio-disk0 -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=drive-virtio-disk0 -cdrom aix.iso -prom-env boot-command='boot disk: ' -net nic -net tap -display vnc=:1

My disk.img is a standard qcow2 compressed image format (100 G)

Once the system is installed ( please use this reference https://www.ibm.com/developerworks/community/blogs/cgaix/resource/AIX_QEMU_blog.pdf?lang=en_us )

Be patient once it all loads (takes approx 5 minutes on my Panasonic CF-53 ToughBook  with Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz

Following are my additional steps that I have done after loggin in the first time after install (the /etc/motd is my own custom one)

AIX 7.2 networking

# ifconfig en0 10.0.2.10 up
# route add 0 10.0.2.2 
# chdev -l inet0 -a hostname=asterix
Add following to 

# echo "nameserver 8.8.8.8" > /etc/resolv.conf 

To make it persistent created a scritp in /etc/network.sh

#!/bin/ksh
echo "nameserver 8.8.8.8" > /etc/resolv.conf
ifconfig en0 10.0.2.10 up
route add 0 10.0.2.2

And made it executable of course

# chmod +x /etc/network.sh

Then added last entry to /etc/inittab so next time we boot, network works

customnet:2:once:/etc/network.sh 2>&1

Test the above, reboot the machine by issuing halt command an re-loading it.

Important thing to notice here – do not use the -serial stdio interface in your terminal for normal work. CTRL-C will kill the qemu simulation and thats something you don’t want. So setup sshd instead (I have allowed remote root user for simplicitys sake here) and connect to your guest AIX via ssh from the Linux host !

Connect to the AIX guest (you can then make as many ssh sessions as needed, once AIX guest is booted its quite fast to use taking into consideration all Power8 instructions are simulated by qemu)

Here are the details about the guest AIX

AIX Version 7
Copyright IBM Corporation, 1982, 2018.
Console login: root
root's Password: 

Welcome to AIX 7.2 running via Qemu-system-ppc64 in X86_64 
-------------------------------------------------------------
Last unsuccessful login: Sat Nov 3 13:04:35 CET 2018 on /dev/vty0 from localhost
Last login: Sun Nov 4 20:12:27 CET 2018 on /dev/pts/1 from 10.0.2.2

[root@asterix ~]# prtconf 
System Model: IBM pSeries (emulated by qemu)
Machine Serial Number: Not Available
Processor Type: PowerPC_POWER8
Processor Implementation Mode: POWER 8
Processor Version: PV_8_Compat
Number Of Processors: 1
Processor Clock Speed: 1000 MHz
CPU Type: 64-bit
Kernel Type: 64-bit
LPAR Info: 0 aix_on_kvm
Memory Size: 2048 MB
Good Memory Size: 2048 MB
Platform Firmware level: Not Available
Firmware Version: SLOF,aik
Console Login: enable
Auto Restart: true
Full Core: false
NX Crypto Acceleration: Not Capable

Network Information
Host Name: asterix
IP Address: 
Sub Netmask: 
Gateway: 10.0.2.2
Name Server: 
Domain Name: 

Paging Space Information
Total Paging Space: 512MB
Percent Used: 1%

Volume Groups Information
============================================================================== 
Active VGs
============================================================================== 
rootvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk0 active 799 649 159..122..48..160..160
============================================================================== 

INSTALLED RESOURCE LIST

The following resources are installed on the machine.
+/- = Added or deleted from Resource List.
* = Diagnostic support not available.

Model Architecture: chrp
Model Implementation: Uni-Processor, PCI bus

+ sys0 System Object
+ sysplanar0 System Planar
* vio0 Virtual I/O Bus
* vscsi0 Virtual SCSI Client Adapter
* cd0 Virtual SCSI Optical Served by VIO Server
* ent0 Virtual I/O Ethernet Adapter (l-lan)
* vsa0 LPAR Virtual Serial Adapter
* vty0 Asynchronous Terminal
* pci0 PCI Bus
* scsi0 qemu_virtio-scsi-pci:0000:00:02.0 Virtio SCSI Client Adapter (f41a0800)
* hdisk0 qemu_virtio-scsi-pci:0000:00:02.0-LW_0 MPIO Other Virtio SCSI Disk Drive
+ L2cache0 L2 Cache
+ mem0 Memory
+ proc0 Processor

Configure YUM

Please read the documentation here about how to setup the environment
https://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/ezinstall/ppc/README-yum

Since we have no tools yet installed I will use my Linux Host machine to download all the needed RPMs and then copy them to AIX guest via scp

// On the Linux Host machine 
$ mkdir AIX 
$ cd AIX 
$ wget https://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/ezinstall/ppc/yum_bundle.tar

// On the AIX guest 
# mkdir /tmp/RPM
# cd /tmp/RPM
# scp user@10.0.2.2:/home/user/AIX/yum_bundle.tar . 
# tar -xv yum_bundle.tar

Install RPMs on the AIX guest

# cd /tmp/RPM
# rpm -ivh ca-certificates-2016.10.7-2.aix6.1.ppc.rpm
# rpm -ivh curl-7.52.1-1.aix6.1.ppc.rpm
# rpm -ivh db-4.8.24-3.aix6.1.ppc.rpm
# rpm -ivh gdbm-1.8.3-5.aix5.2.ppc.rpm
# rpm -ivh gettext-0.19.7-1.aix6.1.ppc.rpm
# rpm -ivh glib2-2.14.6-2.aix5.2.ppc.rpm
# rpm -ivh readline-6.1-2.aix6.1.ppc.rpm
# rpm -ivh sqlite-3.15.2-1.aix6.1.ppc.rpm
# rpm -ivh python-2.7.10-1.aix6.1.ppc.rpm
# rpm -ivh python-devel-2.7.10-1.aix6.1.ppc.rpm
# rpm -ivh python-iniparse-0.4-1.aix6.1.noarch.rpm
# rpm -ivh python-pycurl-7.19.3-1.aix6.1.ppc.rpm
# rpm -ivh python-tools-2.7.10-1.aix6.1.ppc.rpm
# rpm -ivh python-urlgrabber-3.10.1-1.aix6.1.noarch.rpm
# rpm -ivh pysqlite-1.1.7-2.aix6.1.ppc.rpm
# rpm -ivh yum-metadata-parser-1.1.4-2.aix6.1.ppc.rpm
# rpm -ivh yum-3.4.3-5.aix6.1.noarch.rpm

Now YUM is ready to install some tools

# yum install tcsh 
# yum install gcc

If there are problems with RPM db afterwards, simply rebuild it

# rpm --rebuilddb

I do not know how to work in Korn shell (default) too much so I have installed tcsh

# yum install tcsh

And setup the environment to use it  /etc/passwd entry for root

root:!:0:0::/home/root:/usr/bin/tcsh

And then configure tcsh prompt for the root user

# cd /home/root 
# cat .cshrc 
set prompt = '[%n@%m %c]# '

PKGSRC Q3-2018 test

Next I have tested pkgsrc build, please make sure you read the following https://wiki.netbsd.org/pkgsrc/how_to_use_pkgsrc_on_aix/

# ftp ftp.netbsd.org 
230 Guest login ok, access restrictions apply.
ftp> pas
Passive mode on.
ftp> bin
200 Type set to I.
ftp> cd /pub/pkgsrc/pkgsrc-2018Q3
ftp> get pkgsrc.tar.gz

# mv pkgsrc.tar.gz /tmp
# cd /tmp
# gunzip pkgsrc.tar.gz 
# tar -xvf pkgsrc.tar
# setenv CC /opt/freeware/bin/gcc 
# cd pkgsrc/bootsrap
# ./bootstrap

After bootstrap make sure we declare the following variables in TCSH

# setenv CC /opt/freeware/bin/gcc
# setenv USE_NATIVE_GCC yes

Then we can build pkgsrc packages as follows

# /usr/pkg/bin/bmake install clean

P.S

What does not work

  •  Bash (bash_64 cpu 95%)
  •  Wget – core dump
  •  Ruby (cpu 95%)
  •  ps (core dump) – using topas instead   (another workaround is to use /usr/sysv/bin/ps which is a RISC System/6000 binary, so you can move /usr/bin/ps away and symlink the above ) Thanks Russ !
  •  vmstat – using topas instead

Update on why things do not work 11.11.2018 

The problem is that on AIX binaries usually come in two forms – 32 bit ((RISC System/6000)   and 64-bit XCOFF  these files are usually identified as filename_32 and filename_64 under /opt/freeware/bin for example. Inside you get symlinks to either the 32 or 64 version of the file, so keep in mind that under Qemu not all 64-bit XCOFF binaries work as expected and some coredump. To fix this you need to change the symlinks to point to 32bit versions ( this fixes ruby, bash, wget, curl etc) however not the ps command since that is shipped by the OS as 64bit version only.

Video presentation is located here

About astr0baby

Please run Adblock or similar... we have been told to do so since Carl Sagan wrote the Contact .
This entry was posted in Uncategorized. Bookmark the permalink.

105 Responses to Running AIX 7.2 TL3SP1 on x86_64 via qemu-system-ppc64

  1. Phill says:

    Why not use smitty mktcpip to set up the AIX network interface and dns resolution the standard way instead of a work-around?

    • astr0baby says:

      Yeah .. I know, even though I have worked on many AIX systems I never really liked Smitty … but good point, smitty works in the emulation just fine.

      • darkfader says:

        smitty is just a layer on top on some intermediary commands on top of the actual commands.
        so there’s most certainly some chattr you can run instead of bothering with smitty :-)

      • astr0baby says:

        Yes, definitely, I do not like smitty actually, but most AIX admins are hammered to use it since child-hood :)

  2. Russ says:

    AIX ships with a sysv verson of ps, this works OK and might do as a workaround for some situations. Just use the path /usr/sysv/bin/ps.

  3. Pingback: Valuable News – 2018/12/08 | 𝚟𝚎𝚛𝚖𝚊𝚍𝚎𝚗

  4. golemwashere says:

    Hello,
    I have issues with the latest 7.2 GA installation with latest qemu-system-ppc64, the qcow2 disk is seen by the openfirmware but not by AIX , I have no available disks destinations.
    I am using
    -drive file=/data/disk.img,if=none,id=drive-virtio-disk0 \
    -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=drive-virtio-disk0 \

    seen as
    Populating /pci@800000020000000/scsi@2
    SCSI: Looking for devices
    100000000000000 DISK : “QEMU QEMU HARDDISK 2.5+”

    do you need to load some special drivers?
    Thanks
    g.

    • astr0baby says:

      You need to run AIX 7.2 TL3SP1 minimum, as the kernel in this Technology Level and Service Pack contains the needed virtio support.

      • golemwashere says:

        Thanks!
        I was using first AIX DVD instead of the huge AIX_v7.2_Install_7200-03-02-1846_flash_112018.iso which looks like it has neede drivers.
        I managed to install and bring up en0 on a tap device.
        FTP works fine but I have issues with openssh :
        connections always fail with ssh_dispatch_run_fatal: Connection to xxxx port 22: incorrect signature.

        I tried messing with KeyHex and Cypher algorithms in sshd_config.
        I tried regenerating ssh keys.
        I tried to downgrade openssh from OpenSSH_7.5.102.1600, to OpenSSH_7.5.102.1100 or OpenSSH_6.0.0.6204 but no luck
        I was considering downgrading openssl ( current version is 1.0.2.1601 )
        but there are some dependencies I’d rather not touch
        Do you have any suggestion?

      • astr0baby says:

        OpenSSH worked for me with no problems, I will spin-up the VM today and send you the software versions so you can check.

      • astr0baby says:

        Can you run your ssh connection with more verbosity ? ssh -vv
        Here are my OpenSSH and OpenSSL versions on the AIX side

        [root@asterix ~]# lslpp -L | grep ssh
        openssh.base.client 7.5.102.1500 CE F Open Secure Shell Commands
        openssh.base.server 7.5.102.1500 CE F Open Secure Shell Server
        openssh.man.en_US 7.5.102.1500 C F Open Secure Shell
        openssh.msg.en_US 7.5.102.1500 C F Open Secure Shell Messages –
        libssh2 1.8.0-3 C R A library implementing the
        libssh2-devel 1.8.0-3 C R Development files for libssh2
        [root@asterix ~]# lslpp -L | grep ssl
        openssl.base 1.0.2.1500 CE F Open Secure Socket Layer
        openssl.license 1.0.2.1500 C F Open Secure Socket License
        openssl.man.en_US 1.0.2.1500 C F Open Secure Socket Layer
        python-passlib 1.7.1-1 C R comprehensive password hashing

  5. golemwashere says:

    Hello, Thanks a lot for support…
    I think I was having problems with my tap and br devices (I had put IP both on tap0 and br0) …
    and having IPs on the same network for multiple devices might have confused ssh.
    I have you same exact versions.

    Starting from scratch I managed to reach by ssh the aixonqemu ip from the host mac
    but I can’t reach anything from inside to outside.

    currently I have qemu starting with
    -net nic -net tap
    this is creating a tap0 device

    on linux (latest Centos7),
    my first interface with its default gateway is ens192 on network 1.1.1.0/24 vlan1 and I wish to use my other interface ens224 on network 2.2.2.0/24 vlan2 (addresses changed to protect the innocent)

    this is what I am currently doing to configure br0

    ifconfig tap0 up
    brctl addbr br0
    brctl addif br0 tap0
    brctl addif br0 ens224
    brctl setfd br0 0
    ifconfig ens224 up
    ifconfig br0 up
    ifconfig br0 2.2.2.5 netmask 255.255.255.0

    on aixonqemu I configured en0 with 2.2.2.2 and that is reachable by the linux host
    (but not any other host in vlan2 , while hosts in lan reach 2.2.2.5)
    a tcpdump on en0 is showing all broadcast traffic for vlan2
    but from inside aixonqemu
    but I can’t reach anything but 2.2.2.5

    I think I need some masquerading with iptables,
    I tried something as

    iptables -A FORWARD -i tap0 -o ens192 -j ACCEPT
    iptables -t nat -A POSTROUTING -o ens192 -j MASQUERADE
    iptables -A FORWARD -i tap0 -o ens192 -m state –state ESTABLISHED,RELATED -j ACCEPT
    pls forgive my n00bness on tap and br0 devices,
    do you have any suggestion?

    • astr0baby says:

      Lets make this simple :)
      Below is the simplest network config you should use

      tunctl -t tap0 -u user
      ifconfig tap0 up
      brctl addbr br0
      brctl addif br0
      brctl setfd br0 0
      ifconfig br0 10.0.2.2 netmask 255.255.255.0 broadcast 10.0.2.255 up
      brctl addif br0 tap0
      ifconfig tap0 0.0.0.0
      sysctl net.ipv4.ip_forward=1
      iptables –table nat -A POSTROUTING –out-interface wlan0 -j MASQUERADE

      Explanation:
      bridge0 : 10.0.2.2 (would be the gateway for the aixonqemu

      Inside aixonqemu
      en0 : 10.0.2.10 (add default route 10.0.2.2 and DNS 8.8.8.8 or whatever else)

      Make sure we also portforward to the internet (I use wlan0 on my laptop so you need to adjust to whatever is your internet connected device) thus :

      sysctl net.ipv4.ip_forward=1
      iptables –table nat -A POSTROUTING –out-interface wlan0 -j MASQUERADE

  6. golemwashere says:

    dude you’re THE MAN!
    using br0 ip address on aixonqemu as gateway and masquerading on ens192 ( wlan0 ) works fine!
    now I could also install and use yum, bash (32bit) , etc
    Still not grokking much the tap0 / br0 stuff , I wished you could just publish on a layer2 interface the internal aix IP.
    My next fun would be testing samba on aix through some iptables portfowarding from my wlan0 interface.
    Thanks a lot again for insight!

  7. Milton Cipamocha says:

    Hello
    i have the following issue: Trying to load: -s verbose from: /vdevice/v-scsi@71000003/disk@8200000000000000:\ppc\chrp\bootfile.exe … Successfully loaded

    AIX
    StarLED{814}
    All the time, doesn’t work

    can you help me please?

  8. The model of the laptop, affects something?.
    I ran it on a Thinkpad T520, with Centos 7

  9. LinuxRobto says:

    I have problem with
    #Setup tap and bridge
    tunctl -t tap0 -u user
    ifconfig tap0 up
    brctl addbr br0
    brctl addif br0 enp0s25 vboxnet0
    brctl setfd br0 0
    ifconfig enp0s25 10.0.2.1 up
    ifconfig br0 10.0.2.2 netmask 255.255.255.0 broadcast 10.0.2.255 up
    brctl addif br0 tap0 vboxnet0
    ifconfig tap0 0.0.0.0
    sysctl net.ipv4.ip_forward=1
    iptables -A FORWARD –in-interface enp0s25 -j ACCEPT
    iptables –table nat -A POSTROUTING –out-interface wlp9s0 -j MASQUERADE
    Already chanage enp0s25 to eth0 but still does not work.
    The error say: It does not exist.
    Any issues please kindly help!!

    • astr0baby says:

      you have bridgeutils installed ?, also please remove the vboxnet0 from the brctl command (you probably do not want that if you do not
      wish to add vboxnet0 to the br0)

  10. MJ says:

    Hey astrobaby,

    Can you release for download your qemu disk image file with aix 7.2 installed?
    Im stuck with the basic shell of the diagnostic disk and I dont have a aix 7.2 to generate a mksysb from :(

  11. MJ says:

    Yeah, I remember a long time ago I tried rsync over ssh and it was painfully slow because of the encryption overhead of ssh.

  12. MJ says:

    Confirmed that /dev/random was introduced in AIX 5.2:

    “The AIX 5.2 base security provides new pseudo random number generator devices, /dev/random and /dev/urandomM, pseudo-device driver and configuration routines that select various hardware device interrupts to provide entropy. OpenSSH in AIX 5.2 is compiled to take advantage of the new device /dev/urandom. You will also need the latest OpenSSL version, openssl-0.9.6e-2.aix4.3.ppc.rpm (AIX Linux Toolbox), for OpenSSH to use the /dev/urandom device.”

    source: https://www.ibm.com/developerworks/systems/articles/openssh_updated.html

  13. MJ says:

    Hey Astr0, why you used POWER8 instead of POWER9?

  14. MJ says:

    I’m not sure,
    I’m asking because that in the reference guide that you linked, they have used POWER9. Thinking in simulation simplicity we can also use POWER7.

    I will bench to see.

    • astr0baby says:

      I have never used P9 really … would be great to see if P7 would boot the qemu-system-ppc64 has any speed advantage over P8 and P9. Would be great to know :)

  15. Marlon Anjos says:

    Hey @ast0baby, I tested the simulation using various processors and there are little difference in performance:

    Time to boot (AIX mksysb ISO)
    Power 7: 4m38s
    Power 8: 4m44s
    Power 9: 4m50s

  16. linuxgeek says:

    Hi astrobaby,

    is it possible to add additional disks with the above configuration. It will be helpful in creating new VGs

    • astr0baby says:

      Certainly, you need to create blanks first in your hosting system (Linux) via qemu-img create -f qcow2 … then add the disk path to the qemu loader script (assign proper SCSI id)
      Possibly like this
      -drive file=new.img,if=none,id=drive-virtio-disk1 -device virtio-scsi-pci,id=scsi1 -device scsi-hd,drive=drive-virtio-disk1

      Here is an example of the booting such config

      root@panasonic:/home/user/KVM/PPC/AIX72# cat test-4G.sh
      ./qemu-system-ppc64-old -cpu POWER8 -machine pseries -m 4096 -serial stdio -drive file=disk.img,if=none,id=drive-virtio-disk0 -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=drive-virtio-disk0 -drive file=new.img,if=none,id=drive-virtio-disk1 -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=drive-virtio-disk1 -cdrom aix.iso -prom-env boot-command=’boot disk: ‘ -net nic -net tap -display vnc=:1
      root@panasonic:/home/user/KVM/PPC/AIX72# ./test-4G.sh
      qemu-system-ppc64-old: -device virtio-scsi-pci,id=scsi: Duplicate ID ‘scsi’ for device
      root@panasonic:/home/user/KVM/PPC/AIX72# vi test-4G.sh
      root@panasonic:/home/user/KVM/PPC/AIX72# ./test-4G.sh

      SLOF **********************************************************************
      QEMU Starting
      Build Date = Jan 14 2019 18:00:39
      FW Version = git-a5b428e1c1eae703
      Press “s” to enter Open Firmware.

      Populating /vdevice methods
      Populating /vdevice/vty@71000000
      Populating /vdevice/nvram@71000001
      Populating /vdevice/l-lan@71000002
      Populating /vdevice/v-scsi@71000003
      SCSI: Looking for devices
      8200000000000000 CD-ROM : “QEMU QEMU CD-ROM 2.5+”
      Populating /pci@800000020000000
      00 0000 (D) : 1234 1111 qemu vga
      00 0800 (D) : 1033 0194 serial bus [ usb-xhci ]
      00 1000 (D) : 1af4 1004 virtio [ scsi ]
      Populating /pci@800000020000000/scsi@2
      SCSI: Looking for devices
      100000000000000 DISK : “QEMU QEMU HARDDISK 2.5+”
      00 1800 (D) : 1af4 1004 virtio [ scsi ]
      Populating /pci@800000020000000/scsi@3
      SCSI: Looking for devices
      100000000000000 DISK : “QEMU QEMU HARDDISK 2.5+”
      Installing QEMU fb
      ….etc ….

      Then in AIX you can verify via lsdev

      hdisk0 Available 00-10 MPIO Other Virtio SCSI Disk Drive
      hdisk1 Available 00-18 MPIO Other Virtio SCSI Disk Drive

  17. linuxgeek says:

    I get the below error.
    qemu-system-ppc64: -device virtio-scsi-pci,id=scsi: Duplicate ID ‘scsi’ for device
    Below is the script i am using.
    qemu-system-ppc64 -cpu POWER7 -machine pseries -m 3072 -serial stdio -drive file=AIX72.img,if=none,id=drive-virtio-disk0 -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=drive-virtio-disk0 -drive file=AIX73.img,if=none,id=drive-virtio-disk1 -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=drive-virtio-disk1 -cdrom Aix72.iso -prom-env boot-command=’boot disk: ‘

    • linuxgeek says:

      Spotted the mistake. New to using qemu-kvm.

      qemu-system-ppc64 -cpu POWER7 -machine pseries -m 3072 -serial stdio -drive file=AIX72.img,if=none,id=drive-virtio-disk0 -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=drive-virtio-disk0 -drive file=AIX73.img,if=none,id=drive-virtio-disk1 -device virtio-scsi-pci,id=scsi1 -device scsi-hd,drive=drive-virtio-disk1 -cdrom Aix72.iso -prom-env boot-command=’boot disk:’

  18. linuxgeek says:

    I am running this on qemu-kvm providing 3G of memory in Lenovo G50. I am using Power 7 as I get some warnings or error like TCG support problem in Power8/9. The performance is fine but I am feeling the slowness in command execution. Perhaps I should try running it with my desktop by upgrading it to 8G memory to see the performance.

  19. linuxgeek says:

    Hi astrobaby,

    When I am trying to user four disks, the booting process stops and comes out. Is there any limitations on the disk being used. Below is the script I am using. It stops in the midway with below codes to the prompt.
    0539
    078c
    0539
    2071
    2071
    2071

    qemu-system-ppc64 -cpu POWER7 -machine pseries -m 3072 -serial stdio -drive file=AIX72.img,if=none,id=drive-virtio-disk0 -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=drive-virtio-disk0 -drive file=AIX73.img,if=none,id=drive-virtio-disk1 -device virtio-scsi-pci,id=scsi1 -device scsi-hd,drive=drive-virtio-disk1 -drive file=AIX74.img,if=none,id=drive-virtio-disk2 -device virtio-scsi-pci,id=scsi2 -device scsi-hd,drive=drive-virtio-disk2 -drive file=AIX75.img,if=none,id=drive-virtio-disk3 -device virtio-scsi-pci,id=scsi3 -device scsi-hd,drive=drive-virtio-disk3 -cdrom Aix72.iso -prom-env boot-command=’boot disk:’

    • astr0baby says:

      I tried this with 2 disks, it works fine. Not sure if there is any limitation in Qemu for this (doubt there is since the virtio-scsi controller can have up to 256 “targets”). Does it work with 2 and 3 ?

  20. linuxgeek says:

    Yes. Sometimes it works with 3 disks, but also fails with the same configuration.

    • linuxgeek says:

      While executing the command. it shows the sign ^@ while the command is running. I didn’t see it in your videos.

      # lsvg rootvg
      ^@VOLUME GROUP: rootvg VG IDENTIFIER: 00000000000000000000016b97bc6ee7
      VG STATE: active PP SIZE: 256 megabyte(s)

      • astr0baby says:

        Im using an older qemu-system-ppc64 build, the new ones are buggy for AIX. My version that works well is QEMU emulator version 3.0.50 (v3.0.0-614-g19b599f766-dirty)
        try to get this one via git

  21. linuxgeek says:

    Configured networking based on your script. The tun/tap configuration is not static. When I shutdown the system it disappears. While using ssh shell it looks normal, I dont see the ^@. Weird. Thanks for your response.

  22. maxitshz says:

    Hello following your example however with installation DVD without success

    log:

    FAILURES
    ——–
    Filesets listed in this section failed pre-installation verification
    and will not be installed.

    Missing Filesets
    —————-
    The following filesets could not be found on the installation media.
    If you feel these filesets really are on the media, check for typographical
    errors in the name specified or, if installing from directory, check for
    discrepancies between the Table of Contents file (.toc) and the images that
    reside in the directory.

    devices.pci.f41a0011
    devices.pci.qemu.std-vga
    devices.pci.scsi
    devices.pci.usb
    devices.pci.vga
    devices.vdevice.l-lan
    devices.vdevice.nvram
    devices.vdevice.qemu.spapr-nvram
    devices.vdevice.v-scsi
    devices.vdevice.vty
    devices.vrtscsi
    devices.vscsi.disk

    <>

    installp: APPLYING software for:
    bos.sysmgt.serv_aid 7.2.3.16

    0518-307 odmdelete: 0 objects deleted.
    Successfully updated the Kernel Authorization Table.
    Successfully updated the Kernel Role Table.
    Successfully updated the Kernel Command Table.
    Successfully updated the Kernel Device Table.
    Successfully updated the Kernel Object Domain Table.
    Successfully updated the Kernel Domains Table.
    Successfully updated the Kernel RBAC log level.
    Successfully updated the Kernel Authorization Table.
    Successfully updated the Kernel Role Table.
    Successfully updated the Kernel Command Table.
    Successfully updated the Kernel Device Table.
    Successfully updated the Kernel Object Domain Table.
    Successfully updated the Kernel Domains Table.
    Successfully updated the Kernel RBAC log level.
    bos.sysmgt.serv_aid.config[28]: 3408358 Segmentation fault(coredump)
    bos.sysmgt.serv_aid.config[51]: 3408368 Segmentation fault(coredump)
    instal: Failed while executing the bos.sysmgt.serv_aid.config script.

    0503-464 installp: The installation has FAILED for the “root” part
    of the following filesets:
    bos.sysmgt.serv_aid 7.2.3.16

    installp: Cleaning up software for:
    bos.sysmgt.serv_aid 7.2.3.16

    ./bos.sysmgt.serv_aid.unconfig[21]: 3801426 Segmentation fault
    ./bos.sysmgt.serv_aid.unconfig[24]: 2818348 Segmentation fault
    /usr/lib/ras/dumpcheck[3]: 3408132 Segmentation fault
    rmitab: 0481-207 The ident field specified does not exist.
    /etc/drivers/coreprobe.ext is not loaded.
    cleanup: Failed while executing the ./bos.sysmgt.serv_aid.unconfig script.

    0503-464 installp: The installation has FAILED for the “root” part
    of the following filesets:
    bos.sysmgt.serv_aid 7.2.3.16
    Finished processing all filesets.
    System Installation Time: 2 hrs 54 mins Tasks Complete: 93%

    Set_Bootlist: Could not set the bootlist to:
    hdisk0 .
    The boot device must be set in the host KVM.
    Press 1 to continue: Set_Bootlist: Could not set the bootlist to:
    hdisk0 .
    The boot device must be set in the host KVM.
    Press 1 to continue: Set_Bootlist: Could not set the bootlist to:
    hdisk0 .
    The boot device must be set in the host KVM.
    Press 1 to continue:

    • astr0baby says:

      Try creating a clean installation ISO on your NIM server. Im not entirely sure what the bos.sysmgt.serv_aid package is for
      You can see it coredumps at a certain level
      bos.sysmgt.serv_aid.config[28]: 3408358 Segmentation fault(coredump)
      bos.sysmgt.serv_aid.config[51]: 3408368 Segmentation fault(coredump)
      Did you try to boot the dist afterwards ?

  23. linuxgeek says:

    is there any way to get additional network interfaces in AIX. My desktop has 2 NIC cards. If I run this disk in it, Will I be able to get those NIC in the OS. Also is there any way to get Virtual NIC so that I will be glad to learn etherchannel concepts.

  24. viktormadarasz says:

    I obtained AIX 7.2 Base Image ( AIX_V7.2_Base_Install_7200-00-00_DVD_1_of_2_122015.udf ) but when I boot with the install loader script I get stuck at

    ( 300 ) Data Storage Exception [ 7dc622b8 ]

    https://paste.fedoraproject.org/paste/K1HxPr~6kziXJCpa7xY8BA

  25. Beaver says:

    Wondering what can be problem with my QEMU. Installation went fine (I used MKSYSB converted to ISO but other than that it is pretty much same as everyone else) and AIX boot will stop on swapon of paging device:

    System runtime mode is now OPERATIONAL MODE.
    Setting tunable parameters…complete
    Starting Multi-user Initialization
    Performing auto-varyon of Volume Groups
    Activating all paging spaces
    0517-075 swapon: Paging device /dev/hd6 is already active.

    After this it just do nothing. Tried increasing amount of cores, switching back and forth between P7-P9, increased RAM size to 3 GB and nothing seems to be helping. Using QEMU 4.2.1 and AIX 7.2-4.2.

    • astr0baby says:

      Try to get the git master qemu branch (build it on your system) and test. If you have issues let me know.

      • Beaver says:

        Problem identified as 64bit version of fsck. Booted to system recovery mode and copied the 32bit version over the fsck64. So far so good :)

      • astr0baby says:

        Yeah .. there are a few xcoff 64 bit binaries that crash under Qemu so you need to replace them with 32bit ones .. (I just remembered
        that it took some time to pimp the image so it would more or less run fine in emulation)

  26. Hi, i’m only getting 100Mb/s from the network, is there anyway to fix this?

  27. K-Steve says:

    Hello astr0baby.
    I am trying to get python work in my emulated AIX 7.2.
    the aixtools one fails because of the 64 bit issue. I then went for the bull free rpm packages.
    unfortunately some packages also failed with segmentation fault.
    Any idea how to get Python work ?

    • astr0baby says:

      Hi Steve,

      what you need to do is to find a 32bit binaries equivalent to the 64bit ones that crash under Qemu AIX 7.2
      This is what I did back then with the aixtools to get yum going

      Make sure you get the yum_bundle.tar from IBM FTP site

      # mkdir /tmp/RPM
      # cd /tmp/RPM
      # scp user@10.0.2.2:/home/user/AIX/yum_bundle.tar .
      # tar -xv yum_bundle.tar

      # rpm -ivh ca-certificates-2016.10.7-2.aix6.1.ppc.rpm
      # rpm -ivh curl-7.52.1-1.aix6.1.ppc.rpm
      # rpm -ivh db-4.8.24-3.aix6.1.ppc.rpm
      # rpm -ivh gdbm-1.8.3-5.aix5.2.ppc.rpm
      # rpm -ivh gettext-0.19.7-1.aix6.1.ppc.rpm
      # rpm -ivh glib2-2.14.6-2.aix5.2.ppc.rpm
      # rpm -ivh readline-6.1-2.aix6.1.ppc.rpm
      # rpm -ivh sqlite-3.15.2-1.aix6.1.ppc.rpm
      # rpm -ivh python-2.7.10-1.aix6.1.ppc.rpm
      # rpm -ivh python-devel-2.7.10-1.aix6.1.ppc.rpm
      # rpm -ivh python-iniparse-0.4-1.aix6.1.noarch.rpm
      # rpm -ivh python-pycurl-7.19.3-1.aix6.1.ppc.rpm
      # rpm -ivh python-tools-2.7.10-1.aix6.1.ppc.rpm
      # rpm -ivh python-urlgrabber-3.10.1-1.aix6.1.noarch.rpm
      # rpm -ivh pysqlite-1.1.7-2.aix6.1.ppc.rpm
      # rpm -ivh yum-metadata-parser-1.1.4-2.aix6.1.ppc.rpm
      # rpm -ivh yum-3.4.3-5.aix6.1.noarch.rpm

  28. newitops says:

    my qemu is 5.10.0,aix iso is AIX_7.1_Base_Operating_System_TL_7100-02-02_DVD_1_of_2_32013_hh.iso,
    the vm Cannot install,Execution error:

    ——————————————————————————-
    Welcome to AIX.
    boot image timestamp: 18:20:27 02/04/2013
    processor count: 1; memory size: 2048MB; kernel size: 36254653
    boot device: /vdevice/v-scsi@71000003/disk@8200000000000000:\ppc\chrp\bootfile.exe
    AIX kernel debugger setting: enabled
    ——————————————————————————-
    Star
    AIX Version 7.1
    Trying to read invalid spr 280 (0x118) at 00000000005a9a3c
    Trying to read invalid spr 280 (0x118) at 000000000058b64c
    Illegal Trap Instruction Interrupt in Kernel
    05A10ACC tweqi r0,0 r0=0
    KDB(0)>

    Can you help me? What’s the reason

  29. yipply says:

    my qemu is 5.20.0
    aix iso is AIX_v7.2_Base_Install_DVD_1_of_2_TL_7200-01-02_042017.iso,
    the vm Cannot install,Execution error:
    ——————————————————————————-
    Trying to load: -s verbose from: /vdevice/v-scsi@71000003/disk@8200000000000000:\ppc\chrp\bootfile.exe … Successfully loaded
    W3411: Client application returned.
    E3406: Client application returned an error.
    Type ‘boot’ and press return to continue booting the system.
    Type ‘reset-all’ and press return to reboot the system.
    Ready!
    0 >
    ——————————————————————————-
    Can you help me? What’s the reason?thanx!

    • astr0baby says:

      It won’t work with AIX 7.2 TL1SP2 – you will need to get AIX 7.2 TL3SP1 or newer – your copy cannot work under qemu because the AIX kernel does not support it

  30. Ivan says:

    As of today (with a very recent qemu patch that is being tested) AIX 7.2 TL 5 runs out of the box with “qemu-system-ppc64 -accel=tcg” without the need for any hacking around (no more need to hack fsck64, vanilla /usr/bin/ps works.. etc). It was an obscure bug in TCG (the “emulator”) which had issues with code being called both in 32bit and 64bit addressing modes.

    • astr0baby says:

      Oh nice ! Thanks for sharing the info, I will try it for sure.

    • astr0baby says:

      Its not really clear which patches I need to apply to the qemu for the above to work – did you try this yourself ?

      • Ivan says:

        It’s not in github yet.. but the message in the comment indicates the patch which applies and allows AIX to work fine (actually, another patch is also needed – but it’s a makeshift patch which just hides a problem…) :
        ***COPY FROM HERE***
        diff –git a/include/tcg/tcg.h b/include/tcg/tcg.h
        index 504c5e9bb0..68e139c62d 100644
        — a/include/tcg/tcg.h
        +++ b/include/tcg/tcg.h
        @@ -275,7 +275,7 @@ typedef struct TCGPool {

        #define TCG_POOL_CHUNK_SIZE 32768

        -#define TCG_MAX_TEMPS 512
        +#define TCG_MAX_TEMPS 32768
        #define TCG_MAX_INSNS 512

        /* when the size of the arguments of a called function is smaller than
        ***TO HERE..***
        From the root of the source tree, do a “patch -p1 < (the above)"

  31. Bruno Novak says:

    With AIX 7.2 TL3 and above patch is the same behaviour with ps and other affected commands (coredumped). Is this problem with TL or did I do what wrong?

  32. Bruno Novak says:

    My Failure. I have only tcg.h patch but not this one from link.

    • Ivan says:

      Actually, with the latest git pull from github, the change to tcg.h (the increase of TCG_MAX_TEMPS) is no longer necessary.

  33. viktormadarasz says:

    I’d love to get my hands on AIX 7.2 TL 5 iso and give it a go with the latest pull from github
    I remember the last time i tried this it was pretty slow.. i wonder if it got better now that it does not require any tweaks….

    feel free to pm me at viktor@tsr-podcast.com

    • Ricardo Esteves says:

      Unfortunately still quite slow, network also very slow, tried also PowerrHA and most of the times gets stuck when trying to sync the cluster :(

      • astr0baby says:

        Slow in what exactly ? Running AIX in Qemu is not a way to do AIX clustering – it is more of lab experiment – again if you network is slow you must be doing something wrong.

    • astr0baby says:

      Network is fast – you must be doing something wrong

      • Ricardo Esteves says:

        I don’t know exactly what might be wrong, i have other VMs running under qemu with RHEL7 and they don’t have any network problems, and they are under the same bridge interface.

        I run iperf from the RHEL7 VM to the bridge ip address and i get 18372 Mbits/sec,
        while running from the AIX VM i get 63.8 Mbits/sec.

      • astr0baby says:

        Ahh – ok 63.8 Mb/s is not bad :) gain this is no way production ready simulation for AIX – for basic stuff – security tests – understanding AIX it is sufficient I believe.

    • astr0baby says:

      and no I dont do PM and please do not ask for a copy.

  34. Craconia says:

    Hi. Thanks for this excellent post. I will try it soon! Do you have any idea why would IBM include virtio drivers in AIX’s kernel? Are they more open now to the idea of letting people “play” with AIX for testing/learning purposes on non-POWER systems?

  35. Alex says:

    Hi astr0baby!
    Thank you very much for the great article!
    Astr0, one thing I would like to know… Do you think it is possible to run AIX on QEMu using a NVMe partition from host machine?
    I mean, let’s say that you have an NVMe SSD, you install Linux on the first partition of this NVMe SSD, and you create a 20GB unformatted partition (/dev/nvme0n1p2). Would it be possible to passthrough this partition to the QEMU guest (AIX in this case) instead of using the traditional SCSI drive?
    If possible, could you show us how the installation loader script should look like?
    Thank you in advance, master!

  36. Frank says:

    Hi,
    I have AIX 7.2 running on Ubuntu 18.04 host on which I have a USB HD with a VolumeGroup created on it, with x Logical Volumes.

    I want to be able to create a VG under AIX 72 using this USB HD and then create the LVs.

    Any pointers on how to get the USB HD working. I tried -usb -usbdevice devname but that no longer works, and tried usb-uas with no luck either.

    Any help would be greatly appreciated

  37. Ken S. says:

    The 64-bit execution bug for AIX was fixed and released in QEMU version 6.1.0, but you need to apply this patch to qemu-6.1.0 to fix another AIX/QEMU issue that will halt your IPL:

    diff -ru a/accel/tcg/tcg-accel-ops-mttcg.c b/accel/tcg/tcg-accel-ops-mttcg.c
    — a/accel/tcg/tcg-accel-ops-mttcg.c 2021-11-22 14:13:13.947499200 -0500
    +++ b/accel/tcg/tcg-accel-ops-mttcg.c 2021-11-22 14:14:01.059588700 -0500
    @@ -82,7 +82,7 @@
    *
    * cpu->halted should ensure we sleep in wait_io_event
    */
    – g_assert(cpu->halted);
    + /* g_assert(cpu->halted); */
    break;
    case EXCP_ATOMIC:
    qemu_mutex_unlock_iothread();

    Also, for those that use virtio-net-pci for SLiRP like me, you will need to use the QEMU parameter “-M pseries-3.0” to work around a bug introduced in 3.1.0 which changed the way IRQs are assigned (-M pseries will otherwise point to the default pseries-6.1 machine def)

Leave a reply to linuxgeek Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.