Skip to main content

AIX VM on QEMU

Tutorials

QEMU commands

PowerPC System Board-specific

qemu-system-ppc64 --machine help
cobra@fedora-vm:~$ qemu-system-ppc64 --version

QEMU emulator version 8.2.6 (qemu-8.2.6-3.fc40)
Copyright (c) 2003-2023 Fabrice Bellard and the QEMU Project developers

Install AIX from CD-ROM

Create a VM

mkdir aix72VM
cd aix72VM
qemu-img create -f  qcow2  hdisk0.qcow2  20G

注意: AIX 版本必須 7200-03-00 以後版本才有支援。

aix_7200-04-00-1937_1of2_112019.iso

cd aix72VM
mv aix_7200-04-00-1937_1of2_112019.iso AIX72.iso

Boot from cd-rom

cd aix72VM

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 $PWD/AIX72.iso \
-prom-env "boot-command=boot cdrom:" \
-prom-env "input-device=/vdevice/vty@71000000" \
-prom-env "output-device=/vdevice/vty@71000000"

Type 1 and press Enter

aix_vm_1.png

Press Enter

aix_vm_2.png

Type 2

aix_vm_3.png

Type 4

aix_vm_4.png

Type 5

aix_vm_5.png

Type 0

aix_vm_6.png

Press Enter to install AIX

aix_vm_7.png

看到這畫面時,表示 AIX 作業系統已經完成安裝。

輸入 Ctrl + C 離開

aix_vm_8.png

Fix boot issue

Boot from cd-rom

cd aix72VM

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 $PWD/AIX72.iso \
-prom-env "boot-command=boot cdrom:" \
-prom-env "input-device=/vdevice/vty@71000000" \
-prom-env "output-device=/vdevice/vty@71000000"

Type 1 and press Enter

aix_vm_9.png

Press Enter

aix_vm_10.png

Type 3

aix_vm_11.png

Type 0

aix_vm_12.png

Type 1

aix_vm_13.png

Type 1

aix_vm_14.png

輸入修復開機指令

aix_vm_15.png

Fix boot issue

cd /sbin/helpers/jfs2
mv fsck64 fsck64.old
ln -s fsck fsck64

mv logredo64 logredo64.old
ln -s logredo logredo64

sync;sync;
halt

First boot from hdisk

cd aix72VM

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 $PWD/AIX72.iso \
-prom-env "boot-command=boot hdisk:" \
-prom-env "input-device=/vdevice/vty@71000000" \
-prom-env "output-device=/vdevice/vty@71000000"

Type vt100

aix_vm_16.png

Select: Accept License Agreements

Tips: 如果這裡的畫面出現沒有對齊的情況,且影響到後續的操作。按下 Ctrl + C 先中斷離開,將終端機的字形調更小,然後再重新執行步驟。

aix_vm_17.png

Select: Accept Software Maintenance Terms and Conditions

aix_vm_18.png

Select: Set root Password

Tip: 設定完密碼後,最後要選擇 Task Completed - Exit to Login。如果略過這,下次在開啟系統時,初始化的步驟仍會再出現。

aix_vm_19.png

用剛剛設定的 root 帳密登入

aix_vm_20.png

Post-tasks

- Disable some problematic services
rmitab diagd
rmitab rcnfs
rmitab aso
rmitab clcomd
rmitab pfcdaemon
stopsrc -s clcomd
stopsrc -s pfcdaemon
- Network setup

On Linux)

sudo ip tuntap add tap0 mode tap
sudo ip link set tap0 up
sudo ip a add 10.0.0.1/24 dev tap0

- Allow access to internet

sudo firewall-cmd --permanent --zone=public --add-interface=tap0
sudo firewall-cmd --permanent --add-masquerade
sudo firewall-cmd --reload

- Boot with network interface 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 $PWD/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"
qemu-system-ppc64 -cpu POWER8 \
  -machine pseries -m 4096 -serial mon: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 $PWD/AIX72.iso \
  -net nic -net tap,script=no,ifname=tap0 \
  -prom-env "boot-command=boot disk:" \
  -nographic

On AIX)

chdev -l en0 -a netaddr=10.0.0.2 -a netmask=255.255.255.0 -a state=up
route add 0 10.0.0.1
# Alternatively, using the following command instead 
/usr/sbin/mktcpip -h'aixvm' -a'10.0.0.2' -m'255.255.255.0' -i'en0' -g'10.0.0.1' -A'no' -t'N/A'

echo "nameserver 1.1.1.1" > /etc/resolv.conf
- Increase the filesystem size
lsdev -Cc disk
lscfg -vl hdisk0
chfs -a size=+1024M /home
chfs -a size=+2048M /opt
chfs -a size=+512M /tmp
chfs -a size=+2048M /usr
chfs -a size=+1024M /var
- Install OpenSSH
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
lssrc  -s  sshd
- Fix the RPM issue
error: cannot open Packages index using db4 - Invalid argument (22)
error: cannot open Packages database in /opt/freeware/packages
error: db4 error(22) from dbenv->open: Invalid argument

Solution: fixrpm.sh

#!/usr/bin/ksh

cd /opt/freeware
rm -f *.rpm.packages.tar
tar -chvf `date +"%d%m%Y"`.rpm.packages.tar packages
rm -f /opt/freeware/packages/__*
/usr/bin/rpm --rebuilddb

exit 0

Edit /etc/initab, insert the line after the rctcpip 

rctcpip:23456789:wait:/etc/rc.tcpip > /dev/console 2>&1 # Start TCP/IP daemons
fixrpm:23456789:once:/fixrpm.sh > /dev/null 2>&1 # Added by Alang
- Install AIX Toolbox

Download the files

cd /home/worktmp
uncompress openssl-1.1.2.2000.tar.Z
tar -xvf openssl-1.1.2.2000.tar
cd openssl-1.1.2.2000
installp -qaXFY -d . openssl.base openssl.license openssl.man.en_US
openssl version
cd /home/worktmp
rpm --rebuilddb
ksh dnf_aixtoolbox.sh -y
/opt/freeware/bin/dnf update
/opt/freeware/bin/dnf install bash
- Optional tasks

- Custom the prompt, create the profile /.profile

PS1="`whoami`@`hostname -s`:"'${PWD##*/}> '

- Timezone

smitty > System Environments > Change/Show Date and Time > Change Time Zone Using System

echo $TZ

其他管理工作

- 掛載 CD ISO 檔

修改qemu 啟動參數 -cdrom /path/to/your-cd.iso

qemu-system-ppc64 -cpu POWER8 \
  -machine pseries -m 4096 -serial mon: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 $PWD/AIX72.iso \
  -net nic -net tap,script=no,ifname=tap0 \
  -prom-env "boot-command=boot disk:" \
  -nographic

AIX 掛載指令

mount  -v  cdrfs  -o  ro  /dev/cd0  /mnt
- 增加第2顆虛擬硬碟

在 Linux 主機:新增 5G 虛擬磁碟 hdisk1.qcow2

cd aix72VM
qemu-img create -f qcow2 hdisk1.qcow2 5G

修改啟動指令,新增兩行參數

-drive file=hdisk1.qcow2,if=none,id=drive-virtio-disk1 \
-device scsi-hd,drive=drive-virtio-disk1 \

完整啟動參數

qemu-system-ppc64 -cpu POWER8 \
  -machine pseries -m 4096 -serial mon:stdio \
  -cdrom $PWD/AIX72.iso \
  -device virtio-scsi-pci,id=scsi \
  -drive file=hdisk0.qcow2,if=none,id=drive-virtio-disk0 \
  -device scsi-hd,drive=drive-virtio-disk0 \
  -drive file=hdisk1.qcow2,if=none,id=drive-virtio-disk1 \
  -device scsi-hd,drive=drive-virtio-disk1 \
  -net nic -net tap,script=no,ifname=tap0 \
  -prom-env "boot-command=boot disk:" \
  -nographic -smp 2