Borys Bradel's Blog
Virtualization and Operating System adventures
Tags: solaris, bsd, virtualization December 26, 2008
My initial foray into virtualization was a result of wanting to generate Sparc Solaris binaries. Although that was a dead end, with me having to generate binaries on an actual Sparc Solaris machine, I was able to experiment with using OpenSolaris. After dealing with it for a while, I've decided that although the experience is pretty good, there is one annoying part to using Solaris that makes me very hesitant to ever use it. I asked the package manager to update out of date packages, and the manager showed that pretty much all packages need to be updated. I can understand upgrading all packages for a major release, but upgrading all packages is not acceptable in any other circumstance.
Because of that issue, I've decided to try out other operating systems, in particular the different BSD flavours. Since I don't want to mess up my machine, I used virtualization, in particular the VirtualBox, qemu, and kvm packages that are in the Ubuntu 8.04 repository. Interestingly, qemu could not run OpenSolaris. However, both kvm and VirtualBox did.
The summary is that neither virtualization nor the BSD flavours are ready to be used on a desktop system. However, OpenBSD is probably a good operating system for servers. The only good reason to use virtualization is to test software on multiple system images. However, there is an associated cost both in security and performance when using a virtual machine.
The first BSD that I tried is OpenBSD. It could not be installed on VirtualBox because there is a bug that makes OpenBSD think that the file system is full. Therefore I went and tried to use qemu. Three more packages need to be added: qemu (simulator), kqemu (hardware accelerator), and Qemulator (GUI shell). Two other GUI shells are QtEmu and Qemu Launcher. However, both of these did not have enough options for me.
OpenBSD installed properly on qemu from the install44 iso, although the cd44 iso probably would have worked as well. I definitely needed to have the installation guide open while installing OpenBSD although probably after half a dozen installs, I wouldn't need it. My basic observation is that OpenBSD is not suitable as a desktop operating system because its internet facing desktop packages are too out of date. I'll have a better idea whether it is suitable as a server once I play with it for a while. Although my first guess would be that it is.
Getting the X interface to work was a pain. First, for qemu (and kvm), the vga display option needs to be used instead of the default one, which is true for FreeBSD and OpenSolaris (on kvm). The xorgconfig needs to be run, which generates an initial /etc/X11/xorg.conf file. Make sure to select the ps mouse and some standard vesa settings. Then you have to go into the xorg.conf file manually and make the following changes if necessary: enable varying HorizSync 31-64, change references to Screen 1 into Screen 0, change references from vga to vesa, uncomment VideoRam and set to 8192, and add an 1024x768 resolution. After that, X should start properly when running startx.
To add packages, something analogous to the following line needs to be executed, preferably in the startup script: export PKG_PATH=ftp://gulus.usherbrooke.ca/pub/distro/OpenBSD/4.4/packages/i386
After that packages can be added using the pkg_add command. For example pkg_add -v -i pkg_mgr, pkg_add -v -i firefox3, or pkg_add -v -i mozilla-thunderbird. Overall, the user packages where out of date enough that there were vulnerabilities that would make browsing unsafe.
Second up was FreeBSD. Initially, it also could not be installed on VirtualBox because neither the default emulated netfast iii network card nor the fallback emulated netfast ii network card would work properly during install. However, the same problem occurred on qemu. Therefore I tried to install from the full first CD. That solution worked for both VirtualBox and qemu. However, there are multiple CDs in the set, and the instructions do not state that for a simple install only the first one is needed.
Once the system was running, the internet worked properly. Go figure. There must be something weird in the installer. FreeBSD is not suitable for desktop use because its internet facing desktop packages are too out of date, just like OpenBSD. Because of the strange network behaviour I would not use FreeBSD as a server either.
To get X to work, the same steps are required as for OpenBSD. Interestingly enough when I tried running KDE from the command line by executing kdm, there was no way to go back to the command line other than to shut down the system.
Although the install steps are relatively straightforward, the one catch is that you must create the first user with a group, preferably the wheel group, which allows the user to execute sudo. Without a group, the user seems to not have a home directory.
The package system seems pretty annoying. There are three different versions, and figuring out how to go from one to the other is beyond me, although there are some short and confusing instructions on the FreeBSD website. Packages can be added by using the pkg_add command, e.g. pkg_add -r portaudit. Alternatively, the portupgrade command can be used, e.g. portupgrade -RPP firefox would get the firefox package only without the source along with whatever the package relies on recursively. The pkg_delete command deletes packages. There are many commands to update the package repository information such as portsnap, portupgrade, and freebsd-update. However, I did not fully understand which one to use, and they seem to be very sensitive to having a good internet connection.
Overall, I had many problems with FreeBSD.
My third try is a FreeBSD derived system called PCBSD. Although PCBSD is not a mainstream BSD, the promise of ease of use tempted me enough to try. I only tried PCBSD on qemu, and not on VirtualBox. This one seemed to have installed properly from the net. Unfortunately, once the system started, the GUI did not come up. Instead there were errors from getty and the KDE window manager seemed to be missing. For me, PCBSD just does not work properly. Furthermore, it has all the limitations of FreeBSD, and is therefore not suitable for my use.
The final BSD I looked at is NetBSD, which was extremely sensitive to virtual machine settings. To get NetBSD working in qemu, acpi had to be disabled and the default display setting had to be used. Neither VirtualBox nor kvm could run NetBSD properly. The main problem with kvm is that it only works with vga display output and VirtualBox has a problem in that it cannot errors are reported when the NetBSD packages are being uncompressed.
The command that finally worked for me is qemu -M pc -hda netbsd1.img -no-acpi -m 512 -cdrom i386cd-4.0.1.iso -net nic,vlan=0 -net user,vlan=0,hostname=emu -boot c
for NetBSD, the installation is straightforward except that many settings need to be entered manually.
When given the prompt
Which would you like to do?
a: Edit the MBR partition table
b: Use the entire disk
always select editing the MBR. Then, when editing the MBR, select the first partition, and within that set the type to NetBSD, the install to yes, the bootmenu to netbsd, and the default to yes. Once that is done, continue with pressing okay.
When given the prompt
Choose your installation
a: Set size of NetBSD partitions
b: Use existing partition sizes
always select set size of netbsd partitions and then accept the partition sizes.
at some point there is a list of partitions, if the first partition does not have the mount point / on it, then you need to add it.
Setting up X is different. The xf86config command needs to be used, which generates files in /etc/X11/XF86Config. The settings seem to work for the most part, although the mouse is the default mouse, i.e. /dev/wsmouse.
The packages seem up to date, although they may not be fully supported. In particular, the Firefox version is referred to as minefield. To use packages, a PKG_PATH variable needs to be set, e.g. to ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/i386/4.0/All, and then the pkg_add command can be used. There is also a way to update packages, although that did not work very well for me.
None of the BSDs are suited for desktop systems. NetBSD comes closest, although the "minefield" moniker for Firefox put me off. OpenBSD is the most complex, has the best documentation, and is probably the best choice for a server. FreeBSD seems like the most refined, although the packages for websurfing are too out of date and the documentation is confusing. And PCBSD just doesn't work, at least for me. Solaris is better than all of them, although the updating of pretty much all packages has me concerned.
Virtual machines seem out of date in the package manager in Ubuntu and probably most other package managers as well. Therefore, unless they are constantly updated separately from the underlying operating system, using them makes the overall system less secure. Also, they do not run the different operating systems very well.
In other words, I will not use virtual machines for anything serious, I will continue to use Linux and keep an eye out on OpenSolaris, and if I ever need a server I'll look into OpenBSD again.
Copyright © 2008 Borys Bradel. All rights reserved. This post is only my possibly incorrect opinion.