VirtualBox and PCLinuxOS 2007
I’ve been using Microsoft Virtual PC for years and love it, but there’s a new kid on the virtualization block that’s caught my eye; VirtualBox. To be fair, I haven’t tried the new Virtual PC 2007 just recently RTM‘d, but from what I’ve heard the new features aren’t all that revolutionary. I should also point out that I’ve never been a fan of VMWare, finding it a little bloated and (despite the marketing) doesn’t seem to perform as fast as other offerings. On the other hand, I’ve found VirtualBox to be easy to use, it has good support for guest OS’s (in our case Linux) and by my account, performs very well.
I’m not an avid Linux user (in fact, I’m quite a novice), but I occasionally get enough curiosity to try out a distribution. This time around, it was reading about PCLinuxOS 2007 that got me interested. I decided to give it a try using VirtualBox and much to my delight I had it up and running well in less than 30 minutes. If you’re also curious about Linux, trying it on a virtual machine is an easy way to get a little exposure. I thought my experience may be helpful to others, so here’s what I did to get it working:
Setting up PCLinuxOS 2007 in VirtualBox:
1. If you haven’t already, download VirtualBox and PCLinuxOS 2007.
You can get VirtualBox from here: http://www.virtualbox.org/wiki/Downloads. If you’re like me and run Windows XP, you’ll want the VirtualBox 1.4.0 for Windows Hosts binaries.
I recommend using BitTorrent to get PCLinuxOS 2007. The torrent file I used is: pclinuxos-2007.torrent (hash: 963bda027037a0b422beaa49b04e35dc34ec719c). If you would prefer a direct link, you can also get the image from the PCLinuxOS Download page.
2. Install VirtualBox using all the default options.
3. Start VirtualBox and create a new virtual machine by selecting Machine->New…. I named my new virtual machine “PCLinuxOS 2007″ and selected “Linux 2.6″ for the OS Type. I also gave the VM 512MB of RAM. For the hard drive I created a new “Dynamically expanding image”, keeping the default size of approximately 8GB and completed the wizard.
4. Before starting the virtual machine, enable audio support by selecting “PCLinuxOS 2007″ VM from the left pane and choosing: Machine->Settings…. From the settings dialog, select “Audio” on the left, check the box titled Enable Audio and choose “Windows Direct Sound” for the Host Audio Driver. Close the settings dialog by clicking OK.
I should emphasize that to use the mouse inside the virtual computer, VirtualBox must “capture” the mouse. This will redirect your mouse input inside the virtual machine and to “release” it again you must hit the Right Ctrl key on your keyboard.
5. Start the “PCLinuxOS 2007″ VM by selecting it on the left pane and choosing: Machine->Start. A new window will be displayed representing the virtual computer and you’ll see the boot process starting. You won’t get very far because we haven’t set up any bootable media yet. To do that, select Devices->Mount CD/DVD-ROM->CD/DVD-ROM Image…. From the Virtual Disk Manager, select: Actions->Add… and browse to the “pclinuxos-2007.iso” file you downloaded earlier. Close the Virtual Disk Manager by clicking Select. Now with our PCLinuxOS 2007 disc in the “virtual” CD drive, reboot the VM by choosing Machine->Reset. The virtual machine should now boot the CD.
6. To start PCLinuxOS select “LiveCD” from the menu. Remember that if you click your mouse inside the virtual machine window and want to get it back out you must hit the Right Ctrl key on your keyboard. Follow the PCLinuxOS setup wizard. When prompted for Date, Clock & Time Zone Settings I chose the first style (local time) and checked the Automatic time synchronization box. I also selected “Ethernet” for the network connection and after accepting all the default options, was greeted with the message “Congratulations, the network and Internet configuration is finished”. If all goes well, you’ll arrive at the login screen.
7. Log in to PCLinuxOS with the username: “root” and password: “root”. This will give us administrative privileges which is required to install the OS permanently. You should now see the beautiful blue PCLinux0S 2007 desktop. Take it for a spin. Everything is still running from the CD so if you mess something up, just reboot the VM and follow the process again from step 5.
8. When you’re ready to install PCLinuxOS to the virtual hard drive, double click the Install PCLinuxOS icon on the PCLinuxOS desktop. This will launch the Draklive-Install Enhanced. Follow all the default options in the wizard including the option to format the virtual hard drive (yes, this is your virtual hard drive, not your real hard drive). It took about 10 minutes to copy all the files on my computer. When prompted, supply a root password and create an account for yourself. At the end of the wizard you’re reminded to remove the CD (because we want to reboot from the hard drive) which you can do by selecting Devices->Unmount CD/DVD-ROM from the virtual machine menu. Click the Finish button. If the virtual machine doesn’t automatically reboot, you can do so within PCLinuxOS by clicking the “PC” icon in the lower left and selecting Log Out…->Restart Computer.
You now have a fully installed copy of PCLinuxOS 2007, but there’s more we can do to make the experience with a virtual machine a little better; namely, installing the VirtualBox Guest Additions. The Guest Additions will allow better integration with our mouse so that we don’t have to “capture” and “release” and also give us greater screen resolutions (amongst other things).
9. To install the Guest Additions, restart the virtual machine and log into PCLinuxOS as “root” using the password you created earlier. Once the desktop loads, select Devices->Install Guest Additions… from the virtual machine menu. Doing this automatically mounts a CD image that comes with VirtualBox. PCLinuxOS will recognize that a new CD is present and present a dialog. Select Open in New Window and click OK. A file-explorer like program called Konqueror will then display the files contained on the Guest Additions CD image.
10. The Guest Additions are meant to be installed from the command prompt, so open a terminal by clicking the “PC” icon in the lower left of PCLinuxOS and selecting System->Terminals->Terminal Program - Super User Mode. Navigate to the contents of the Guest Additions CD by typing:
cd /media/VBOXADDITIONS_1.4.0/
at the prompt. Beware that all terminal commands on Linux are case-sensitive. Then run the installer by typing:
sh ./VBoxLinuxAdditions.run all
The Guest Additions should install without any problems and you’ll be greeted with the message: “Successfully installed the VirtualBox Guest Additions. You must restart your guest system in order to complete the installation.” An easy way to reboot the system is simply typing:
reboot
while in the terminal. When the virtual machine restarts and you arrive again at the login screen, hopefully you’ll now have a window that’s 1024×768 pixels (instead of the measly 800×600 we were using before). This is a good indication that the Guest Additions are installed and working correctly.
If you’re installation has gone like mine up until this point you may notice a problem with the mouse in the virtual machine window. It no longer is being “captured” and may appear unresponsive. Another symptom may be that no matter where you click in the PCLinuxOS desktop the calendar dialog displays. One of the great features of the Guest Additions is that you’ll no longer have to “capture” and “release” the mouse, but on the other hand if the mouse if unresponsive or going haywire we clearly have a problem. I confess that we probably could have taken earlier steps to prevent this, but taking the steps now to fix it will give us some valuable experience. So if you’re having trouble with the mouse continue reading; otherwise, go get some ice cream because you’re done!
Troubleshooting:
1. Restart the VM by selecting Machine->Reset and when the PCLinuxOS boot menu comes up, select “Linux–Safe Settings”. This is equivalent to Safe Mode in Windows and will bypass all the GUI and divers, dropping us directly to a command prompt. Once at the command prompt type:
cd /etc/X11/
and then display the directory contents by typing:
ls
What we’re looking for here is a file called “xorg.conf”. This is the configuration file that holds some of our preferences for the GUI, like our mouse. We need to modify this file to get things working.
2. It’s worth making a backup of the “xorg.conf” file before continuing in case we mess something up. To copy the file type:
cp xorg.conf xorg.conf.tmp
This will make a copy of “xorg.conf” called “xorg.conf.tmp”, however, any name you supply will do. If you now type:
ls
again you should see the newly created file.
3. To edit the configuration file we’re going to use Vim, a command line text editor. (If you know of another program you prefer you’re welcome to use that. I chose Vim because it was one of the few that I found installed by default.) To open the file in Vim type:
vim xorg.conf
The contents of the “xorg.conf” file will now be colorfully displayed in the terminal.
4. Vim is one of the hardest programs to learn and so you’ll want to follow the commands carefully or Vim could be your new worst enemy. Page-down the document using the Page Dn key until the very end and you’ll arrive at a section like the one below:
Section "ServerLayout" Identifier "layout1" InputDevice "Keyboard1" "CoreKeyboard" InputDevice "Mouse1" "CorePointer" InputDevice "Mouse2" "SendCoreEvents" Screen "screen1" EndSection
The line we want to change is “Mouse2″. Simply commenting this out should fix our problem. To enable editing of the document within Vim you need to press the i key (for “insert mode”). Then use the arrow keys to navigate to the line:
InputDevice "Mouse2" "SendCoreEvents"
and comment it out by placing a “#” at the start of the line like this:
# InputDevice "Mouse2" "SendCoreEvents"
That’s it. To exit Vim and save the configuration file press the Esc key and then type “ZZ” (that’s two capital letter ‘z’s. I told you Vim was crazy-hard to learn). If you get lost, review the Vim quickstart link I provided below. Vim will then exit with the line:
"xorg.conf" 111L, 2769C written
or something similar. You did it! Now reboot the VM as we did before by typing:
reboot
When you arrive again at the login screen you should now be able to pass your mouse right over the virtual machine window and click items underneath without problems. You’ll notice the cursor change to the PCLinuxOS cursor and you’ll be able to move it back out of the window without having to “release” it.
You’re done; now go get some ice cream. I hope this guide has been helpful (even thought I tend to be a little verbose in my instructions).
So what am I supposed to do now that I have a working Linux install?
Resources:
If you’re new to Linux like me or have any trouble completing the above instructions, you might find some of these resources helpful:
- LinuxCommand.org - easy to follow lessons on the Linux shell.
- Vim Tutorial (particularly the Getting started section).
- VirtualBox Community - where I found the answer to the PCLinuxOS Mouse Problem.
Updated [9/11/2007]: Changed the description of the mouse integration problem to better reflect some of the comments.
August 5th, 2007 at 12:30 pm
Hi,
Enjoyed the tutorial on installing PCLinuxOS as a VM using VirtualBox. Have one problem to which you may the answer. How do you set up a shared folder in PCLinuxOS? I am running Win Vista as host, and have WinXP plus Ubuntu6.1 set up as guests. I have a shared folder setup with those o/s which works fine, but cannot seem to get it setup with PCLinuxOS. All o/s are on the same computer. Appreciate any advice.
Cheers
Frank
August 6th, 2007 at 3:14 pm
I’m sorry that I don’t have an answer. I’ve been so busy lately that I’ve barely had a chance to work with PCLinuxOS since I installed it.
If you find the answer though I would appreciate you letting me know.
Jacob
August 14th, 2007 at 5:24 am
excellent, thanks much for this. i just installed pclos in VB and had a prob after the guest-additions. i would get nothing but the calendar anywhere i clicked. i would never have identified this problem as a capture-release issue but out of desperation i tried your solution to comment out the “sendcoreevents” line and it worked for me.
here’s a shot of it. no matter where i click in the virtualbox window i get the calendar.
http://img463.imageshack.us/img463/2576/pclinuxos104vy6.png
thanks again.
September 11th, 2007 at 9:22 am
Im having the same problem as steve. Wherever i click, calender pops up. Is this a problem with VBox or PCLinuxOS?
September 11th, 2007 at 5:50 pm
It’s really a problem with the guest additions installation and not with VirtualBox or PCLinuxOS per se. As mentioned above in the post and Steve’s comments, when the guest additions are not functioning properly and the mouse integration is haywire, one of the symptoms may be that no matter where you click in the VirtualBox window, PCLinuxOS will always react as if you’re clicking in the bottom right of the screen. Of course clicking in the bottom right of desktop in PCLinuxOS 2007 would be where the clock is and hence the calendar dialog will display. In other words, the mouse integration is broken and the mouse position is not where it should be.
Following the solution above should get the mouse working properly with the guest additions.
Cheers
October 6th, 2007 at 6:40 am
Thank you for sharing!
October 10th, 2007 at 6:29 pm
to share your linux host directory with virtual box:
http://wiki.archlinux.org/index.php/VirtualBox
Basically just do this
create a folder/directory under /mnt
# mkdir /mnt/share
then run:
# mount -t vboxsf sharename /mnt/share
where sharename is the name you specified when specifying the shared folder in virtual box
November 8th, 2007 at 10:15 pm
on the issue where you comment out the following link in the xorg.conf
# InputDevice “Mouse2″ “SendCoreEvents”
this can be done from a virtual console and doesn’t require a reboot to do it.
Simply use the left ctrl & alt with F1. Log in. Then edit the xorg.conf to include the commented line and save your changes.
Then when complete use ctrl & alt F7 to get back to the screen where the mouse has go wiggy and using the right set of ctrl & alt.. Depress them and hit the backspace key. This will kill the Xsession. Then use the same step again to restart the X server. It will then pick up all the changes nicely.
Rob
November 22nd, 2007 at 6:31 pm
Hi Jacob,
Many thanks for your simple concise instructions for installing Virtual Machine it worked a treat!! .. I had tried the command line install (as a Noobie) without success.
My vbetry best to you Geoff