Installing Virtualbox and Windows in Ubuntu

115 Comments
Tags: , , ,
Posted 07 May 2007 in Ubuntu

I have successfully installed Virtualbox in my Ubuntu Feisty Fawn desktop. Installation was pretty simple. Configuration and installing Windows took some time. I’m listing the steps I followed to get it installed and configured.

How to install Virtualbox in Ubuntu Feisty Fawn:

Go to Virtualbox download site and download the binary file compiled for your OS. I installed it on Ubuntu Feisty Fawn, so my tutorial is based on Feisty Fawn installation. I downloaded the binary package for Feisty Fawn from here. Open a terminal after the download is complete. Go to the folder where you downloaded the file. Enter the following command to install Virtualbox.

sudo dpkg -i filename (in our case it’s VirtualBox_1.3.8_Ubuntu_feisty_i386.deb).

This should install Virtualbox in your system. Once the installation is complete, you can start the Virtualbox by going to Applications -> Systems -> Innotek Virtualbox. Before you start using Virtualbox, go to System -> Administration -> Users and Groups. Click on Manage Groups button on the right. Scroll down until you see vboxusers in the list (see below):

Vbgroup

(Manage Users)
Vbgroup1

(Vboxusers)

Click on Vboxusers and click Properties button on the right. You’ll see a screen as shown below with the list of users. Check the users to whom you want to give access to Virtualbox. Click OK and close the boxes.

Vbgroup2

(Vboxuser group)

Once you attach the Vboxusers group to the users, change permission to access USB devices. Open a terminal and enter

gksudo gedit /etc/udev/rules.d/40-permissions.rules

Change the line that says

SUBSYSTEM==”usb_device”, MODE=”0664″

to

SUBSYSTEM==”usb_device”, MODE=”0666″

Save and reboot your system.

Update: If you are using Ubuntu 8.04 Hardy Heron, refer to this instruction to modify the 40-permissions.rules file.

Once logged in, start Virtualbox from the menu. You’ll see a screen similar to one shown below. My screen is blank because I deleted the default one. You can use either the default one or you can create a new one. I’m going to explain how to create a new one.

Virtualbox1

(Virtualbox started)

Click on the New button on top left. You’ll see an installation wizard as show below:

Virtualbox2

(Installation Wizard)

Click next. Enter a name for the virtual machine. I gave WinXP to show it’s Windows XP installation. Select the OS type you want to install. It’s Windows XP in my case. Click Next.

Virtualbox3

(Name and OS type)

The next screen is where you allocate memory to the virtual machine. I have 1GB RAM, so I allocated 512MB to the virtual machine. The more the better, but then it might slow down your Ubuntu installation if your virtual machine memory allocation is more than Ubuntu’s. Click Next.

Virtualbox4

(Memory Allocation)

The next step allows you to create a virtual hard drive for the virtual OS. You can create a new one or use an existing one, if you had already created one. It’s going to be a new one in my case, so I selected New.

Virtualbox5

(Hard drive)

It opens another Wizard to allocate hard drive space as shown below. Click Next

Virtualbox6

(New wizard)

Now you have two options to create a virtual drive. The first option is to dynamically expand the space and the second one is to create a fixed size. If you have enough space, then select the first option. You still have to allocate the maximum space, but it’ll fill that as it gets filled. You can’t allocate 1GB and think it’ll add more space as it needs. It didn’t work like that for me the first time I created. I created with 2GB and thought it would add more as it needs, but it errored out due to lack of space (it filled the 2GB) even before the SP2 installation could complete. I think it takes more space from the allocated space as it needs. The fixed size image option takes the entire space at one time. I went with the 1st option. Click next after you choose whichever option you want.

Virtualbox7

(disk option)

Now give a name for the virtual disc image file and select the size you want to allocate. I gave the name as WinXP, so it created a file called WinXP.vid. I allocated 6 GB. Click Next.

Virtualbox8

(disk size)

Click Finish in the next step to finish the virtual disk creation and Click Finish again to finish the Virtual OS creation.

Virtualbox9

(Finish)

Now comes to OS installation part. Before you install the OS, Click on the virtual machine you just created and click on the settings button on top. It’ll show you all the configurable settings. Under the general setting, you can resize the RAM settings and you can also adjust the video memory setting. I have 256MB video card, so I allocated 128 MB for video.

Virtualbox10

(general setting)

Click on CD/DVD-ROM on the left side. Once you are there, Check Mount CD/DVD drive and select your CD/DVD drive from the drop down box. My default CD drive is /dev/cdrom, so I selected that. I had problem with Edgy when I tried to install Virtualbox in Edgy. Virtualbox didn’t detect my CD drive. I didn’t have that problem with Feisty version.

Virtualbox11

(CD drive)

The next step is Audio. Click on Audio on the left side. I’m not sure if this step is needed, but I did it anyway. It may work without doing this step. Check Enable Audio and select ALSA Audio Driver.

Virtualbox12

(Audio)

Click on the USB option. Check Enable USB Controller. Click on the tiny USB cable icon with small green dot on the right. It’ll show you all available USB devices. Add those to the filter (picture below). This won’t load the USB devices automatically when you boot the virtual OS, but it’ll give you an option to load them when you want.

Update: If you are using Ubuntu Gutsy Gibbon or Ubuntu Hardy Heron, Ubuntu removed support for /proc/bus/usb/*. Open a terminal and enter

sudo gedit /etc/init.d/mountdevsubfs.sh

Go to the lines as shown below:

#
# Magic to make /proc/bus/usb work
#
#mkdir -p /dev/bus/usb/.usbfs
#domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
#ln -s .usbfs/devices /dev/bus/usb/devices
#mount –rbind /dev/bus/usb /proc/bus/usb

Uncomment the last 4 lines and make it look like below:

#
# Magic to make /proc/bus/usb work
#
mkdir -p /dev/bus/usb/.usbfs
domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
ln -s .usbfs/devices /dev/bus/usb/devices
mount –rbind /dev/bus/usb /proc/bus/usb

If you are using Ubuntu 8.10 Intrepid Ibex, You won’t find those lines. Add those lines inside do_start() function before closing }. The file should look like this:

do_start () {
#
# Mount a tmpfs on /dev/shm
#
SHM_OPT=
[ "${SHM_SIZE:=$TMPFS_SIZE}" ] && SHM_OPT=”,size=$SHM_SIZE”
domount tmpfs shmfs /dev/shm tmpfs -onosuid,nodev$SHM_OPT

#
# Mount /dev/pts. Master ptmx node is already created by udev.
#
domount devpts “” /dev/pts devpts -onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE

#
# Magic to KEEP /proc/bus/usb working
#
mkdir -p /dev/bus/usb/.usbfs
domount usbfs “” /dev/bus/usb/.usbfs usbfs -obusmode=0700,devmode=0600,listmode=0644
ln -s .usbfs/devices /dev/bus/usb/devices
mount –rbind /dev/bus/usb /proc/bus/usb

}
case “$1″ in
“”)

If you are using Ubuntu 8.10 Intrepid Ibex, type the following command in a terminal:

grep vboxusers /etc/group

You should see something like this

vboxusers:x:123:username

Open the fstab file by issuing the following command:

sudo gedit /etc/fstab

Add the following line

none /proc/bus/usb usbfs devgid=123,devmode=664 0 0

Save and exit.

Reboot and continue with the rest of the setup.

Close and restart virtualbox. You should see the USB options in the settings. You can add the devices you want. Thanks to Virtualbox for the information.

Virtualbox13

(USB)

Click OK. You are now ready to start the installation of virtual OS. Put the Windows XP installation CD in the CD drive. Select the virtual machine you created from the Virtualbox and click the Start icon on top. It’ll start the installation of Windows. Windows installation will show you the virtual disk as the disk to install. Format it and install the OS. Once the installation is done and you login, you can select the USB devices you want to install from the menu. Select mount option from the VM menu and select the USB devices you want to mount.

Virtualbox starts the virtual OS in a small window. You can run it full screen by selecting full screen in the menu. Once you click on virtual OS, the control of your mouse, keyboard and USB devices go to the virtual OS. If you want to get the control back to your Ubuntu box, click the CTRL key on the right side of the keyboard. This will give the control back to the original OS.

I hope this helps you to setup your virtual machine. If you have any suggestion, please leave a comment. I felt Virtualbox is little slower compared to VMWare server and also slowed my Ubuntu machine a little bit, but the real advantage are, Virtualbox is open source and it supports USB devices like webcam without paying $$$s.

Update: Read my post Configuring Virtualbox for sharing and mouse control for more configuration options.

Technorati Tags: , , , ,


76 Comments

  1. PHiL

    i have ubuntu 9.1 how do i allow the USB for this distribution?

    Reply
    • My initial try to enable the USB messed up the system. I haven’t tried it again in Ubuntu 9.10. I might do it during the holidays. I’ll let you know if I figure out how to do it.

      Reply
  2. Alex

    Thanks for your tips on USB regarding Ubuntu.

    I have the same problem,my system is Ubuntu Jaunty and guest windows xp.VirtualBox2.2

    Can you please give suggestions to solve this problem to detect usb/ipod in windows xp,which is my guest os.

    Much appreciated thanks.

    Reply
  3. Rahul,

    The second paragraph of my post says “Go to Virtualbox download site and download the binary file compiled for your OS.” This implies what you wrote.

    Reply
  4. Rahul Goyanka

    For intrepid, i had to do install the latest virtualbox 2.1.4 beyond what is given on this blog to enable usb option. Without that virtualbox doesn’t show the usb option. Something worth putting in blog i guess. To install virutalbox 2.1.4 one can follow http://www.virtualbox.org/wiki/Linux_Downloads link

    Reply
  5. MickPatten

    Arun,

    I had a similar issue with my WinXP client.

    I know it’ll seem simple – but this worked for my guest re-sizing issue;

    Have you tried minimising the client window in Ub, then restored it and clicked the “Auto Resize Guest Display” under the “Machine” menu?

    Can’t help with the video driver style issue – i have the same thing when I tell my XP guest to “restart”, yet “shutdown” works fine! :S go figure! (hopefully soon i can leave it permanently shut-down!!!)

    Michael.

    Reply
    • I didn’t try that. What I do now is increase the screen resolution in Windows to get the screen bigger. It works for me since I don’t start Windows quite often.

      Reply
  6. Robin,

    This is what I have in my 40-permissions.rules.
    # USB serial converters
    SUBSYSTEM==”usb_device”, GOTO=”usb_serial_start”
    SUBSYSTEM==”usb”, ENV{DEVTYPE}==”usb_device”, GOTO=”usb_serial_start”
    GOTO=”usb_serial_end”
    LABEL=”usb_serial_start”
    ATTRS{idVendor}==”0403″, ATTRS{idProduct}==”6001″, \
    ,GROUP=”vboxusers”, MODE=”0666″, GROUP=”dialout”
    LABEL=”usb_serial_end”

    Reply
  7. Robin B

    Thanks.
    Well, I haven’t tryed install Windows yet, but everyting works so far.

    Reply
  8. The file is different in Hardy. I’ll check and tell you. Does it work without making changes to that file?

    Reply
  9. Robin B

    Hello!
    It’s a good guide! But I cant find the “row SUBSYSTEM==»usb_device», MODE=»0664»”

    It’s not in that file. Everything in that file about USB is:
    # USB serial converters
    SUBSYSTEM==”usb_device”, GOTO=”usb_serial_start”
    SUBSYSTEM==”usb”, ENV{DEVTYPE}==”usb_device”, GOTO=”usb_serial_start”
    GOTO=”usb_serial_end”
    LABEL=”usb_serial_start”
    ATTRS{idVendor}==”0403″, ATTRS{idProduct}==”6001″, \
    MODE=”0660″, GROUP=”dialout”
    LABEL=”usb_serial_end” ”

    How do I make my USB work?

    Reply
  10. I’m sorry Artic. I’m not sure how to fix your issue. I also don’t have Win 98 or Me to test.

    Reply
  11. Artic

    Not sure what the issue is. I have virtualbox on my XP os and it works great when I do the mouse. I found that the screen is still does not enlarge on the PC as well. Also, can anyone tell me why Icannot get win98,95 or me loaded on virtual box? It is not only an Ubuntu issue either. Everytime I load the os’s, they video is scrambled. It never popps up to the desktop, it just has a bunch of colors, like there is a video issue. Doesn’t matter what OS I use, it comes out the same way.

    Reply
  12. Artic,

    I’m not sure why it’s not taking control of your laptop mouse. What happens when you click inside the virtual machine window? See if you can get the mouse to work by installing the Guest Addon as given here
    http://www.blog.arun-prabha.com/2007/05/21/configuring-virtualbox-for-sharing-and-mouse-control/
    I
    I couldn’t get the full screen to work properly, so what I do is, I increase the screen resolution inside the virtual OS.

    Reply
  13. Artic

    Also,

    how do I get the video to FULL SCREEN? I click full screen and it still the same size just the black boxes around are still there. It is frustrating.

    Reply
  14. Artic

    I love the tutorial, I have one issue with my installation. I cannot get my VM to capture my mouse. I cannot control anything. I am using my laptop mouse and I just cannot get it to work. Any ideas on what this is? I would appreciate it. I had to tab the whole installation, but I need the mouse for the XP GUI! LOL

    Thanks for any input!!!

    Reply
  15. You are welcome Joe.

    Reply
  16. Joe

    Very good guide Very helpfull I setup my VMB following your guide,Thank you very much

    Reply
  17. D-Rab,

    If you installed Virtualbox through Synaptic, which is an open source version, then it won’t support USB. If you downloaded it from Virtualbox site, then try the procedure in the update section in this guide.

    Arun.

    Reply
  18. D-Rab

    Everytime I try to enter the Settings screen, I get this error:

    Could not load the Host USB Proxy Service (VERR_FILE_NOT_FOUND). The service might be not installed on the host computer.

    Result Code:
    0×80004005
    Component:
    Host
    Interface:
    IHost {81729c26-1aec-46f5-b7c0-cc7364738fdb}
    Callee:
    IMachine {31f7169f-14da-4c55-8cb6-a3665186e35e}

    Any ideas?

    Reply
  19. Chack, How did it go?

    Reply
  20. chack

    nice guide… actually setting it up as i type this.. so i’ll post again to my successes and problems

    Reply
  21. I didn’t try it in Hardy yet.

    Reply
  22. nanog

    It looks like the usb hack does not work in hardy.
    I have VB running perfectly in gutsy.

    Reply
  23. You are welcome Erik. :)

    Reply

39 Trackbacks/Pingbacks

  1. Chạy mtdEVA trên MAC và LINUX | [K]4[V]N.NET-All Keys For You! 07 01 10
  2. Installing VirtualBox to Run Windows XP Home Edition on Ubuntu Jaunty | Duq Amuq 31 10 09
  3. Testing VirtualBox in Feisty « CognitiveCombine.com 22 09 09
  4. Sky Blog: TRICONG » Chạy mtdEVA trên MAC và LINUX 02 09 09
  5. Arun’s Blog » Configuring Virtualbox for Sharing and Mouse Control 02 07 09
  6. Notee Design - Web Design, Trends & Tutorials 07 01 08
  7. ThatDE 02 02 08
  8. nokitel.co.uk - BITCHFEST 04 11 07
  9. Dating Store 04 11 07
  10. Unix Mouth 02 11 07
  11. CognitiveCombine 20 10 07
  12. Laptop Computers 20 10 07
  13. La Web A 16 03 10
  14. Tech Blog 16 03 10
  15. Multiply NiMaL - Nimalaprakasan's 27 06 07
  16. Catshanghai 30 09 07
  17. Tales of the Questions of Kermix 16 03 10
  18. My New Direction 16 03 10
  19. del.icio.us 10 05 07
  20. Kevin’s blurry train of thought…… » Kevin Hatfield’s Blog 10 05 07
  21. All guts, no glory 19 05 07
  22. mcmlxxii | I keep getting stuck 09 05 07
  23. The Programming and Management Blog 09 05 07
  24. reddiggulo.us - The Most Recent Popular Stories 09 05 07
  25. Linux Unix News - Linux Unix Article - Linux Unix Download | Linux Unix Information 10 05 07
  26. Kevin’s blurry train of thought…… » Kevin Hatfield’s Blog 10 05 07
  27. LiveinInternet 10 05 07
  28. ViralBabble.com - The best of del.icio.us, Digg, Lifehacker, YouTube, Fark, Slashdot, iFilm, Gizmodo, Furl and Reddit 07 05 07
  29. Tons of Fresh News 09 05 07
  30. AlbanyWiFi.com 10 05 07
  31. Jorge Yau - Diseñador Web 10 05 07
  32. Hock Show | The Internet is mostly suck... and we prove that. 10 05 07
  33. Top Web Stuffs - Aggregating The Best Web Stuffs on The Web Delivering all about Ajax, Google, Web 2.0 Reviews, Jobs, Gadgets, 10 05 07
  34. del.icio.us 10 05 07
  35. Jorge Yau - Diseñador Web 10 05 07
  36. JANVIER's Memo 10 05 07
  37. openedtech 10 05 07
  38. Nogz Tumblz 10 05 07
  39. Crooked Press 11 05 07

Add Your Comment