Linux.com

Feature: BSD

Installing OpenBSD on VMware Server

By Manolis Tzanidakis on September 07, 2006 (8:00:00 AM)

Share    Print    Comments   

Many people collect things as a hobby. I collect computers. Over the years, as my collection grew, my living room began to look like a data center. As soon as VMware Server became freely (as in beer) available I knew I had to migrate my servers and development boxes to virtual machines (VM). The problem is that most of my servers run OpenBSD, which is not officially supported by VMware. Out of the box, VMware can't properly shut down OpenBSD VMs; it just powers VMs off, causing data corruption. With a little bit of hacking, I managed to eliminate this issue. Here's how you can install OpenBSD as a guest OS under VMware Server, and possibly other VMware products.

VMware Server supports FreeBSD as a guest OS and offers vmware-tools built for it. You can fool VMware Server into thinking that an OpenBSD VM is FreeBSD, and use OpenBSD's FreeBSD emulation to run vmware-tools.

Create a new VM and select Other/FreeBSD as the guest operating system. Configure the rest to your liking. Power on the VM you've just created and install OpenBSD as usual; if you've never installed OpenBSD before have a look at the Installation Guide. After the installation finishes, reboot into OpenBSD and enable FreeBSD emulation by issuing sysctl -w kern.emul.freebsd=1. Make this setting permanent by uncommenting the appropriate line in /etc/sysctl.conf.

Select Install VMware Tools... on the VM menu; this creates a virtual CD-ROM image which is accessible from the VM and includes a tarball with vmware-tools for FreeBSD. From that tarball we need to install the vmware-guestd daemon, which triggers events sent for the host computer and runs commands accordingly -- such as halt and reboot -- on the guest OS. So, run the following commands to mount that image and install the daemon and its configuration:

mount /dev/cd0c /mnt
tar -zxvpf /mnt/vmware-freebsd-tools.tar.gz -C /tmp
mkdir -p /emul/freebsd/sbin
install -m 555 -o root -g wheel /tmp/vmware-tools-distrib/lib/sbin32/vmware-guestd /emul/freebsd/sbin
cp -r /tmp/vmware-tools-distrib/etc /etc/vmware-tools
rm -rf /tmp/vmware-tools-distrib
umount /mnt

Start the daemon with /emul/freebsd/sbin/vmware-guestd --background /var/run/vmware-guestd.pid --halt-command "/sbin/shutdown -p -h now". To have it started on boot add the following lines to your /etc/rc.local file just before the echo '.' line:

if [ -x /emul/freebsd/sbin/vmware-guestd ]; then
	echo -n ' vmware-tools'
	/emul/freebsd/sbin/vmware-guestd --background /var/run/vmware-guestd.pid \
		--halt-command "/sbin/shutdown -p -h now"
fi

Now you can shut down the VM and check its status from the VMware Web-based management interface or console and have it halt and power off properly.

Share    Print    Comments   

Comments

on Installing OpenBSD on VMware Server

Note: Comments are owned by the poster. We are not responsible for their content.

What's the advantage?

Posted by: Anonymous Coward on September 08, 2006 06:54 AM
Could you probably explain what is the advantage behind running servers on virtual machines? I thought virtual machines have a performance hit? How do you benefit by having the OpenBSDs server run on VMs?

Thanks!

#

Re:What's the advantage?

Posted by: Anonymous Coward on September 08, 2006 08:16 AM
<a href="http://www.vmware.com/virtualization/" title="vmware.com">http://www.vmware.com/virtualization/</a vmware.com>

Scroll down about half a page.

#

Re:What's the advantage?

Posted by: Anonymous Coward on September 16, 2006 09:34 AM
I run VMWare a lot, mostly for work and mostly for Windows. The key things are that I can have one physical machine but juggle many different configurations. Like from my one Windows XP laptop I can boot up a VM of Windows Server 2003, Chinese Windows XP, or any of a half-dozen plain Windows XP installs. I keep 5 XP VMs paused with different releases and variations of our product, so I can quickly switch between them to trouble-shoot a problem. I can work with the product and hack it up to replicate a customer's environment or any customizations. Then when it's all wrecked, I can switch back to a clean snapshot before I messed with it.

I don't really use VMWare too much for Linux/Solaris/BSD these days, but I do keep a few around. I did a P2V (physical to virtual -- think of using Norton Ghost to a VM) migration of my old dual-P2 Redhat 9 box just so I could save one of my favorite workhorse environments before the hardware gave out. I keep a Redhat Enterprise and a SuSE Enterprise VM for when I can't get to our testing lab. I keep the latest OpenBSD around on a VM and sometimes copy it to another machine if I need to fire up a secure server to ssh into.

At home I use VMWare for 3 things. I test out new live cd ISOs for fun. I use one to browse the pron / test downloads so I can roll back all my browser history, bad cookies, malware, and other crap that I get even with Firefox. Finally, I have a VMWare image set up for work in case I don't bring my laptop home, it dies, I'm too lazy to get it out, etc. I can fire it up and tunnel in without opening my whole home machine up to the work network and BOFHs. Isolation is cool.

We're in the process of setting up two VMWare ESX servers in our testing lab to migrate our 30 or so Windows and Linux testing servers. We generally need to keep 3 versions of our software available for testing and on Windows that's pretty much one version per machine. Multiply that by 4 versions of Windows. On Linux it's a little better, but we generally have to support at least 4 versions of Linux on Intel, more once we really go 64-bit. Out of those 30 or so machines, we're usually only actively using maybe 7 of them in a testing cycle, so one quad Xeon running VMWare ESX handles that load nicely. Especially since the lab is almost entirely made up of what I call sh*tboxes -- hand-me-downs from developers. The average box is a P3-500 with 256 or 512 megs of RAM.

#

Didn't use VMWare to shut down OpenBSD

Posted by: Anonymous Coward on September 09, 2006 01:06 AM
I don't do a *lot* of testing on VMWare, so perhaps I have a limited viewpoint. For example, I don't use VMWare to shut down my virtual hosts - I have them shut themselves down as if they were physical hosts.

I have installed OpenBSD on VMWare, and I've never had a problem just doing

`shutdown -h now`

from within the OpenBSD instance. It's the same command I would use for a physical server, and it gave me the results I expected.

#

Re:Didn't use VMWare to shut down OpenBSD

Posted by: Anonymous Coward on September 11, 2006 01:27 AM
I do the same thing and I do it with clusterit for my 3 toy OpenBSD installations.

#

OpenBSD i386 v3.7 Other/Other

Posted by: Anonymous Coward on September 27, 2006 01:16 AM
Hi. I recently created a virtual machine in VMWare Server and selected Other/Other. Saying this is it still possible to install the VMWare Tools as I didn't pick Other/FreeBSD at creation of th VM?

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya