Posted by: reformedmusings | December 10, 2008

Creating a virtual machine under VirtualBox 2.0.6

In my last post, I installed Sun’s VirtualBox 2.0.6 into Ubuntu 8.10 Intrepid. In this post, we’ll create and run a virtual machine under VirtualBox. For this example, I will install PCLinuxOS 2007, a stable KDE-based distribution.

First, open VirtualBox from the menu Applications -> System Tools -> Sun xVM Virtual Box. This brings you to the opening screen:


Click on the New icon on the toolbar to start the wizard:


Clicking next will bring you a screen to name your virtual machine and select the operating system which you will install into it. The operating system choice will help virtual box tailor the settings and support needed for your virtual machine. Most popular operating systems appear on the list, but PCLinuxOS did not. So, I simply picked the Linux 2.6 kernel choice because PCLinuxOS is based on that kernel. This should work with no problems.

Click on Next to move onto the memory screen:


VirtualBox recommended 256MB in RAM for our test case. I recommend using 512MB as a minimum RAM setting for most test machines. This will help them run smoothly and not spend a lot of nanos swaping to the hard disk. This only applies if you have enough physical RAM to cover your host computer needs plus the virtual machine. You may have to play with a number of virtual machines (VMs) to get a feel for what works best on your computer.

Click on Next and it’s time to choose or build a virtual hard disk:


VB recommends an 8GB disk, which is more than enough for a test machine. You could pick an existing virtual disk if you have one, but I normally delete old ones and start fresh for east virtual machine. To create one from scratch, click on New:

vbox-diskwizClick on Next. The wizard asks if you want to use a dynamically-sized virtual disk or to allocate all the storage at once to a fixed-sized image. Except under the most unusual circumstances, you will want a dynamic image. This conserves your real hard disk space. The only practical advantage of a fixed-size image is that it can be faster than a dynamic one at times when the dynamic image must grow. I’ve tried both, and have found any difference to be trivial. Another issue would be fragmentation of the disk image, but that’s a non-problem on a Linux host with an ext3 file system. I recommend that you choose the dynamic option and click Next:


The proposed disk image should have the name that you entered earlier as well as the default size. This is your last opportunity to change the hard disk image size. Click on Next to move to the final step:


This is the summary of all your choices. When you click Finish, VirtualBox will create the hard disk image and move on to other virtual machine settings. On the next screen, you can tailor the individual components as needed. I illustrate the USB setup screen:


Here is the big reason that I chose to go with Sun’s implementation of VirtualBox. Sun’s proprietary code supports USB2. You can add devices to this screen to specify which devices should automatically connected to the virtual machine and which to hold back.

You can also go through the other settings on the left side and tailor your machine to your requirements. A good philosophy is to open as little of your host machine as possible to virtual machines. That way, it something bad happens in the VM, it won’t spill out into your production system. For example, if you are running a Windows guest VM on a Windows host and the VM gets a bad virus or other malware, it can and probably will spread to the directories that you share between the host and guest. Even on a Linux host, which isn’t subject to Windows virii, a bad application in a VM that deletes or corrupts files that you didn’t intend can hit your host. Word to the wise – treat virtual machines as leper colonies.

So, how do you get the operating system loaded in your new virtual machine? The fastest and easiest way is using an iso image of a CD:


On the CD setup screen, check the Mount CD/DVD Drive, select ISO Image File, then navigate to the location of your iso image. I downloaded the PCLinuxOS image, so I simply clicked on the folder icon next to the text box and navigated to the image. The VM will treat that image as a real CD and run it on bootup. This particular iso is a live CD, so the live CD will load just as it would on a physical machine. If you have a physcial CD rather than an iso image, then select Host CD/DVD Drive and the VM will load the physical CD on startup.

Now we’re all done, so click OK. VirtualBox will finish creating the virtual machine and return to the master screen.


You can see your settings on the right once you highlight your virtual machine. You can have as many VMs as your hard disk will hold, but I create and trash them all the time, rarely keeping more than a handful at any one time. At this point, all that remains is to highlight your VM and select Start on the icon bar to run your VM. In this case, the PCLinuxOS LiveCD will load just as we set it up:


You can now play with the LiveCD as you desire. Sorta…

Important Safety Tip: There’s a bug in VirtualBox 2.0.6 related to mouse capture in the virtual machine. When you click the mouse in the VM the first time, a dialog box will pop up explaining the keyboard and mouse capture rules. as well as providing your release key (usually the right control key). On the lower left corner of the dialog box, there’s a little checkbox that says something like “Don’t show this screen again”. CHECK THAT BOX!!!! If you don’t check that box, the VM will never capture your mouse! This is self-critiquing because if you clear the dialog without checking the little box, your mouse won’t work in the VM. Every time that you try to click in the VM, the information dialog box reappears until you check that box. This behavior is a known bug.

When and if you are ready to install the operating system to the VM, then just double-click on the icon labeled “Install PCLinuxOS” as shown above. Then just follow the screens through the normal PCLinuxOS setup and all will proceed just as it would on a physical computer. When it’s done, you will be prompted to remove the CD and restart the system. Simply release the mouse by pressing your release key (probably the right control key) and right click on the little CD icon on the bottom right of the status bar. Choose to unmount the CD. Then click back into the VM and tell the install routine to continue.

After the virtual machine restarts, you have a working setup of PCLinuxOS:


That’s all there is to creating virtual machines in VirtualBox. I use them to try out or test new software and operating system distributions. They are great for alpha or beta testing, but they have limits. VirtualBox provides pretty limited video emulation compared to VMWare’s VMWorkstation, as well as other areas. I’ll probably write a post comparing the two virtualization solutions. Right now, my money is on VMWorkstation (literally). OTOH, VirtualBox is free.

UPDATE 12/11/2008: Don’t forget to install Guest Additions in your new virtual machine. I posted directions are here.

In the meantime, enjoy!



  1. […] post, I covered the basic installation of Sun’s VirtualBox 6 into Ubuntu 8.10 Intrepid. Then, we created a virtual machine and installed PCLinuxOS into it. That’s not the end of the process, though. Like VMWare […]

  2. […] post, I showed how to set up Sun’s VirtualBox in Ubuntu 8.10 Intrepid. Then, I went through setting up a PCLinuxOS virtual machine in VirtualBox, followed up with how to install Guest Additions in that virtual machine. However, many folks […]


%d bloggers like this: