Quantcast
Channel: Astr0baby's not so random thoughts _____ rand() % 100;
Viewing all articles
Browse latest Browse all 183

Running HP-UX 11.11 on qemu-system-hppa

$
0
0

Last of the major commercial UNIX systems that I wanted to see emulated is the legendary HP-UX (Hewlett Packard Unix)  (more information on the Wikipedia https://en.wikipedia.org/wiki/HP-UX )  And since last week we had the Gregorian Calendar Easter and today we have the Julian Calendar Easter it is a symbolic Resurrection  of HP-UX

The emulated machine is a HP B160L desktop machine

It was quite a surprise when I noticed  Sven Schnelle (https://github.com/svenschnelle) mention that HP-UX now runs under qemu-system-hppa, so I wanted to test and try it of course.

https://parisc.wiki.kernel.org/index.php/Qemu

I am running all my emulation experiments solely on Linux x86_64 (Linux Mint 19.1) and all the networking support is strictly Linux only so if you wish to reproduce this on macOS or Windows you are on your own there.

I have git-cloned recent qemu from ( https://github.com/qemu/qemu)  and built only the  hppa emulation (you can build the whole thing of course)

$ mkdir -p $HOME/KVM/HPUX
$ cd $HOME/KVM/HPUX
$ git clone https://github.com/qemu/qemu.git
$ cd qemu 
$ ./configure --target-list=hppa-softmmu
$ make 

Copy the compiled qemu-system-hppa binary to your working directory

$ cd $HOME/KVM/HPUX
$./qemu-system-hppa --version 
QEMU emulator version 3.1.93 (v4.0.0-rc3-4-g13c24edaa7-dirty)
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers

So now we are almost ready with the installation, but before that we need to make sure a couple of per-requisites are met. Main thing is of course the installation media which was ( HP-UX B.11.11) found in the deep corners of the internet ..

CD1 https://drop.me/MY0mqq
CD2 https://drop.me/MzP4Ry
CD3 https://drop.me/opL13Z
CD4 https://drop.me/M0yxgZ

For the conveniences sake I have called the HP-UX 11.11 ISOs as follows (place them in your working directory that holds qemu-system-hppa binary as well as the disk images, etc)

-rw-rw-r-- 1 user user 642865152 Apr 28 00:43 hpux11-01.iso
-rw-rw-r-- 1 user user 357793792 Apr 28 00:51 hpux11-02.iso
-rw-rw-r-- 1 user user 648380416 Apr 28 00:57 hpux11-03.iso
-rw-rw-r-- 1 user user 309100544 Apr 28 00:55 hpux11-04.iso

Next we need to make sure the qemu networking is setup (tun/tap and bridge)  Below is my network sharing script one needs to execute under root prior the emulation

#Setup tap and bridge 
tunctl -t tap0 -u user
ifconfig tap0 up
brctl addbr 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

Note:Seems that networking support is not implemented yet in qemu-system-hpp following is in the to-do list  (https://parisc.wiki.kernel.org/index.php/Qemu )

  • Emulate Lasi (i82596) and Tulip (DEC 21×40) network cards in Qemu

Next make sure you have the following /etc/qemu-ifup  script in place

#! /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 we need to define a disk image (HP-UX 11.11 will need a full raw disk image, default qemu-img create -f qcow2 hpux.img 8G will NOT WORK !)

$ cd $HOME/KVM/HPUX
$ dd if=/dev/zero of=hpux.img bs=1024 count=8M

Next we define the HP-UX installation loader script to make things easier

$ cd $HOME/KVM/HPUX
./qemu-system-hppa -boot d -serial telnet::4441,server -drive if=scsi,bus=0,index=6,file=./hpux.img,format=raw -serial mon:stdio -D /tmp/foo -nographic -m 512 -d nochain -cdrom ./hpux11-01.iso -D /tmp/foo -net nic -net tap

OK So we are almost ready, but just one last thing before we fire up the installation (We all love green don’t we ?) get yourself the super cool retro-terminal from here https://github.com/Swordfish90/cool-retro-term  Im using it in my examples below in case you wonder from where the screenshots come from ( Remember the good old terminal days when things seemed simple ?)

So lets start the HP-UX 11.11 emulation now

root@panasonic:/home/user/KVM/HPUX/HP-UX-11.11# ./install.sh 
qemu-system-hppa: -serial telnet::4441,server: info: QEMU waiting for connection on: disconnected:telnet:0.0.0.0:4441,server
QEMU 3.1.93 monitor - type 'help' for more information
(qemu)

You need to connect to the qemu telnet server via a good terminal emulator (retro-terminal is quite good)

$ telnet localhost 4441

After a shor time you will get kicked into the installation menu if all went right

Select Additional Software what you want to get installed (mind we only created 8GB disk)

Now we need patiance, since it can take some time (1hr – 2 hrs depending on what we chose to install)  to finsh.

Eventually it will finish

We will need to provide a CD2 installation image now

(qemu) change scsi0-cd2 ./hpux11-02.iso

The installer will continue now

Sweet CDE installing now

Once the CD2 finishes we get instructed to insert CD3

(qemu) change scsi0-cd2 ./hpux11-03.is

And the installer will continue

Yet again we get promped for the last CD4

(qemu) change scsi0-cd2 ./hpux11-04.iso

And the installer will continue again

And finally it will FINISH !

We will need to change the loader script for qemu-system-hppa to tell it to boot the new disk instead of the CD

./qemu-system-hppa -boot c -serial telnet::4441,server -drive if=scsi,bus=0,index=6,file=./hpux.img,format=raw -serial mon:stdio -D /tmp/foo -nographic -m 512 -d nochain -cdrom ./hpux11-01.iso -D /tmp/foo -net nic -net tap

Now again this will take some time to get through first boot; populating /dev/; setting up post-installation scripts etc .. so be patient

Note that the setup-process will take long to process CIM Repository ( This is something that is observed by others on real HW HP-UXes ( https://community.hpe.com/t5/Server-Management-Systems/Why-does-it-take-so-long-to-build-the-CIM-repository-on-HPUX/td-p/4931711)   You can just CTRL+C if you don’t want to wait – I did

It will shortly go for shutdown procedure (with a nasty FAILURE message since we broke the CIM Repository setup) but it does not matter, just load the simulation again

./qemu-system-hppa -boot c -serial telnet::4441,server -drive if=scsi,bus=0,index=6,file=./hpux.img,format=raw -serial mon:stdio -D /tmp/foo -nographic -m 512 -d nochain -cdrom ./hpux11-01.iso -D /tmp/foo -net nic -net tap

This time it will start booting properly

And we will be greeted with System options menu to configure (GeoCustoms)

Finally we land up in network configuration menu

Press [y]

Choose [n] since we will setup networking manually

Choose [y]

Choose hostname : UNIX    (feel free to experiment here, but there are some pretty wild rules for defining 8char$  max hostname)

Setup your time zones, root password..

Next we setup our IP – I have used 10.0.2.12 and define subnet and gateway IP  (IT WILL FAIL TO VERIFY)

Setup other networking parts

NETWORK WILL FAIL TO VERIFY

And finally it will continue booting ….

I guess some work after login needs these to address (networking)

Configure LAN interfaces …………………………………….. FAIL *
Starting HP-UX Secure Shell ………………………………….. FAIL *

Finally we land up in a root shell

# uname -a
HP-UX UNIX B.11.11 U 9000/778 2006243326 unlimited-user license
# 

And it looks like networking is not yet supported under qemu-system-hppa
https://parisc.wiki.kernel.org/index.php/Qemu

# ifconfig lan0
ifconfig: no such interface
# netstat -in
Name           Mtu Network            Address                 Ipkts      Opkts
lo0           4136 127.0.0.0          127.0.0.1                 166        166
# 

I will keep investigating this, since networking is an essential part of the whole simulation of HP-UX

Here are some notes I have gathered after the installation

To get rid of the annoying stuck message during boot process

NFS server (pid672@/net) not responding still trying

# /sbin/init.d/nfs.client stop
killing rpc.lockd
killing rpc.statd
killing biod
killing automount
# /sbin/init.d/nfs.server stop
# /sbin/init.d/nfs.core stop
stopping rpcbind

# cd /etc/rc.conf.d 
# ls -la nfs*
-r-xr--r-- 1 bin bin 2958 Apr 28 20:07 nfsconf
# 

Edit /etc/rc.confd.d/nfsconf  and change as follows

NFS_CLIENT=0
NFS_SERVER=0

Reboot

Here is a video demo of the HP-UX running under qemu


Viewing all articles
Browse latest Browse all 183

Trending Articles