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

Running Solaris 5.9 (sparc) on qemu-system-sparc in Linux x86_64 (Mint 19)

$
0
0

This is going to be a straight forward continuation of the last Solaris article about qemu-system-sparc emulation (32bit SPARC) which I have covered here https://astr0baby.wordpress.com/2018/09/22/running-solaris-2-6-sparc-on-qemu-system-sparc-in-linux-x86_64-mint-19/ 

Good source of information is Artyom Tarasenko’s blog entry about Solaris SPARC and qemu http://tyom.blogspot.com/2009/12/solaris-under-qemu-how-to.html

We are going to continue with the Solaris 5.9  or better known as Solaris 9 for SPARC architecture emulation on x86_64 Linux and qemu-system-sparc

I will describe how I got the system to install using the previous Solaris 5.6 installed disk images, in order to save time creating the disk partitions from scratch (which was a bit of a challenge with 5.6)

My version of Qemu is as follows

$ qemu-system-sparc --version
QEMU emulator version 3.0.91 (v3.1.0-rc1-16-g83c496599c-dirty)
Copyright (c) 2003-2018 Fabrice Bellard and the QEMU Project developers

What we will obviously need is the Solaris 9 SPARC installation ISO media.  Here you can get the Solaris 9 9/05 DVD ISO -> https://ufile.io/9qscc

My QEMU 32bit SPARC environment looks like this  and I will explain exact steps that I took to install it

-rw-r--r--  1 user user 2386624512 Jan 27 01:25 disk2.6.img
-rw-r--r--  1 root root 1261174784 Sep 25 00:15 disk2.7.img
-rw-r--r--  1 user user 3733192704 Feb 23 01:42 disk2.9.img
-rwxr-xr-x  1 user user        195 Sep 24 21:40 run-2.6.sh
-rwxr-xr-x  1 root root        195 Sep 24 22:30 run-2.7.sh
-rwxr-xr-x  1 root root        134 Feb 23 01:07 run-2.9-install.sh
-rwxr-xr-x  1 user user        134 Feb 23 01:07 run-2.9.sh
-rw-r--r--  1 user user  565862400 Feb 21  2010 solaris-2.6-sparc.iso
-rw-r--r--  1 root root  647471104 Feb 21  2010 solaris-2.7-sparc.iso
-rw-r--r--  1 root root 3104112640 Feb 22 23:26 solaris-2.9-sparc.iso
-rw-rw-r--  1 user user     262144 Sep 19 21:24 ss5.bin

Next we will configure the networking and the /etc/qemu-ifup script.  Networking script can be saved in the emulation directory and needs to be executed with root privileges prior running qemu (you should adjust to your needs here -> enp0s25 is eth0 and wlp9s0 is wlan0 )  lets call this network.sh

#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

Here is my slightly modified /etc/qemu-ifup script

#! /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

I usually setup the internal network in emulated Solaris as follows then:

  • interface: 10.0.2.10
  • gateway : 10.0.2.2
  • nameserver: 8.8.8.8

INSTALLING SOLARIS 9

The run-2.9-install.sh script is as follows

qemu-system-sparc -L . -m 256 -M SS-5  -hda ./disk2.9.img -cdrom ./solaris-2.9-sparc.iso -net nic -net tap  -boot d  -display vnc=:1

Use your VNC client to connect to :1 to interact with the emulation then

The disk2.9.img is a QCOW2 image from the previous Solaris 2.6 installation which we can use (please follow the https://astr0baby.wordpress.com/2018/09/22/running-solaris-2-6-sparc-on-qemu-system-sparc-in-linux-x86_64-mint-19/) to create one or start from scratch…

# qemu-img info disk2.9.img
image: disk2.9.img
file format: qcow2
virtual size: 36G (38654705664 bytes)
disk size: 3.5G
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false

We are not using the ss5.bin firmware file anymore, since qemu-system-sparc can handle Solaris 9 SPARC quite well without it, for GUI we will use qemu inbuilt VNC

The installation is again straight forward (do not upgrade the system from 5.6 to 5.9 but rather initialize the disk during setup and use default options)

Once we get this installed (takes some time, be patient) we can use the following script to boot the system from disk  – Use your VNC client to connect to :1

qemu-system-sparc -L . -m 256 -M SS-5 -hda ./disk2.9.img -cdrom ./solaris-2.9-sparc.iso -net nic -net tap -boot c -display vnc=:1

So now we should have a fully working latest Solaris 9 9/05 which can be reachable via 10.0.2.10 for example with ssh or telnet or ftp … and operated via VNC :1

A default installation of Solaris 9 of course leaves many “unsecure” and obsolete daemons exposed, so just for the heck of it here is an Nmap scan

Solaris9 is way much better to work with than any other Unix systems I came across :)

Also do not forget to configure your DNS resolver as follows (Google and Cloudflare DNS)

# echo "nameserver 8.8.8.8 \nnameserver 1.1.1.1" > > /etc/resolv.conf

# vi /etc/nsswitch.conf
hosts: files dns

# pkill -HUP inet

Here is a short video of the actual emulation


Viewing all articles
Browse latest Browse all 183

Trending Articles