April 15, 2007

How to install Virtualbox in Ubuntu Feisty

04 October 2008
This post is considerably outdated. Virtualbox 2.0 and Ubuntu Intrepid (8.10) have been released. So while some of the steps might still be valid, it would be wiser to refer to the current documentation.


Virtualbox is a new opensource virtualization solution made by Innotek. It has all the features that vmware offers and is a smaller download and easier to install. It therefore appears poised to replace vmware as the main virtualization software in Ubuntu. This is a brief howto for installing Virtualbox on Ubuntu Feisty. It is based on two installations I did recently. By providing the relevant instructions on one page, I hope to make it easier for others to follow. Any feedback about problems or suggestions to improve the tutorial are welcome. Here we go.

First install the dependencies that are not present in Feisty by default.

sudo aptitude install libqt3-mt libxalan110 libxerces27

Now download the debian package for edgy and install it.

*UPDATE: A debian package is now available for Feisty. Replace 'edgy' with 'feisty' in the next two lines to use it.

cd /tmp
wget http://www.virtualbox.org/download/1.3.8/VirtualBox_1.3.8_Ubuntu_edgy_i386.deb
sudo dpkg -i VirtualBox_1.3.8_Ubuntu_edgy_i386.deb

You will have to accept the PUEL license and select "yes" when asked if the vboxdrv kernel module should be compiled. The kernel should be created successfully now. A group called vboxusers is created and you have to add yourself as a user of this group.

sudo adduser $USER vboxusers

If you want to access usb devices from the virtual machine, follow these steps. You can omit them and directly reboot if you are not going to be using usb devices from the guest.

sudo addgroup usbfs
sudo adduser $USER usbfs

** For the next step you have to know the id for the usbfs group that you have created. To do this try

cat /etc/group | grep usbfs

and look for the number after "usbfs:x:". In the next command, replace 1002 in the next command with this number**
echo "none /proc/bus/usb usbfs devgid=1002,devmode=664 0 0" | sudo tee -a /etc/fstab

Now reboot to allow the new group and user permissions to be updated.

start VirtualBox

VirtualBox &

Once you create a virtual machine and install an OS on it, you may want to set up a shared folder between the host and the guest. Suppose the name of the virtual machine is "winXP" and the folder you wish to share is at /home/user/shared. Power off the virtual machine and then do this :

VBoxManage sharedfolder add winXP -name "sharedfolder" -hostpath "/home/user/shared"

Now you can mount the shared folder within the guest. For a windows guest you would boot up and then in the terminal type

net use G: \\vboxsvr\sharedfolder

Now you should be able to access the shared folder from within the guest and the host systems. To access a USB device from the guest, select the device in the USB controller in VirtualBox and enable it. Remember that the device may not be accessible to the guest if it is mounted in the host.


Edit (21 April 2007) - Corrected command for appending line to fstab. Thanks to ebash from Ubuntu forums for pointing out the right way to do it.


Powered by ScribeFire.

26 comments:

Anonymous said...

And *that* is easier than VMWare Workstation? Not for me...

Raja said...

Well, I am not sure what you find difficult there. If you dont want USB support, there is nothing more to do than installing with the deb package. Remember that installing vmware server in Ubuntu Feisty has been quite difficult, requiring patching the source code or other hacks. And setting up a shared folder needs messing around with samba.

dompie said...

OK, raja, I did exactly (in Feisty) what you said, I have the VB screen, Icreated a VM = WinXP, I inserted the (official)WinXP cd, I mounted the cdrom (/dev/cdrom/ AND
I have a screen with the contents of the WinXP cd and that's it.
What now?

Raja said...

Hello dompie,
Glad to hear the VB installation was smooth. So, are you not able to boot into the cd? Is it a bootable cd (I know some XP cds are only for an upgrade from a pre-existing windows installation). If that is the problem, I have found it easy to use bart's PE builder to create a bootable cd.

Anonymous said...

Hi...I am trying to share a folder with the instruction you have given and when I try to create the share in terminal I get a bash command VBoxManage not found error. Do you know what I am doing wrong??

thanks in advance.

scott

Raja said...

Hello Scott,
Are you saying that VirtualBox is installed and running, but 'VBoxManage' doesnt work from the terminal ?
That is odd. Can you check that your spelling is correct (especially case)? Can you also check that you have the file /usr/bin/VBoxManage ?

Anonymous said...

One small problem I had with the following instructions was the usbfs line added to fstab. It did not append on a newline so the last line of my fstab was run together. I suggest the following change:


echo "\nnone /proc/bus/usb usbfs devgid=1002,devmode=664 0 0" | sudo tee -a /etc/fstab


Otherwise, everything worked just fine. Thanks.

Arun said...

Do you know how to come out of fullscreen? I started it in full screen and when I press the right ctrl key, i get the control out of Windows, but still Windows stays as full screen. I’m not able to go back to Ubuntu box. It starts in full screen the next time i start virtualbox. Any suggestion?

Raja said...

Anon who suggested the newline -
You are right. The best way to do this would be to insert a newline before and after the required line.

Arun,
Right Ctrl + "F" will get you out of fullscreen mode.

Arun said...

Raja,

Thanks that worked. I have another question. I created a shared folder with the command
VBoxManage sharedfolder add WinXP -name "sharedfolder" -hostpath "/home/myusername/Documents".
I then started the virtual OS and then entered the command
net use G: \\vboxsvr\sharedfolder
in ubuntu terminal and got the following error.
No command: use
Please help.

Raja said...

Arun,
Sorry if it was confusing. You have to type that in the windows cmd.exe. Not in the Ubuntu terminal.

Arun said...

I tried in Windows command line too. If I give
net use G: \\vboxsvr\sharedfolder
then I get
System error 85 has occurred
The local drive name is already in use.

Arun said...

I'm sorry Raja. G was being used by my compact flash drive. I tried M and it worked. Thanks for the help.

Raja said...

Arun,
Did you try a different drive name in that case - maybe you have a drive with name G: already!

Arun said...

I did reply back immediately saying I tried a different drive and it worked. I'm not sure if you got that.
Thanks for the help.

Arun said...

Raja,

How do I make the Windows really full screen? When I select the full screen option, it takes the full screen, but the window is only the square in the center. The OS doesn't take the full window. Any idea?

Anonymous said...

Hello! and thanks for your help. I will try this as soon as I get home. By the way, I couldn't make my pendrive work under winxp virtual box. Any suggestions on that?

Thanks again,
German Lorenzo (writing from Buenos Aires, Argentina).

jubin said...

strange thing..when i try to set up the share in kubuntu, I get an error. I tried this with different folders. Even a new one I created just now. Text for Error message goes like

[!] Text = Shared folder path '“/home/a/jubin”' is not absolute

Anonymous said...

I have tried 3 times to install VirtualBox, added users and all the other stuff. Starting VirtualBox give critical error


Could not load the settings file '/home/oddvar/.VirtualBox/VirtualBox.xml' (VERR_OPEN_FAILED).
FATAL ERROR: Attribute 'LogHistoryCount' is not declared for element 'SystemProperties'
Location: '/home/oddvar/.VirtualBox/VirtualBox.xml', line 26, column 159.


Result Code:
0x80004005
Component:
VirtualBox
Interface:
IVirtualBox {e1d95593-f579-4f47-b489-0b67181014e1}

It also belong to the story, that I have installed VirtualBox sucessfully before in my Feisty and removed it because I find Vmware to function better. This time I want to install Ubuntu Gutysy in a virtual machine to give it a try before deciding to upgrade.

Jason said...

I get this as an error, when trying to mount the share my friend.
Could you perhaps tell me why it won't...

Microsoft Windows [Version 6.0.6000]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.

C:\Users\Zune>net use J: \\vboxsvr\music0
System error 67 has occurred.

The network name cannot be found.


C:\Users\Zune>

This is my accompanying ubuntu commands used to make my shares

thursday@Yggdrasil:~$ VBoxManage sharedfolder add 'Windows Vista' -name "music0" -hostpath "/home/thursday/Music"
VirtualBox Command Line Management Interface Version 1.5.6
(C) 2005-2008 innotek GmbH
All rights reserved.

thursday@Yggdrasil:~$ VBoxManage sharedfolder add 'Windows Vista' -name "music1" -hostpath "/media/Athena/Users/Home/Music/"
VirtualBox Command Line Management Interface Version 1.5.6
(C) 2005-2008 innotek GmbH
All rights reserved.

thursday@Yggdrasil:~$

Anonymous said...

I've successfully installed Virtualbox and I was able to get USB to work. However, my virtual machine doesn't see my external drive or any of my flash drives. I'm also having issues getting the shared drive to work. I followed the instructions to share the drive after I typed in the VBoxManage sharedfolder add Windows -name 'winxp' -hostpath '/home/user/winxp' I got back VirtualBox Command Line Management Interface Version 1.5.6_OSE
(C) 2005-2008 innotek GmbH. When I tried to enter the net use G: \\vboxsvr\winxp I got back an error 53 The network path was not found? What did I wrong? Also, is there anyway for the virtual machine to see the other drives and files on my system?

Thanks.

Anonymous said...

Hi there nice tutorial,I have a problem adding a shared folder,
it gives me this error in Windows

System error 67 has occurred

The network name could not be found.

I followed the steps exactly.

thea said...

Hi there, i have an ubuntu hardy as a host system and winXP as a guest in VBox, i tried the usbfs solution but it didnt work, i still cannot see any usb pen or other usb device, except from my mouse which is probably emulated. Any idea? If you need any additional info i am happy to provide it! Thanks!

Anonymous said...

Thanks. That's exactly what i needed. Simple and out of the box. For the guys confused with errors do not forget to put a space between "G:" and the "\\".

Anonymous said...

Thank you!! This USB-trick (still?) works great! It also did the trick in Debian "Sid" so I'm sooooo in love with you right now!!

Havent gotten those shared folders to show, yet...but i'm on it!

Salute\ SSamiK @ ubuntuforums

Anonymous said...

Hi guys!!!
For everybody that finds system error 53 or 67 when sharing in windows, remember two important things:

1.- Before trying to shared anything, install first the "Virtual Box Guest Additions", that can be accesed from the "Devices" menu in your guest host window.
2.- Remember to let a espace between Z: and \\vboxsvr\...

Hope work for you.