Sunday, September 13, 2015

Fun with KVM and illumos

According to the "building illumos" page, KVM is better for building illumos than Virtualbox. Right now I cannot run on bare metal so some sort of virtualization platform is required.

However, none of the illumos-based options worked for me on kvm; the network adapter fails. Last night I got lucky in my googling and I found out that qemu 2.0 made changes that the illumos network drivers don't work with.

It's easy to work around once you know about it, actually. In order to get it to work you simply tell it not to use the x2apic feature of qemu's cpu.

Like this: "-cpu host,-x2apic "
That requires kvm, but you could easily use "-cpu qemu64,-x2apic" which wouldn't. For performance reasons, you'll want to enable kvm if at all possible.

Other neat features I've unlocked in the last few days:

Shutting off raw warnings by using "-drive" instead of "-hda":

-drive file=FILENAME,index=0,media=disk,format=raw

Using qemu's built-in vnc server:
 -vnc :0
...I the connect with gvncviewer 127.0.0.1:0

Enable qemu's built-in smb server to transfer files:
-smb YOUR/PATH/HERE

Use network redirection to allow myself to ssh into the VM:
-redir tcp:5555::22

Once I figured out all of those, it was time to set up a Hipster virtual machine; I used an iso i had grabbed from the OI Hipster download site and installed it.

Nothing really remarkable here, though I decided that I didn't need the overhead of running X and GNOME in the VM so I ran sudo -s and then from the prompt disabled gdm:

#svcadm disable svc:/application/graphical-login/gdm

I also created a small shell file to set up my samba share inside the vm:

cat bin/mntq.sh
#!/bin/bash
echo "type user password here:"
sudo svcadm enable -r network/smb/client
mount -F smbfs //10.0.2.4/Qemu $HOME/qemu

From there I simply tabbed between firefox and my mate terminal (with ssh to the vm running) and cut and pasted commands from the illumos build instructions.

It took a while, a bit longer than it would have on bare metal but eventually I got what I was after:

./nightly.sh illumos.sh


real    101m46.436s
user    154m30.348s
sys     122m32.661s

Host machine:
i5 quad core,
Linux MINT 17/x64
12 gigs of ram

Guest machine:
-enable_kvm
-cpu host,-x2apic
-smp 4
2 gigs of ram


I'm hoping there's more tunage I can do; particularly with the disk and network; but this is all pretty good progress for just one day!

No comments:

automating zfs mounts -a quick and very dirty script

 #!/bin/sh for x in obj xsrc src pkgsrc pkgsrc/distfiles pkgsrc/packages pkg         do zfs create ext/$x zfs set mountpoint=/usr/$x ext/$x ...