{"id":2311,"date":"2023-01-15T19:24:45","date_gmt":"2023-01-16T02:24:45","guid":{"rendered":"https:\/\/www.itayemi.com\/blog\/?p=2311"},"modified":"2023-01-16T12:07:19","modified_gmt":"2023-01-16T19:07:19","slug":"setting-up-solaris-9-10-11-x86-64-on-qemu","status":"publish","type":"post","link":"https:\/\/www.itayemi.com\/blog\/2023\/01\/15\/setting-up-solaris-9-10-11-x86-64-on-qemu\/","title":{"rendered":"Setting up Solaris 9\/10\/11 x86\/64 on QEMU"},"content":{"rendered":"\n<pre class=\"wp-block-preformatted\">\r\nSetup Solaris 9\/10\/11 x86\/64 and Solaris 10 x86 on QEMU: \r\n--------------------------------------------------------\r\n\r\nBackground: I got the \"long\" qemu-system-x86_64 VM-creation command by using virt-install to create the VM and filtering the output of \"ps -ef | grep qemu-system\". Attempts to setup a Solaris 10 VM with a basic command resulted in the installation stuck in a reboot loop once it loads the kernel from the installation ISO.\r\nSample virt-install command: virt-install --name s10x64 --memory 4096 --vcpus 2 --disk \/s10x64\/s10x64.qcow2 --cdrom \/s10x64\/sol-10-u1-ga-x86-dvd-iso.iso --os-variant solaris10 --graphics vnc\r\n\n\r\nSetup the Ubuntu QEMU hypervisor host\r\n-------------------------------------\r\n\r\n- NOTE: this installed QEMU version 6.2.0 in \/usr\/sbin\/ which I won't be using.\r\nroot@itamint:~\/# apt update -y\r\nroot@itamint:~\/# apt -y install bridge-utils cpu-checker libvirt-clients virtinst libvirt-daemon libvirt-daemon-system qemu qemu-kvm \r\nroot@itamint:~\/# usermod -aG kvm root\r\nroot@itamint:~\/# newgrp kvm\r\nroot@itamint:~\/# systemctl enable libvirtd\r\nroot@itamint:~\/# systemctl start libvirtd\r\n\r\n\r\n- Setup VDE for networking:\r\nroot@itamint:~\/# apt install vde2\r\nroot@itamint:~\/# apt-get install libvdeplug-dev\r\n\r\n\r\n- Compile\/Install the latest  QEMU (version 7.2.0) with VDE enabled in \/usr\/local\/bin:\r\nroot@itamint:~\/# apt install -y gcc make ninja-build libglib2.0-dev libpixman-1-dev ncurses-dev\r\nroot@itamint:~\/# apt install -y libusb-dev libusb-1.0-0-dev libusbredirparser1 libusbredirhost1 usbutils\r\nroot@itamint:~\/# wget https:\/\/download.qemu.org\/qemu-7.2.0.tar.xz\r\nroot@itamint:~\/# tar xf qemu-7.2.0.tar.xz\r\nroot@itamint:~\/# cd qemu-7.2.0\r\nroot@itamint:~\/qemu-7.2.0# .\/configure --enable-vde --enable-libusb\r\nroot@itamint:~\/qemu-7.2.0# make\r\nroot@itamint:~\/qemu-7.2.0# make install\r\n\r\n---------- End Of QEMU host setup -----------------------------\r\n\r\n\r\n- Setup a network (VDE) switch that VMs are logically connected to:\r\n\r\n- Create a VDE switch and assign it an IP address which will be the gateway of VMs (note that it goes away if you reboot the host):\r\nroot@itamint:~\/# vde_switch -tap vde0 -daemon\r\nroot@itamint:~\/# ip link set dev vde0 up\r\nroot@itamint:~\/# ip route add 10.0.2.0\/24 dev vde0\r\nroot@itamint:~\/# echo 1 > \/proc\/sys\/net\/ipv4\/conf\/vde0\/proxy_arp\r\n\r\n\r\n- Internet access to the VMs (execute on the QEMU hypervisor host) where wlp5s0 is the WAN NIC on the Ubuntu QEMU host:\r\nroot@itamint:~\/# echo 1 > \/proc\/sys\/net\/ipv4\/ip_forward\r\nroot@itamint:~\/# iptables -t nat -A POSTROUTING -o wlp5s0 -j MASQUERADE\r\nroot@itamint:~\/# iptables -I FORWARD 1 -i vde0 -j ACCEPT\r\nroot@itamint:~\/# iptables -I FORWARD 1 -o vde0 -m state --state RELATED,ESTABLISHED -j ACCEPT\r\n\r\n---------- End of VDE network switch setup --------------------\r\n\r\n- Location of PC BIOS (\"-L \/path\/to\/dir\"). Same file, but first is from the QEMU 7.2.0 and second is from the seabios Ubuntu package.\r\nroot@itamint:~# find \/usr -iname bios-256k.bin\r\n\/usr\/local\/share\/qemu\/bios-256k.bin\r\n\/usr\/share\/seabios\/bios-256k.bin\r\n\r\n\r\n\r\n- Create a Solaris 9 VM and install the O\/S from the ISO:\r\n---------------------------------------------------------\r\n\r\nroot@itamint:\/s9x86# qemu-img create -f qcow2 s9x86.qcow2 20G\r\nroot@itamint:\/s9x86# \/usr\/local\/bin\/qemu-system-x86_64 -L \/usr\/local\/share\/qemu\/ -name guest=s9x86,debug-threads=on -machine pc,usb=off -accel kvm -cpu host,migratable=on -m 4096 -smp 2,sockets=2,cores=1,threads=1 -nodefaults -global kvm-pit.lost_tick_policy=delay -no-hpet -no-shutdown -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot strict=on -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x4.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x4 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 -device VGA,id=video0,vgamem_mb=32,bus=pci.0,addr=0x2 -hda \/s9x86\/s9x86.qcow2 -boot d --cdrom \/s9x86\/sol-9-u8-ga-x86-dvd.iso -device i82801,netdev=net0,mac=52:54:00:e6:5d:16,bus=pci.0,addr=0x3 -netdev vde,id=net0\r\n\r\n- NOTE: with bridge\/tap\/vde variants of e1000 NIC did not work. The arp table on the QEMU host shows \"incomplete\" for the MAC address of the VM, and no communication is possible. With NIC model i82801, it works properly. The NIC is detected by Solaris 9 as \"PCI: Intel i815\/82559 Ethernet\" , interface name iprb0 in Solaris. This is a 10\/100Mbps NIC.\r\n\r\n\r\n- connect to the installation using a VNC client such as MobaXterm or realVNC or tigerVNC to complete the installation process.\r\n- NOTE: if you choose the auto-reboot option, the system will reboot again from the CD at the end of the install. Break\/Cancel the QEMU command then launch the VM from the O\/S boot disk e.g.,\r\nroot@itamint:\/s9x86# \/usr\/local\/bin\/qemu-system-x86_64 -L \/usr\/local\/share\/qemu\/ -name guest=s9x86,debug-threads=on -machine pc,usb=off -accel kvm -cpu host,migratable=on -m 4096 -smp 2,sockets=2,cores=1,threads=1 -nodefaults -global kvm-pit.lost_tick_policy=delay -no-hpet -no-shutdown -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot strict=on -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x4.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x4 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 -device VGA,id=video0,vgamem_mb=32,bus=pci.0,addr=0x2 -hda \/s9x86\/s9x86.qcow2 -device i82801,netdev=net0,mac=2a:e8:ec:b2:1f:7b,bus=pci.0,addr=0x3 -netdev vde,id=net0\r\n\r\n\r\n- First boot after install, if using MobaXterm VNC client, switch it to \"Full Screen\" otherwise the desktop\/login won't display properly. Once you login, you can use to skip installation of the \"Java Enterprise System\" after which the system will reboot again. Once you login again, you will be prompted to choose either CDE or Gnome 2.0 desktop.\r\n\r\n- Optionally disable CDE (GUI): \r\nbash-2.05# \/usr\/dt\/bin\/dtconfig -d\r\nbash-2.05# mv \/etc\/rc2.d\/S99dtlogin \/etc\/rc2.d\/DISABLE_s99dtlogin\r\n\r\n\r\n- Edit \/etc\/ssh\/sshd_config file in the VM and change \"PermitRootLogin no\" to \"PermitRootLogin yes\" (do not do in Production environment)\r\n- restart SSHD with the command \"kill -HUP  &lt;sshd-pid>\"\r\n\r\n- SSH to the VM from the Ubuntu QEMU host (10.0.2.150 is what I assigned to the VM during setup):\r\nroot@itamint:~# ssh -oHostKeyAlgorithms=+ssh-rsa -oKexAlgorithms=+diffie-hellman-group1-sha1 -c 3des-cbc root@10.0.2.150\r\n\r\n- NOTE: once the VM has network access, you can start it with the \"--daemonize\" so it detaches from the SHELL session on the QEMU host.\r\n\r\n------------- End of Solaris 9 setup --------------------------------\r\n\r\n\r\n\r\n- Create a Solaris 10 VM and install the O\/S from the ISO:\r\n----------------------------------------------------------\r\n\r\nroot@itamint:\/s9x86# qemu-img create -f qcow2 \/s10x64\/s10x64.qcow2 20G \r\nroot@itamint:\/s9x86# \/usr\/local\/bin\/qemu-system-x86_64 -L \/usr\/local\/share\/qemu\/ -name guest=s10x64,debug-threads=on -machine pc,usb=off -accel kvm -cpu host,migratable=on -m 4096 -smp 2,sockets=2,cores=1,threads=1 -nodefaults -global kvm-pit.lost_tick_policy=delay -no-hpet -no-shutdown -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot strict=on -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x4.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x4 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 -device VGA,id=video0,vgamem_mb=32,bus=pci.0,addr=0x2 -hda \/s10x64\/s10x64.qcow2 -boot d --cdrom \/root\/s10x86\/sol-10-u8-ga-x86-dvd.iso -device e1000,netdev=net0,mac=52:54:00:e6:4d:15,bus=pci.0,addr=0x3 -netdev vde,id=net0\r\n\r\n- Connect to the installation using a VNC client such as MobaXterm or realVNC or tigerVNC to complete the installation process.\r\n\r\n- NOTE: if you choose the auto-reboot option, the system will reboot again from the CD at the end of the install. Break\/Cancel the QEMU command then launch the VM from the O\/S boot disk e.g.,\r\nroot@itamint:~\/s10x86# \/usr\/local\/bin\/qemu-system-x86_64 -L \/usr\/local\/share\/qemu\/ -name guest=s10x64,debug-threads=on -machine pc,usb=off -accel kvm -cpu host,migratable=on -m 4096 -smp 2,sockets=2,cores=1,threads=1 -nodefaults -global kvm-pit.lost_tick_policy=delay -no-hpet -no-shutdown -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot strict=on -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x4.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x4 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 -device VGA,id=video0,vgamem_mb=32,bus=pci.0,addr=0x2 -hda \/s10x64\/s10x64.qcow2 -device e1000,netdev=net0,mac=52:54:00:e6:4d:15,bus=pci.0,addr=0x3 -netdev vde,id=net0\r\n\r\n- First boot after install, if using MobaXterm VNC client, switch it to \"Full Screen\" otherwise the desktop\/login won't display properly.\r\n\r\n- optionally disable CDE (GUI). \r\nbash-3.00# \/usr\/dt\/bin\/dtconfig -d\r\nbash-3.00# svcadm disable cde-login\r\nbash-3.00#\r\n\r\n- Edit \/etc\/ssh\/sshd_config file in the VM and change \"PermitRootLogin no\" to \"PermitRootLogin yes\" (do not do in Production environment)\r\n- restart SSHD with the command \"svcadm restart sshd\"\r\n\r\n- SSH to the VM from the Ubuntu QEMU host (10.0.2.105 is what I assigned to the VM during setup):\r\nssh -oKexAlgorithms=+diffie-hellman-group-exchange-sha1  -o HostKeyAlgorithms=ssh-rsa root@10.0.2.105\r\n\r\n- NOTE: once the VM has network access, you can start it with the \"--daemonize\" so it detaches from the SHELL session on the QEMU host.\r\n\r\n------------- End of Solaris 10 setup -------------------------------\r\n\r\n\r\n\r\n\r\n- Create a Solaris 11 VM and install the O\/S from the ISO:\r\n----------------------------------------------------------\r\n\r\nroot@itamint:~\/s10x86# mkdir \/s11x64\r\nroot@itamint:~\/s10x86# qemu-img create -f qcow2 \/s11x64\/s11x64.qcow2 8G\r\nroot@itamint:~\/s10x86# cd \/s11x64\/\r\nroot@itamint:\/s11x64# ls\r\ns11x64.qcow2  sol-11-1111-text-x86.iso\r\nroot@itamint:\/s11x64# \/usr\/local\/bin\/qemu-system-x86_64 -L \/usr\/local\/share\/qemu\/ -name guest=s11x64,debug-threads=on -machine pc,usb=off -accel kvm -cpu host,migratable=on -m 4096 -smp 2,sockets=2,cores=1,threads=1 -nodefaults -global kvm-pit.lost_tick_policy=delay -no-hpet -no-shutdown -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot strict=on -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x4.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x4 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 -device VGA,id=video0,vgamem_mb=32,bus=pci.0,addr=0x2 -hda \/s11x64\/s11x64.qcow2 -boot d --cdrom \/s11x64\/sol-11-1111-text-x86.iso -device e1000,netdev=net0,mac=52:54:00:e7:4e:16,bus=pci.0,addr=0x3 -netdev vde,id=net0\r\n\r\n- Connect to the installation using a VNC client such as MobaXterm or realVNC or tigerVNC to complete the installation process.\r\n\r\n- NOTE: if you choose the auto-reboot option, the system will reboot again from the CD at the end of the install. Break\/Cancel the QEMU command then launch the VM from the O\/S boot disk e.g.,\r\nroot@itamint:\/s11x64# \/usr\/local\/bin\/qemu-system-x86_64 -L \/usr\/local\/share\/qemu\/ -name guest=s11x64,debug-threads=on -machine pc,usb=off -accel kvm -cpu host,migratable=on -m 4096 -smp 2,sockets=2,cores=1,threads=1 -nodefaults -global kvm-pit.lost_tick_policy=delay -no-hpet -no-shutdown -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot strict=on -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x4.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x4 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 -device VGA,id=video0,vgamem_mb=32,bus=pci.0,addr=0x2 -hda \/s11x64\/s11x64.qcow2 -device e1000,netdev=net0,mac=52:54:00:e7:4e:16,bus=pci.0,addr=0x3 -netdev vde,id=net0\r\n\r\n- After the install, I had to manually create \/etc\/hostname.net0 \r\necho \"s11x64\" > \/etc\/hostname.net0\r\n\r\n- SSH to the VM from the Ubuntu QEMU host (10.0.2.160 is what I assigned to the VM during setup):\r\nssh -oKexAlgorithms=+diffie-hellman-group-exchange-sha1  -o HostKeyAlgorithms=ssh-rsa itababa@10.0.2.160\r\n\r\n- NOTE: once the VM has network access, you can start it with the \"--daemonize\" so it detaches from the SHELL session on the QEMU host.\r\n\r\n------------- End of Solaris 11 setup -------------------------------\r\n \r\n\r\n\r\nSome useful Commands:\r\n---------------------\r\n\r\n- 7 commands to get info about processors in Solaris: \r\npsrinfo -pv ; isalist ; kstat -p cpu_info ; kstat -m cpu_info ; prtdiag -v  ; prtpicl -v  ;  smbios\r\n\r\n\r\n- Get list of supported OS types\/variants \r\nroot@kvm:~# virt-install --os-variant list\r\n\r\n\r\n- Flush ARP table in Linux:\r\nip -s -s neigh flush all\r\n\r\n\r\n- Destroy a VM created by virt-install\r\nroot@itamint:~# virsh list --all\r\nroot@itamint:~# virsh destroy s10x64\r\nroot@itamint:~# virsh undefine s10x64\r\n\r\n\r\nhttps:\/\/support.oracle.com\/knowledge\/Sun%20Microsystems\/1444358_1.html\r\nhttps:\/\/www.unix.com\/unix-for-dummies-questions-and-answers\/9130-removing-cde-openwindows.html\r\n\r\n\r\n\r\n- Virtually mount a Solaris VM disk image:\r\n  modprobe nbd max_part=8\r\n  qemu-nbd --connect=\/dev\/nbd0 \/s9x86\/s9x86.qcow2\r\n  fdisk \/dev\/nbd0 -l\r\n  mkdir \/tmp\/sol\r\n  mount \/dev\/nbd0p5 \/tmp\/sol\r\n  ls \/tmp\/sol\/\r\n\r\nNOTE: the mountable slices may be different e.g., p1, p5, etc.\r\n\r\n- to disconnect the device:\r\n  umount \/tmp\/sol\r\n  qemu-nbd  --disconnect \/dev\/nbd0\r\n\r\n\r\n\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Setup Solaris 9\/10\/11 x86\/64 and Solaris 10 x86 on QEMU: &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; Background: I got the &#8220;long&#8221; qemu-system-x86_64 VM-creation command by using virt-install to create the VM and filtering the output of &#8220;ps -ef | grep qemu-system&#8221;. Attempts to setup a &hellip; <a href=\"https:\/\/www.itayemi.com\/blog\/2023\/01\/15\/setting-up-solaris-9-10-11-x86-64-on-qemu\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":336,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1404,1403,1376,1398,1400,1399,1397,1402,1401],"class_list":["post-2311","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-i82801","tag-netdev","tag-qemu","tag-solaris-10","tag-solaris-11","tag-solaris-9","tag-sparc","tag-vde-switch","tag-virt-install"],"_links":{"self":[{"href":"https:\/\/www.itayemi.com\/blog\/wp-json\/wp\/v2\/posts\/2311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itayemi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itayemi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itayemi.com\/blog\/wp-json\/wp\/v2\/users\/336"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itayemi.com\/blog\/wp-json\/wp\/v2\/comments?post=2311"}],"version-history":[{"count":2,"href":"https:\/\/www.itayemi.com\/blog\/wp-json\/wp\/v2\/posts\/2311\/revisions"}],"predecessor-version":[{"id":2314,"href":"https:\/\/www.itayemi.com\/blog\/wp-json\/wp\/v2\/posts\/2311\/revisions\/2314"}],"wp:attachment":[{"href":"https:\/\/www.itayemi.com\/blog\/wp-json\/wp\/v2\/media?parent=2311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itayemi.com\/blog\/wp-json\/wp\/v2\/categories?post=2311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itayemi.com\/blog\/wp-json\/wp\/v2\/tags?post=2311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}