Installing Virtualbox and Windows 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: , , , ,

This entry was posted in Ubuntu and tagged , , , . Bookmark the permalink.

116 Responses to Installing Virtualbox and Windows in Ubuntu

  1. Arun says:

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

  2. Robin B says:

    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?

  3. Arun says:

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

  4. Artic says:

    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.

  5. Arun says:

    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.

  6. Artic says:

    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.

  7. Artic says:

    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!!!

  8. Arun says:

    You are welcome Joe.

  9. Joe says:

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

  10. Arun says:

    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.

  11. D-Rab says:

    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?

  12. Arun says:

    Chack, How did it go?

  13. chack says:

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

  14. Arun says:

    I didn’t try it in Hardy yet.

  15. nanog says:

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

  16. Arun says:

    You are welcome Erik. :)

  17. Erik says:

    Thank’s a lot!!!
    I searched all over the internet and this is the only tutorial that shows me a guide I want!!!

  18. Arun says:

    I forgot how I did that. I don’t have Ubuntu system with me now. I’ll check when I go home and get back to you. Did you try installing the Guest Addon? If not, refer http://www.blog.arun-prabha.com/2007/05/21/configuring-virtualbox-for-sharing-and-mouse-control/
    Guest addition might help you to maximize the virtual OS screen by normal way (just how you maximize any application in Ubuntu or Windows.

  19. mariner says:

    Hi Arun
    Further to my last comment, there was just one small thing that I would like to ask you – how do I make the guest os into a full screen – I have f/f as my main os and have winxp as guest – if I increase the resolution settings in winxp then it cuts off the start button bottom left – any suggestions ?
    Mariner

  20. mariner says:

    Hi Arun
    Thanks for a great tutorial – worked 1st time perfectly (feisty fawn) – and considering I’m only ‘aspiring’ to become a newbie on linux is a testement to your tutorial skills.

    Mariner

  21. Arun says:

    You are welcome Skender. I would appreciate if you could leave a comment on how you fixed it, so it’ll help for future reference.

  22. Skender says:

    Arun,
    Thanks a lot for your response. I actually fixed the problem. VirtualBox documentation (page 117 I think) helped me change some settings. Now USB is recognized and I could get my skype video working. Thank you so much for your excellent how-to.
    Skender

  23. Arun says:

    Skender,

    A silly question, Does the USB Devices in the virtualbox menu show your usb webcam? Sometimes the usb devices will be detected, but won’t be loaded unless you select them manually from the menu. Since it detected your printer, I assume that you are not using the open source version of Virtualbox. I’m not sure what else could be the problem. If the usb camera is detected by the vitrualbox, but not working in Windows, then it could be thee driver problem too.

  24. skender says:

    To give you a little background. I recently purchased a Dell with Ubuntu on it. It perfectly fits my needs except for the webcam. I use Skype Video on a regular basis, and Skype didn’t recognize my webcam Creative Live, even though the webcam works with Ekiga. From what I read there is a bug somewhere that is currently being worked on.
    Anyway. I decided to give vritual windows a shot. I followed the instructions above and th installation worked as a charm. Thanks a lot. However, my virtual windows still doesn’t see my webcam. It does however, recognize my printer hooked up via USB. So USB ports do generally get picked up. At this point, my next stop is a dual boot system, but I was hoping if there were something I have missed. Any help would be greatly appreciated. Thank you!

  25. quixote says:

    Hi Arun!

    Yes, I saw that post and changed the usb settings the way it is in the post you linked to. Before that it couldn’t see the usb at all. After that, I could define it as a shared folder, at least, which has to be a good sign (?). I haven’t played with it in the meantime.

    (But having virtualbox-winxp-ie has already saved me from major aggro with my stupid ISP whose customer service site only works under IE…. One of those good news – bad news situations. ;-) )

  26. Arun says:

    Quixote,

    The one in Synaptic is open source edition. It doesn’t support USB. You have to download from Virtualbox site. See my post
    http://www.blog.arun-prabha.com/2007/10/26/usb-not-working-with-virtualbox-in-ubuntu-7-10-gutsy-gibbon/
    I’m not sure about the reason for your formatting problem. Both 512 and 256 worked for me.

  27. quixote says:

    I installed Virtualbox via Synaptic under Gutsy, and made the changes Arun mentioned so it could see USB.

    Several attempts to install winxp failed because it kept hanging up when it came time to “format the disk” It seemed like some kind of buffer or memory problem (??) because it got to 20% formatted before hanging when I tried “quick FAT” rather than the default it was selecting (regular NTFS). Then formatting would hang right from the start.

    What finally worked was setting memory allocated to Windows at 256MB (I have a total of 1GB and had been giving it 512) and selecting “NTFS Quick format”. I’m not sure which of those two did the trick, or whether both were needed. By then, I wasn’t in the mood to start over yet again!

    USB thumbdrive doesn’t show up as a mounted drive, the way it should judging by Arun’s screenshots. But I can define it as a shared folder in vbox Settings. I still haven’t found where I can access it in WinXP. I ran “net use c:\\vboxsvr\my-share-name” but that hasn’t done anything noticeable. A project for another day….

  28. Arun says:

    You are welcome Skydancer.

  29. Skydancer says:

    Thanks for this great HOWTO! The section about Gutsy and USB provided me with help to set up my scanner in VirtualBox again. Thanks!

  30. Arun says:

    Arnab,

    From what I found, If your installation has old kernel driver. To solve this, open a terminal and type the following 2 commands and start the virtualbox.
    rmmod vboxdrv
    modprobe vboxdrv

  31. Arnab says:

    I have successfully installed VirtualBox (v1.5.0). I am using Ubuntu 7.04 – the Feisty Fawn – released in April 2007. But when I am trying to start windows installation I get the following error.

    Unknown error initializing kernel driver (VERR_VM_DRIVER_VERSION_MISMATCH).
    VBox status code: -1912 (VERR_VM_DRIVER_VERSION_MISMATCH).

    Result Code:
    0×80004005
    Component:
    Console
    Interface:
    IConsole {1dea5c4b-0753-4193-b909-22330f64ec45}

    Can anybody tell me how to overcome this error??????????????

    Thanks in advance

  32. Nate says:

    @pepe – You can create a launcher for a specific WM with the following command:

    VirtualBox -startvm “Name of Machine”

    i.e. VirtualBox -startvm “Windows XP SP2″ in my case. I even went so far as making a little windows icon for my taskbar to launch it. The irony of opening Windows and flippiing it around in a Mac-like Coverflow task switcher on a Linux O/S is just delicious ;)

  33. Arun says:

    I have no idea how to do that. If anyone knows how to do it, please leave the steps in the comment.

  34. pepe says:

    hi there,
    how can I make an ‘access-direct’ to my wirtual-box-winXP??, I mean, i already have to first to open VirtualBox, then hit ‘start’ in WinXP, and then appear WinXP, but i was wondering if this can be reduced to just one line or key.

    thanks in advance

  35. Arun says:

    You are welcome pepe. It’s pretty cool.

  36. pepe says:

    hi there,
    this post (and the one regarding sharing folders and mouse) is absolutely GREAT!!. Thank you very much!!. By the way this virtualbox thing is very cool ahh!

    cheers

  37. Arun says:

    Jonathan,

    I think you can set the key to something else other than right CTRL key in the settings. Check the settings before you start the virtual OS. I’m not sure where to set that, but I remember seeing an option to do that.

  38. Jonathan says:

    I was happily installing a vbox on my laptop when I realized that my laptop does not have a right CTRL key on the keyboard! I tried plugging in a USB keyboard, then realized the compact keyboard I had does not have a right CTRL key either. It seems that the best option at that point is to try to shut down the guest OS somehow.

  39. Arun says:

    Bob,

    I installed Virtualbox 1.3.x in Ubuntu Feisty and Virtualbox 1.4 in Feisty and Gutsy Gibbon and I didn’t have any dependency problem.

    Thanks for the information in case others have dependency problem.

    Arun.

  40. bob says:

    i had to install the following dependencies before i was able to install virtualbox:

    virtualbox depends on libxalan110;
    virtualbox depends on libxerces27;

  41. Arun says:

    Thanks for sharing the information Citrin. I hope they fix those issues soon. They are doing a pretty good job.

  42. S Citrin says:

    I installed a windows 2000 guest within an UBuntu host. Following notes based on experience:

    1. Virtualization needed to be enabled in the bios. Without this Virtual Box would essentially not launch.

    2. If you are attempting to install using a combination of floppies and non-bootable CD you might have to share the floppy drive as “a:” in Linux. A better alternative is to create a bootable CD.. see http://www.nu2.nu/bootcd/

    3. Do NOT enable the “Enable IO APIC” option, as the Windows installation will hang about 1/3 the way through. Enable ACPI seems to be okay, but I am not sure if it accomplishes anything.

    4. Before installing you must execute the following from a terminal Window within linux:

    VBoxManage setextradata “VBoxInternal/Devices/piix3ide/0/Config/IRQDelay” 1

    If you don’t, the installation hangs after the installation of network files. When done with the installation, execute

    VBoxManage setextradata “VBoxInternal/Devices/piix3ide/0/Config/IRQDelay” 0

    5. I tried with a dynamic expandable and fixed size virtual drive and both are equally buggy.

    Whoever did the front end on the Virtual Box was really a good designer and coder. The back end unfortunately, at least in my experience, seems to be lacking. In general, when running Windows within VirtualBox, the application does not like large files (either moving the files around or opening with an application) and frequent crashes are encountered. (I am probably wrong, but I suspect it just does not handle well files larger than 16 MBytes and that its a 24 bit address issue. I had the file system set as NTFS within the virtual hard drive.) Whats more, the applications (probably by necessity) do not appear to run in their own protected space within the virtual operating system; if one app crashes it will generally bring the whole virtual operating system down.

  43. Arun says:

    I don’t think you can run the XP you installed in the 1st hard drive through Virtualbox. You have to install XP inside the virtualbox to run it. I think VMWare might allow you to do that, but I’m not sure.

  44. Zairul says:

    Hi Arun.. I’m currently having to hard disk.. primary HD i installed winXP and the second HD I installed feisty. My question is how do I open my windowXP in ubuntu. Thank you

  45. Arun says:

    I didn’t try with wireless mouse, but I use wired USB mouse. Did you add your mouse through virtualbox menu Devices – USB Devices – and then your mouse? If so, don’t do that. I did that for my keyboard and I couldn’t get the keyboard control out. Once I unchecked my keyboard from the USB devices menu, it worked fine. If you have your mouse added through that, uncheck it. Your mouse should work normally.

  46. K says:

    Hi,

    Worked great for me, but I got one problem, I don’t seem to get my mouse back, when using ‘right CTRL’ key, I get the keys back but not the mouse. The same happens when I shutdown the Vbox, I need to execute a couple of modprobe commands to get the mouse to working, any ideas?

    I got a logitech wireless mouse using USB

    Thanks,
    K

  47. Raja says:

    Motorcycle guy,
    Having used vmware for a long time and recently switched to virtualbox, I can assure you that virtualbox is not only opensource, it is a little faster, and leaner.
    However, Arun, you can use USB devices on vmware without purchasing anything.

  48. Arun says:

    vmware doesn’t recognize usb devices unless you buy the latest vmware workstation.

  49. Why not just use vmware? Sure it’s not open source but I know it will work 100x better.

  50. Arun says:

    Thanks Raja. I’ll try that.
    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?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>