{"id":396,"date":"2009-06-12T11:10:23","date_gmt":"2009-06-12T19:10:23","guid":{"rendered":"http:\/\/wp.colliertech.org\/cj\/?p=396"},"modified":"2009-06-13T17:19:38","modified_gmt":"2009-06-14T01:19:38","slug":"installing-open-solaris-as-a-xen-domu","status":"publish","type":"post","link":"https:\/\/wp.c9h.org\/cj\/?p=396","title":{"rendered":"Installing Open Solaris as a Xen domU"},"content":{"rendered":"<p>This particular dom0 is running Ubuntu 8.10 on an amd64 kernel using an lvm volume group called &#8216;vg0&#8217;.  Adjust accordingly.  Note that the credentials for this particular live cd are:<\/p>\n<p>unprivileged username: jack<br \/>\nunprivileged password: jack<\/p>\n<p>privileged username: root<br \/>\nprivileged password: opensolaris<\/p>\n<p>I have been meaning to add a Solaris machine to my network for a while.  I stopped by #opensolaris on freenode, and was helped a great deal by a guy that goes by the nick &#8220;pino42.&#8221;  The gist is this:<\/p>\n<ol>\n<li>Download the ISO:\n<pre><code>\r\n<b>cjac@dom0:~$<\/b> sudo mkdir \/var\/xen\/osol && cd \/var\/xen\/osol\r\n<b>cjac@dom0:\/var\/xen\/osol$<\/b> sudo wget -O osol-0906-ai-x86.iso http:\/\/dlc.sun.com\/osol\/opensolaris\/2009\/06\/osol-0906-ai-x86.iso\r\n<\/code><\/pre>\n<\/li>\n<li>Mount it on \/mnt\/osol\/:\n<pre>\r\n<code>\r\n<b>cjac@dom0:\/var\/xen\/osol$<\/b> sudo losetup \/dev\/loop0 osol-0906-x86.iso\r\n<b>cjac@dom0:\/var\/xen\/osol$<\/b> sudo mkdir \/mnt\/osol\r\n<b>cjac@dom0:\/var\/xen\/osol$<\/b> sudo mount \/dev\/loop0 \/mnt\/osol\r\n<\/code>\r\n<\/pre>\n<\/li>\n<li>Copy the live kernel and ram disk from the iso so that Xen can boot from them:\n<pre>\r\n<b>cjac@dom0:\/var\/xen\/osol$<\/b> sudo mkdir \/boot\/osol\r\n<b>cjac@dom0:\/var\/xen\/osol$<\/b> sudo cp \/mnt\/osol\/platform\/i86xpv\/kernel\/amd64\/unix \/boot\/osol\/\r\n<b>cjac@dom0:\/var\/xen\/osol$<\/b> sudo cp \/mnt\/osol\/boot\/amd64\/x86.microroot \/boot\/osol\/\r\n<\/pre>\n<\/li>\n<li>Create the target lv to which we&#8217;ll install the OS:\n<pre>\r\n<b>cjac@dom0:\/var\/xen\/osol$<\/b> sudo lvcreate \/dev\/vg0 -n solaris0-disk -L 4G\r\n<\/pre>\n<\/li>\n<li>Create the xen domU .cfg file for the live CD\/installer:\n<pre>\r\n<code>\r\n<b>cjac@dom0:\/var\/xen\/osol$<\/b> sudo -s\r\n<b>root@dom0:\/var\/xen\/osol#<\/b> cat > \/etc\/xen\/solaris-live.cfg\r\nname        = \"solaris-live\"\r\nvcpus       = 1\r\nmemory      = \"768\" # 512 will work, but it's slow                                                                                           \r\nkernel      = \"\/boot\/osol\/unix\"\r\nramdisk     = \"\/boot\/osol\/x86.microroot\"\r\nextra       = \"\/mnt\/osol\/platform\/i86xpv\/kernel\/amd64\/unix -kd - nowin -B install_media=cdrom\"\r\ndisk        = ['phy:\/dev\/loop0,6:cdrom,r','phy:vg0\/solaris0-disk,0,w']\r\nvif         = ['bridge=net,mac=00:16:3e:aa:b9:bc']\r\non_shutdown = \"destroy\"\r\non_reboot   = \"destroy\"\r\non_crash    = \"preserve\"\r\n^D\r\n<b>root@dom0:\/var\/xen\/osol#<\/b> exit\r\n<\/code>\r\n<\/pre>\n<\/li>\n<li>Make sure you&#8217;ve got a DHCP server on the bridge you decide to use for &#8216;vif&#8217;.  Setting this up is left as an exercise for the reader.<\/li>\n<li>All should be set to launch the live installer.  Do so:\n<pre><b>cjac@dom0:\/var\/xen\/osol$<\/b> sudo xm create -c solaris-live.cfg<\/pre>\n<\/li>\n<li>At the kernel debugger prompt, continue:\n<pre><code>\r\nStarted domain solaris-live\r\n                           Loading kmdb...\r\n\r\nWelcome to kmdb\r\nLoaded modules: [ unix krtld genunix ]\r\n<b>[0]><\/b> :c\r\n<\/code><\/pre>\n<\/li>\n<li>After selecting your keyboard layout and desktop language, log in:\n<pre><code>\r\n<b>opensolaris console login:<\/b> jack\r\n<b>Password:<\/b> jack\r\n<\/code><\/pre>\n<\/li>\n<li>You will know that the DHCP server has assigned you an address when you see a message similar to the following on the console:\n<pre><code>\r\nJun 12 10:21:07 opensolaris in.routed[688]: route 0.0.0.0\/8 --> 0.0.0.0 nexthop is not directly connected\r\n<\/code><\/pre>\n<p>The message will probably be different if you happen to have a RIP server functioning on the same link as the DHCP server.  But I do not.<\/p>\n<p>To discover the IP address which has been assigned by the DHCP server, do the following:<\/p>\n<pre><code>\r\n<b>jack@opensolaris:~$<\/b> ifconfig -a\r\nlo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1\r\n        inet 127.0.0.1 netmask ff000000 \r\nxnf0: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 index 2\r\n        inet 192.168.10.66 netmask ffffff00 broadcast 192.168.10.255\r\nlo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1\r\n        inet6 ::1\/128 \r\nxnf0: flags=2004841<UP,RUNNING,MULTICAST,DHCP,IPv6> mtu 1500 index 2\r\n        inet6 fe80::216:3eff:feaa:b9bc\/10\r\n<\/code><\/pre>\n<\/li>\n<li>Since the installer is graphical, we&#8217;ll need to attach to the X server using vnc.  On the solaris machine, you need to start the vnc server.  You will be prompted for a password, which must be at least 6 characters in length:\n<pre><code>\r\n<b>jack@opensolaris:~$<\/b> mkdir ~\/.vnc\r\n<b>jack@opensolaris:~$<\/b> cp ~\/.Xclients ~\/.vnc\/xstartup\r\n<b>jack@opensolaris:~$<\/b> vncserver\r\n\r\nYou will require a password to access your desktops.\r\n\r\n<b>Password:<\/b> password\r\n<b>Verify:<\/b> password\r\n<\/code><\/pre>\n<\/li>\n<li>On a machine with an X display, connect to a machine which can communicate with the host and establish a VNC session:\n<pre><code>\r\ncjac@laptop:~$ echo $DISPLAY && ssh -AY dhcp-server\r\n:0.0\r\ncjac@dhcp-server:~$ sudo apt-get install xvnc4viewer\r\ncjac@dhcp-server:~$ echo $DISPLAY && vncviewer 192.168.10.66:1\r\nlocalhost:11.0\r\n<b>Password:<\/b> password\r\n<code><\/pre>\n<\/li>\n<li>You should now have an X window with a view of the remote Solaris installer:<br \/>\n<figure id=\"attachment_406\" aria-describedby=\"caption-attachment-406\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/i0.wp.com\/wp.colliertech.org\/cj\/wp-content\/uploads\/2009\/06\/opensolaris-installer.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/wp.colliertech.org\/cj\/wp-content\/uploads\/2009\/06\/opensolaris-installer-300x182.png?resize=300%2C182\" alt=\"OpenSolaris live installer\" title=\"opensolaris-installer\" width=\"300\" height=\"182\" class=\"size-medium wp-image-406\" srcset=\"https:\/\/i0.wp.com\/wp.c9h.org\/cj\/wp-content\/uploads\/2009\/06\/opensolaris-installer.png?resize=300%2C182&amp;ssl=1 300w, https:\/\/i0.wp.com\/wp.c9h.org\/cj\/wp-content\/uploads\/2009\/06\/opensolaris-installer.png?resize=1024%2C622&amp;ssl=1 1024w, https:\/\/i0.wp.com\/wp.c9h.org\/cj\/wp-content\/uploads\/2009\/06\/opensolaris-installer.png?w=1034&amp;ssl=1 1034w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-406\" class=\"wp-caption-text\">OpenSolaris live installer<\/figcaption><\/figure><\/p>\n<li>\n<li>Double-click on the \"Install OpenSolaris\" icon and proceed through the configuration.  <b>DO NOT<\/b> reboot the system on completion, as we've got some Xen-specific mucking to do after the installer has completed.<\/li>\n<li>Return to your xm console shell and elevate your priviliges to root:\n<pre><code>\r\n<b>jack@opensolaris:~$<\/b> su -\r\n<b>Password:<\/b> opensolaris\r\nJun 12 10:50:24 opensolaris su: 'su root' succeeded for jack on \/dev\/console\r\nSun Microsystems Inc.   SunOS 5.11      snv_111b        November 2008\r\nroot@opensolaris:~# \r\n<\/code><\/pre>\n<\/li>\n<li>I slightly modified the script I found <a href=\"http:\/\/blogs.sun.com\/levon\/entry\/opensolaris_2008_11_guest_domain\">here<\/a> to get a copy of the running kernel and boot archive:\n<pre><code>\r\n<b>root@opensolaris:~#<\/b> cat &gt; get_images.sh\r\n#\/bin\/bash\r\n\r\ndom0=$1\r\ndompath=$2\r\nunixfile=\/platform\/i86xpv\/kernel\/amd64\/unix\r\nzdb rpool > \/tmp\/zdb.out # this takes 5+ minutes\r\nbootpath=`grep phys_path \/tmp\/zdb.out | awk -F\\' '{print $2}'`\r\ndataset_id=`grep 'Dataset rpool\/ROOT\/opensolaris ' \/tmp\/zdb.out | awk -F, '{print $2}' | cut -d' ' -f 3`\r\nroot=`pfexec beadm list -H |  grep ';N*R;' | cut -d \\; -f 1`\r\nmkdir \/tmp\/root\r\npfexec beadm mount $root \/tmp\/root 2>\/dev\/null\r\nmount=`pfexec beadm list -H $root | cut -d \\; -f 4`\r\npfexec bootadm update-archive -R $mount\r\n\r\necho \"Kernel and ramdisk for $root should now be copied to $dom0:$dompath\"\r\n\r\necho \"${mount}${unixfile} -> $dom0:$dompath\/kernel.$root\"\r\necho \"$mount\/platform\/i86pc\/amd64\/boot_archive -> $dom0:$dompath\/ramdisk.$root\"\r\n# pfexec beadm umount $root 2>\/dev\/null\"\r\necho \"Kernel cmdline should be:\"\r\necho \"$unixfile -B zfs-bootfs=rpool\/$dataset_id,bootpath=$bootpath\"\r\n^D\r\n<b>root@opensolaris:~#<\/b> chmod u+x get_images.sh\r\n<\/code><\/pre>\n<\/li>\n<li>Run the script:\n<pre><code>\r\n<b>root@opensolaris:~#<\/b> .\/get_images.sh dom0 \/boot\/osol amd64\r\n<\/code><\/pre>\n<\/li>\n<li>Go get a cup of coffee or something.  When you return, you should see something like this:\n<pre><code>\r\nKernel and ramdisk for opensolaris should now be copied to dom0:\/boot\/osol\r\n\/tmp\/root\/platform\/i86xpv\/kernel\/amd64\/unix -> dom0:\/boot\/osol\/kernel.opensolaris\r\n\/tmp\/root\/platform\/i86pc\/amd64\/boot_archive -> dom0:\/boot\/osol\/ramdisk.opensolaris\r\nKernel cmdline should be:\r\n\/platform\/i86xpv\/kernel\/amd64\/unix -B zfs-bootfs=rpool\/42,bootpath=\/xpvd\/xdf@0:a\r\n<\/code><\/pre>\n<li>Copy the kernel and ramdisk to the dom0.  Your dom0 is probably not on the same network segment as your dhcp server, but I'll assume that you can ssh from the dom0 to the dhcp server:\n<pre><code>\r\n<b>jack@opensolaris:~$<\/b> scp \/tmp\/root\/platform\/i86xpv\/kernel\/amd64\/unix cjac@dhcp-server:\/tmp\/kernel.opensolaris\r\n<b>jack@opensolaris:~$<\/b> scp \/tmp\/root\/platform\/i86pc\/amd64\/boot_archive cjac@dhcp-server:\/tmp\/ramdisk.opensolaris\r\n<b>cjac@dom0:~$<\/b> sudo scp cjac@dhcp-server:\/tmp\/ramdisk.opensolaris \/boot\/osol\/\r\n<b>cjac@dom0:~$<\/b> sudo scp cjac@dhcp-server:\/tmp\/kernel.opensolaris \/boot\/osol\/\r\n<\/code><\/pre>\n<\/li>\n<li>shut the live domU down:\n<pre><code>\r\n<b>jack@opensolaris:~$<\/b> jack@opensolaris:~$ pfexec halt\r\nJun 12 22:00:46 opensolaris halt: initiated by jack on \/dev\/console\r\n<\/code><\/pre>\n<\/li>\n<li>Create your final Xen domU config file<br \/>\n<code><\/p>\n<pre>\r\n<b>cjac@dom0:~$<\/b> sudo -s\r\n<b>root@dom0:~#<\/b> cat > \/etc\/xen\/solaris0.cfg\r\nname    = 'solaris0'\r\nvcpus   = 1\r\nmemory  = \"512\"\r\nvif     = ['bridge=loc,mac=00:16:3e:aa:b9:bc']\r\ndisk    = [ 'phy:\/dev\/vg0\/solaris0-disk,0,w' ]\r\nkernel  = '\/boot\/osol\/kernel.opensolaris'\r\nramdisk = '\/boot\/osol\/ramdisk.opensolaris'\r\nextra   = '\/platform\/i86xpv\/kernel\/amd64\/unix -B zfs-bootfs=rpool\/42,bootpath=\/xpvd\/xdf@0:a'\r\n   \r\non_shutdown = 'destroy'\r\non_reboot = 'destroy'\r\non_crash = 'destroy'\r\n^D\r\n<b>root@dom0:~#<\/b> exit\r\n<\/pre>\n<p><\/code>\n<\/li>\n<li>Instantiate the domU<br \/>\n<code><\/p>\n<pre>\r\n<b>cjac@dom0:~$<\/b> sudo xm create -c solaris0.cfg\r\nUsing config file \"\/etc\/xen\/solaris0.cfg\".\r\nStarted domain solaris0\r\n                       v3.2-1 chgset 'unavailable'\r\nSunOS Release 5.11 Version snv_111b 64-bit\r\nCopyright 1983-2009 Sun Microsystems, Inc.  All rights reserved.\r\nUse is subject to license terms.\r\nHostname: solaris0\r\nReading ZFS config: done.\r\nMounting ZFS filesystems: (6\/6)\r\n\r\n<b>solaris0 console login: <\/b>\r\n<\/pre>\n<p><\/code>\n<\/li>\n<\/ol>\n\n<div class=\"twitter-share\"><a href=\"https:\/\/twitter.com\/intent\/tweet?via=cjamescollier\" class=\"twitter-share-button\">Tweet<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>This particular dom0 is running Ubuntu 8.10 on an amd64 kernel using an lvm volume group called &#8216;vg0&#8217;. Adjust accordingly. Note that the credentials for this particular live cd are: unprivileged username: jack unprivileged password: jack privileged username: root privileged password: opensolaris I have been meaning to add a Solaris machine to my network for [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[103,181,16,143,184,183],"tags":[],"class_list":["post-396","post","type-post","status-publish","format-standard","hentry","category-freenode","category-irc","category-sun","category-unix","category-virtualization","category-xen"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1YDIB-6o","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=\/wp\/v2\/posts\/396","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=396"}],"version-history":[{"count":24,"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=\/wp\/v2\/posts\/396\/revisions"}],"predecessor-version":[{"id":421,"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=\/wp\/v2\/posts\/396\/revisions\/421"}],"wp:attachment":[{"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=396"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=396"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=396"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}