{"id":2308,"date":"2023-01-01T21:57:52","date_gmt":"2023-01-02T04:57:52","guid":{"rendered":"https:\/\/www.itayemi.com\/blog\/?p=2308"},"modified":"2023-01-01T21:57:52","modified_gmt":"2023-01-02T04:57:52","slug":"solaris-10-x86-vm-running-on-qemu-hypervisor-on-an-ubuntu-host","status":"publish","type":"post","link":"https:\/\/www.itayemi.com\/blog\/2023\/01\/01\/solaris-10-x86-vm-running-on-qemu-hypervisor-on-an-ubuntu-host\/","title":{"rendered":"Solaris 10 x86 VM running on Qemu hypervisor on an Ubuntu host"},"content":{"rendered":"\n<pre class=\"wp-block-preformatted\">Solaris 10 VM on QEMU running on a Ubuntu host\r\n==============================================\r\n\r\n- Login to the Ubuntu host and install QEMU:\r\n\r\nroot@ip-172-31-23-252:~# apt update -y\r\nroot@ip-172-31-23-252:~# apt install -y gcc make ninja-build\r\nroot@ip-172-31-23-252:~# wget https:\/\/download.qemu.org\/qemu-7.2.0.tar.xz\r\nroot@ip-172-31-23-252:~# tar xvf qemu-7.2.0.tar.xz\r\nroot@ip-172-31-23-252:~# cd qemu-7.2.0\/\r\nroot@ip-172-31-23-252:~\/qemu-7.2.0# apt install libglib2.0-dev\r\nroot@ip-172-31-23-252:~\/qemu-7.2.0# apt-get install -y libpixman-1-dev\r\nroot@ip-172-31-23-252:~\/qemu-7.2.0# apt install ncurses-dev\r\nroot@ip-172-31-23-252:~\/qemu-7.2.0# .\/configure\r\nroot@ip-172-31-23-252:~# make\r\nroot@ip-172-31-23-252:~# make install\r\n\r\n\r\n- Setup Networking (tap2 will be the NIC of the Solaris VM):\r\nroot@ip-172-31-23-252:\/wip# ip tuntap add tap2 mode tap  &amp;&amp;  ip link set dev tap2 up\r\n\r\n\r\n- Setup the host for routing (including Internet access from the Solaris VM). IP address 10.0.2.50 will be assigned to the Solaris VM.\r\nNOTE: it might be better to put this in a start-up script so it \"permanent\".\r\necho 1 > \/proc\/sys\/net\/ipv4\/conf\/tap2\/proxy_arp\r\nip route add 10.0.2.50 dev tap2\r\narp -Ds 10.0.2.50 eth0 pub\r\necho 1 > \/proc\/sys\/net\/ipv4\/ip_forward\r\niptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE\r\niptables -I FORWARD 1 -i tap2 -j ACCEPT\r\niptables -I FORWARD 1 -o tap2 -m state --state RELATED,ESTABLISHED -j ACCEPT\r\n\r\n\r\n- Create VM disk:\r\nroot@ip-172-31-23-252:\/wip# mkdir -p \/wip\/sol10x86\r\nroot@ip-172-31-23-252:\/wip# cd \/wip\/sol10x86\r\nroot@ip-172-31-23-252:\/wip\/sol10x86# qemu-img create -f qcow2 solaris-disk-amd64.img 10G\r\n\r\nroot@ip-172-31-23-252:\/wip\/sol10x86# wget https:\/\/ftp.deu.edu.tr\/pub\/Solaris\/iso\/Solaris-10,8_11\/sol-10-u10-ga2-x86-dvd.iso\r\n\r\n- Create and Start the VM booting from the DVD (QEMU launches a VNC server running on 127.0.0.1:5900 for example):\r\nroot@ip-172-31-23-252:\/wip\/sol10x86# qemu-system-x86_64 -name s10qemu -m 4G -cdrom sol-10-u10-ga2-x86-dvd.iso -boot d -hda solaris-disk-amd64.img -net nic,model=e1000,macaddr=7a:30:2a:cd:d0:1c -net tap,script=no,ifname=tap2,downscript=no\r\n\r\n- for Solaris 11, boot from CDROM ISO file sol-11_4-text-x86.iso instead of sol-10-u10-ga2-x86-dvd.iso\r\n- use the MAC address of the tap2 NIC (\"ip a\") in the qemu-system-x86_64 command when starting the VM\r\n- use putty to connect to the Ubuntu host while setting up tunnelling on 5900 (5900 on the Windows client tunneled to 127.0.0.1:5900 on the remote Ubuntu host)\r\n- use real VNC (or tigerVNC) to connect to the VM's console and install solaris 10\r\n- if setting up network, you MUST assign a gateway e.g., 10.0.2.254, otherwise networking doesn't work in the VM\r\n- it will reboot to the install DVD. shutdown the VM ( e.g., CTRL+Z to kill the qemu-system-x86_64 process on the Ubuntu host). For Solaris 11, choose to halt the system at the end of the installation (instead of reboot) then shutdown the VM ( e.g., CTRL+Z to kill the qemu-system-x86_64 process on the Ubuntu host).\r\n\r\n- boot VM from O\/S disk with networking:\r\n\/\/root@ip-172-31-23-252:\/wip# ip tuntap add tap2 mode tap  &amp;&amp;  ip link set dev tap2 up\r\nroot@ip-172-31-23-252:\/wip# qemu-system-x86_64 -name s10qemu -m 4G -hda solaris-disk-amd64.img -net nic,model=e1000,macaddr=7a:30:2a:cd:d0:1c -net tap,script=no,ifname=tap2,downscript=no\r\n\r\n- Connect via VNC client, login to the GUI desktop (choose Java Desktop or CDE) with root and password supplied during install, \r\n\r\n- shutdown the system e.g., from the terminal (Applications > Utilities) run \"shutdown -y -g0 -i0\"\r\n\r\n- take a snapshot of the O\/S disk for backup purposes:\r\n# qemu-img create -f qcow2 -b solaris-disk-amd64.img -F qcow2 solaris-disk-amd64.snap.img 5G\r\n\r\n- boot VM from O\/S disk with networking:\r\nroot@ip-172-31-23-252:\/wip# qemu-system-x86_64 -name s10qemu -m 4G -hda solaris-disk-amd64.img -net nic,model=e1000,macaddr=7a:30:2a:cd:d0:1c -net tap,script=no,ifname=tap2,downscript=no\r\nNOTE: add the --daemonize to detach the running VM from the host bash session. This is a good way to start the VM once you can access it via SSH.\r\n\r\n\r\n- Disable the GUI\/desktop (graphic environment) since I chose to manage the system remotely using SSH. Note that Solaris 11 boots to run-level 3 so no need to disable the desktop.\r\n# svcadm disable cde-login   \r\n(older Solaris version may use the command \"\/usr\/dt\/bin\/dtconfig -d\")\r\n\r\n- Add a user for remote SSH connection (itababa\/James007!)\r\n# useradd itababa\r\n# password itababa\r\n\r\n- SSH connection from host to Solaris VM (can't use root by default unless you reconfigure SSHD on the Solaris to \"PermitRootLogin\")\r\nroot@ip-172-31-23-252:\/wip\/sol10x86# ssh -oKexAlgorithms=+diffie-hellman-group-exchange-sha1  -o HostKeyAlgorithms=ssh-rsa itababa@10.0.2.50\r\n\r\n- you can make the above connection options permanent by editing the SSH client configuration file on the host\/client and adding a line to it such as the following. (Once done, you can connect to the Solaris VM with \"ssh itababa@10.0.2.50\" for example):\r\nroot@ip-172-31-23-252:\/wip\/sol10x86# vi $HOME\/.ssh\/config\r\nHost 10.0.2.50\r\n    KexAlgorithms +diffie-hellman-group1-sha1\r\n\tHostKeyAlgorithms ssh-rsa\r\n\r\n\r\n\r\n---------- IF YOU SETUP NETWORKING DURING INSTALL SKIP THIS SECTION ---------\r\n\r\n- Configure the network interface e1000g0 (in Solaris 11, the interface is called net0 instead of e1000g0)\r\n\r\n1. Edit \/etc\/hostname.e1000g0 and add the IP address and Netmask:\r\n# echo \"10.0.2.50 netmask 255.255.255.0\" > \/etc\/hostname.e1000g0\r\n\r\n2. Add the IP-address\/hostname entry to file \/etc\/inet\/hosts :\r\n# echo \"10.0.2.50 `hostname`\" >> \/etc\/inet\/hosts\r\n\r\n3. Add the default router\/gateway:\r\n# echo \"10.0.2.254\" > \/etc\/defaultrouter\r\n\r\n4. Bring up the NIC in the current running session:\r\n# ifconfig e1000g0 plumb\r\n# ifconfig e1000g0 10.0.2.50 netmask 255.255.255.0 up\r\n# route add default 10.0.2.254 -ifp e1000g0\r\n\r\n6. Configure DNS\r\n# echo \"nameserver 8.8.8.8\" >> \/etc\/resolv.conf\r\n# vi \/etc\/nsswitch.conf  (change the line \"hosts:     files\" to \"hosts:     files dns\")\r\n\r\n------ END OF NETWORKING SETUP IF YOU DIDN'T SETUP IT UP DURING INSTALL ------\r\n========================================================================\r\n\r\n\r\nUnable to successfully installing Solaris 10\/11 SPARC:\r\n- Solaris 10 boots but has no keyboard input so unable to actually install. Solaris 11 doesn't boot at all.\r\n\r\nNOTE: For Solaris 11 x86, be sure to add a user account\/password aside the root user during the installation as you can't login directly using the root account from the console. \r\n\r\n-------------------------------------------------------------------\r\n\r\n\r\n\r\n-------------------------------------------------------------------\r\n\r\nSome commands:\r\n\r\n- to disable sound and set the language e.g., launch with:\r\nLC_ALL=C QEMU_AUDIO_DRV=none qemu-system-sparc -m 256 -cdrom ...\r\n\r\n- to use terminal install, add the \"-nographic\" option which prevents QEMU from creating a VNC listener\r\n\r\n- Create a snapshot of the AIX O\/S disk for backup purposes:\r\nqemu-img create -f qcow2 -b sol10hdisk.qcow2 -F qcow2 sol10hdisk.snap.qcow2 5G\r\n\r\n- How to disable the graphic environment, this can be done with that command: \"\/usr\/dt\/bin\/dtconfig -d\" or better with latest Solaris 10: \"svcadm disable cde-login\".\r\n\r\n- Halt the VM:  # shutdown -y -g0 -i0\r\n\r\nKeyboard not working as expected in QEMU? When starting QEMU just pass these flags to give yourself a USB keyboard and mouse:\r\n-usb -device usb-mouse -device usb-kbd  -device usb-tablet\r\nYou may also try the flag for some ppc\/sparc (https:\/\/github.com\/qemu\/SLOF\/issues\/1 ):  -prom-env 'input-device=hvterm'\r\n\r\n\r\n\/\/ qemu-system-arm -M overo -m 256 -sd .\/test.img -clock unix -serial stdio -device usb-mouse -device usb-kbd\r\n\/\/ -vga [std|cirrus|vmware|qxl|xenfb|tcx|cg3|virtio|none]\r\n\r\n\r\n- remove a tap device from a master\r\nroot@ip-172-31-23-252:\/wip\/sol10x86# ip link set dev tap2 nomaster\r\n\r\n\r\n\r\nLinks:\r\nhttps:\/\/archive.org\/download\/sunsolaris10operatingsystem1106x86sparc\/SOL_10_1106_SPARC.mdf\r\nhttps:\/\/www.oracle.com\/solaris\/solaris10\/downloads\/solaris10-get-jsp-downloads.html\r\nDownload Solaris 11:  http:\/\/ftp.escuelaing.edu.co\/pub\/Unix\/Solaris\/11\/\r\nDownload Solaris 11:  http:\/\/ftp.escuelaing.edu.co\/pub\/Unix\/Solaris\/10\/\r\nhttp:\/\/ftp.escuelaing.edu.co\/pub\/Unix\/Solaris\/10\/sol-10-u11-ga-x86-dvd.iso\r\nhttp:\/\/ftp.escuelaing.edu.co\/pub\/Unix\/Solaris\/10\/sol-10-u11-ga-sparc-dvd.iso\r\nhttps:\/\/ftp.deu.edu.tr\/pub\/Solaris\/iso\/Solaris-10,8_11\/\r\nhttps:\/\/wiki.qemu.org\/Documentation\/Platforms\/SPARC\r\nhttps:\/\/helpmanual.io\/help\/qemu-system-sparc\/\r\nhttps:\/\/chrispinnock.com\/stuff\/emulation\/running-solaris-in-vms\/\r\nhttps:\/\/learn.adafruit.com\/build-your-own-sparc-with-qemu-and-solaris\r\n<blockquote class=\"wp-embedded-content\" data-secret=\"4FODtbNo9D\"><a href=\"https:\/\/numpangcopas.com\/solaris-10-network-config\/\">Solaris 10 Network Config<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;Solaris 10 Network Config&#8221; &#8212; Numpang CoPas\" src=\"https:\/\/numpangcopas.com\/solaris-10-network-config\/embed\/#?secret=JFYM6E5SmJ#?secret=4FODtbNo9D\" data-secret=\"4FODtbNo9D\" width=\"584\" height=\"329\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\r\nhttps:\/\/stackoverflow.com\/questions\/19665412\/mouse-and-keyboard-not-working-in-qemu-emulator\r\nhttps:\/\/download.oracle.com\/technetwork\/systems\/opensparc\/OpenSPARCT1_Arch.1.5.tar.bz2\r<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Solaris 10 VM on QEMU running on a Ubuntu host ============================================== &#8211; Login to the Ubuntu host and install QEMU: root@ip-172-31-23-252:~# apt update -y root@ip-172-31-23-252:~# apt install -y gcc make ninja-build root@ip-172-31-23-252:~# wget https:\/\/download.qemu.org\/qemu-7.2.0.tar.xz root@ip-172-31-23-252:~# tar xvf qemu-7.2.0.tar.xz root@ip-172-31-23-252:~# cd &hellip; <a href=\"https:\/\/www.itayemi.com\/blog\/2023\/01\/01\/solaris-10-x86-vm-running-on-qemu-hypervisor-on-an-ubuntu-host\/\">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":[1396,1395,1393,1376,1394,1391,1397,1392,1314],"class_list":["post-2308","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-e10000","tag-hostkeyalgorithms","tag-iptables","tag-qemu","tag-real-vnc","tag-solaris","tag-sparc","tag-tap","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/www.itayemi.com\/blog\/wp-json\/wp\/v2\/posts\/2308","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=2308"}],"version-history":[{"count":1,"href":"https:\/\/www.itayemi.com\/blog\/wp-json\/wp\/v2\/posts\/2308\/revisions"}],"predecessor-version":[{"id":2309,"href":"https:\/\/www.itayemi.com\/blog\/wp-json\/wp\/v2\/posts\/2308\/revisions\/2309"}],"wp:attachment":[{"href":"https:\/\/www.itayemi.com\/blog\/wp-json\/wp\/v2\/media?parent=2308"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itayemi.com\/blog\/wp-json\/wp\/v2\/categories?post=2308"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itayemi.com\/blog\/wp-json\/wp\/v2\/tags?post=2308"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}