Tony's ramblings on Open Source Software, Life and Photography

Virtual Machines

I've recently been using VirtualBox to run other OS installs inside of my Ubuntu desktop.

I have to say, VirtualBox is the best thing since sliced bread. I've used VMWare before, and VirtualBox is much easier to use. The interesting part was that it wouldn't automagically run Ubuntu Linux inside the virtual machine as well as it did Windows. Read on for the fix...Virtualbox is an easy install for the beginner, but a bit tougher for some of the advanced features like bridged networking, even for Windows guest installs.

I stumbled on a great instruction list for setting up bridged networking in a Linux host for use with VirtualBox. I modified those a bit and came up with the following for Ubuntu systems:


Use Synaptic to install the following packages:
bridge-utils
uml-utilities

As root, edit the following file:
/etc/rc.local

Before 'exit 0', put the following code:

modprobe tun
sleep 2
chmod 0666 /dev/net/tun
brctl addbr br0
ifconfig eth0 0.0.0.0 promisc
brctl addif br0 eth0
dhclient br0
tunctl -t tap1 -u [INSERT YOUR LOGIN NAME]
brctl addif br0 tap1
ifconfig tap1 up

In VirtualBox settings for network change 'attached to' to be 'host interface'
Under 'interface name' enter:
tap1

Save that and reboot your computer. From then on you'll have a bridge interface 'tap1' that can be used by VirtualBox as needed. After these changes you can add your virtual Windows box to a Windows domain, and otherwise act as if the virtual machine is directly connected to the network.


If you're trying to install Ubuntu as the guest OS inside VirtualBox, you'll need to set two kernel boot options in the guest OS: noapic and nolapic. Virtualbox doesn't yet support those options. In the Ubuntu installer, hit F6 (I think) to add boot options and tag those two at the end.

I also found that the Ubuntu CD-ROM kind of 'vanished' during the install process and got an error stating that it couldn't install the base system. I learned you must use an ISO image in VirtualBox for the installer instead of accessing the Ubuntu CD directly. If you're like me, you'll already have the ISO around, just add it to the VirtualBox manager as an available CD-ROM Image, and then mount it for the virtual guest that you are installing.

Once the Ubuntu is installed, it still won't boot. That's because despite running the installer with noapic & nolapic, it won't set these options by default in the grub boot manager. That's another easy fix, when your virtual machine first starts to boot, hit 'ESC' to view the grub menu, hit 'E' to edit the boot command, arrow down to the kernel line and hit 'E' again to edit it. Add 'noapic nolapic' to the end of the line, hit enter, then hit 'B' to boot.

Once you've booted the guest OS the first time, edit your grub config file at /boot/grub/menu.lst to include those options at every boot.

Another tip: Installing the guest additions requires that you manually mount the guest additions CD-ROM for the guest OS, and run the install script from it inside the guest OS. Just clicking 'Devices+Install Guest Additions' won't do anything inside Linux.

There's a list of all the 'glitches' I had to work out with VirtualBox when I started using it. It still beats having to recompile every time I update my Kernel, like I had to do with VMWare!