By Arun, 1 year and 1 month ago

Configuring Virtualbox for Sharing and Mouse Control

You might have read my earlier article on installing Virtualbox in Ubuntu. I would like to explain couple of more features to use in Virtualbox. You can use these features once you install the virtualbox as explained here.

1. Sharing the folders between Ubuntu and Virtualbox Windows.

(Update: You may have to install Guest Additions as described in step 2 for sharing the folders too)

I would like to explain how to share your Ubuntu folders with Virtualbox. Thanks to Raja for the guide.

Before you start the virtualbox, open a terminal in Ubuntu. Enter the following command:

VBoxManage sharedfolder add virtualmachinename -name «sharedfolder» -hostpath «/home/username/foldertoshare»

virtualmachinename is the name virtual machine you created. I created mine with the name WinXP.
username is your ubuntu home directory name. It's usually /home/your user name.
foldertoshare is the name of the folder you want to share. In my case it's Documents.
Here is the command I used.

VBoxManage sharedfolder add WinXP -name «sharedfolder» -hostpath «/home/arun/Documents»

Exit the terminal. Start the virtual OS now. Once you login to Windows, Click Start - Run and enter cmd.exe. Press Enter. You'll get a terminal window. Enter the following command:

net use M: \\vboxsvr\sharedfolder

where M is the drive name you want to assign to the shared folder. Make sure the drive name is not used by Windows already. You will now see the shared folder as a network drive under My Computers.

2. Sharing mouse control between Ubuntu and Windows without using the control key.

If you want to share your mouse between Ubuntu and Windows (using Virtualbox) without pressing the right control key, you have to install the guest additions from the virtualbox menu. Once you start the virtual OS (Windows), press the right control key to get the mouse out of Windows control and click on Devices menu. Select Install Guest Additions (see picture below). This will install Guest Additions software in the Windows box. Once installed, reboot and login. You'll get a warning message about the mouse control. Click OK and continue. You are all set. if you move the mouse over the virtualbox, then the control goes to virtualbox. If you move the mouse out of the box, then the control goes to Ubuntu.

Guestaddon

Technorati Tags: , , , , , ,

46 comments

Gravatar #1. dennis parrott
1 year and 1 month ago

and people think i waste time reading blogs!!

dude! your tip on how to share between VirtualBox and Ubuntu just saved me a bunch of time actually reading the manual! Sweet...

gotta love it!! thanks!

Gravatar #2. Arun
1 year and 1 month ago

You are welcome dennis. :)

Gravatar #3. Vishal Warke
1 year ago

Thanks.

Gravatar #4. Vishal Warke
1 year ago

Why do I keep getting following error msg after putting the command

VBoxManage sharedfolder add WinXP -name «sharedfolder» -hostpath «/home/vishal/Documents»

VirtualBox Command Line Management Interface Version 1.3.8
(C) 2005-2007 InnoTek Systemberatung GmbH
All rights reserved.

[!] FAILED calling machine->CreateSharedFolder(Bstr(name), Bstr(hostpath)) at line 5533!
[!] Primary RC = 0x80070057
[!] Full error info present: true , basic error info present: true
[!] Result Code = 0x80070057
[!] Text = Shared folder path '«/home/vishal/Documents»' is not absolute
[!] Component = SharedFolder, Interface: ISharedFolder, {8b0c5f70-9139-4f97-a421-64d5e9c335d5}
[!] Callee = IMachine, {fd443ec1-0009-4f5b-9282-d72760a66916}

Could you help me in solving the problem?
Thanks again!!!

Gravatar #5. Arun
1 year ago

Vishal,

Shutdown the virtual machine completely through the shutdown option and then try issuing that command.

Gravatar #6. Vishal Warke
1 year ago

Thanks Arun. It worked.

Gravatar #7. Will
1 year ago

Hey, great tutorials, they helped out alot. But I have a problem with my mouse. I am running Ubuntu 7.04 on a Dell Inspiraon Laptop with a Logitech G5 attached. I chose the option to have the Virtualbox use that usb mouse, but when I do that, i can't use it in Linux. I have tried to install the guest services thing, but nothing happened. If you or anyone can give me a hint I would appreciate it.

Thanks

Gravatar #8. Will
1 year ago

ok, i read through the comments on your post on how to install virtualbox and found the answer. I have to turn OFF the usb mouse instead of turning it on. I mean through the settings before I start the win xp box. Anyway, it works now and everything is great. Thanks again for the great tutorials.

Gravatar #9. Arun
1 year ago

You got it before I could answer that. I had the same problem with my usb keyboard. Have fun.

Gravatar #10. JustTech
1 year ago

I have followed your instructions and thank your for them. Everything works great. It has allowed me to share a second partition on my harddrive. Only problem that I am having is that it's not allowing me to write to the drive or change the existing on the drive. Do you know what I can do to fix this issue?

Gravatar #11. Arun
1 year ago

I shared a folder that was in the second partition and I could modify or create new files. I'm not sure why it's not working for you. Did you check the file/folder permissions?

Gravatar #12. Chris Gray
7 months and 23 days ago

Hi there, I'm having some trouble with sharing as per your instruction. My line was this:

VBoxManage sharedfolder add xp -name <> -hostpath <>

It doesn't report an error, so I load VirtualBox and type:

net use X: \\vboxsvr\shared

It waits a while then tells me:

System error 53 has occured. The network path was not found.

If I put a gibberish directory in it tells me instantly, but the correct one waits a while then denies me. Can you help? Thanks!

Gravatar #13. Chris Gray
7 months and 23 days ago

Hrm that first line didn't appear as I pasted it for some reason, the name was «shared» and the hostpath was «/320/Shared».

Gravatar #14. Arun
7 months and 22 days ago

Chris,

If you have the new version of Virtualbox, you'll see some small icons at the bottom of the window (Virtualbox frame) when you run your virtual OS. One is hard drive access, one for USB and there is one for shared folder. Right click that and it'll open the shared folder window. Click on Add and select the directory in Ubuntu that you want to share. You should be able to find this shared folder option in the virtualbox settings manager too. Once you select the directory you want to share, click OK and close that window. Now go to Windows OS, if you are using that as virtual OS, and enter the command net use M: \\vboxsvr\sharedfolder where sharedfolder is the exact name of the folder you selected in the shared folder window. M is the drive letter, so you can use any drive letter you want (make sure that is not used already). There should be a space between the drive letter and the first backward slash (\).

Gravatar #15. Chris Gray
7 months and 22 days ago

I just tried it that way, and got the same error again. :(

I changed the drive letters, directories to share, everything, and it still comes up with the same error as above. I've also made sure there was a space between the drive letter and \. :)

Any ideas?

Gravatar #16. Arun
7 months and 22 days ago

Chris,

It may be a silly question, but did you install Guest Addon?

Gravatar #17. Chris Gray
7 months and 21 days ago

Hrm not so silly, I haven't installed any addons at all - I figured as it came default with openSUSE 10.3 that it'd have everything I needed. :)

Would it be «virtualbox-guest-tools-1.5.2-13.3.i586.rpm» or is that something that builds a guest addon? Just confused as to exactly what I need to download.

Thanks for your help btw.

Gravatar #18. Arun
7 months and 21 days ago

The steps to install Guest addon is there as point no. 2 in this post itself with a screenshot under Sharing mouse control between Ubuntu and Windows without using the control key.

Gravatar #19. Chris Gray
7 months and 21 days ago

Worked a charm, thanks for your help. :)

Gravatar #20. Arun
7 months and 21 days ago

You are welcome.:)

Gravatar #21. mariner
7 months and 7 days ago

Yes I have installed guest addon - I assume I have done it correctly as the mouse is automatically captured to whatever os I use.

Gravatar #22. Arun
7 months and 6 days ago

I couldn't check the information for you as I didn't go home until late at night. I'm sorry. I'll try to check today, but when I think about it, I got the window bigger by increasing the resolution. I then maximized by clicking the maximize box of the virtualbox window frame. I think there is an option in the Virtualbox menu to make the virtual OS full screen.

Gravatar #23. Frank
6 months and 25 days ago

THanx a million for the tip.........
Now I can smile... :-}
About to install OS X Leopard!

Gravatar #24. Arun
6 months and 24 days ago

You are welcome :)

Gravatar #25. Serge Norguard
3 months and 9 days ago

hey there, thanks for the tip how ever im getting an error when i try to perform the file sharing. the error that i'm getting is :

[!] FAILED calling machine->CreateSharedFolder(Bstr(name), Bstr(hostpath), fWritable) at line 6236!
[!] Primary RC = 0x80070057
[!] Full error info present: true , basic error info present: true
[!] Result Code = 0x80070057
[!] Text = Shared folder path '«/home/user/Documents»' is not absolute
[!] Component = SharedFolder, Interface: ISharedFolder, {8b0c5f70-9139-4f97-a421-64d5e9c335d5}
[!] Callee = IMachine, {31f7169f-14da-4c55-8cb6-a3665186e35e}

any help on this would be great

Gravatar #26. Arun
3 months and 8 days ago

Serge,

You didn't say what step is creating that error. Anyhow, If you are using the latest version of Virtualbox, you don't have to use the Vboxmanage command. You can go to Virtualbox settings and select shared folder option and add the folder you want to share. Boot Windows, login and open the command line. Enter the following command.
net use driveletter: \\vboxsvr\sharedfolder
eg: If you want to use P: as the drive letter (make sure your OS is not using P:), then
net use P: \\vboxsvr\sharedfolder
As you can see there is a space between : and \\.

Gravatar #27. Serge Norguard
3 months and 8 days ago

oh. thanks, anyway that error occured when i did :

VBoxManage sharedfolder add virtualmachinename -name «sharedfolder» -hostpath «/home/username/foldertoshare»

Gravatar #28. Serge Norguard
3 months and 8 days ago

just to clarify, when i do the shared folder and then load up virtual box and run the windows command prompt, i type in

«net use driveletter: \\vboxsvr\sharedfolder»

and since my «shared folder name» is «Desktop»

my command line should be

«net use d: \\vboxsvr\Desktop» ? am I right ?

Gravatar #29. Arun
3 months and 8 days ago

Yes. Make sure d: is not being used by DVD/CD drives or hard drisk etc.

Gravatar #30. Serge Norguard
3 months and 7 days ago

http://pastebin.ca/960967

Am i doing it right ?

Gravatar #31. Arun
3 months and 5 days ago

Serge, for some reason, my blog does not show the double quotes as double quotes. I have given the command below in wordings. try it.
VBoxManage sharedfolder add virtualmachinename -name doublquotessharedfolderdoublequotes -hostpath doublequotes/home/username/foldertosharedoublequotes

Gravatar #32. sayantan
3 months and 5 days ago

thanks a lot for the tutorial, i'm new to linux and this virtual box was of utmost importance to me, as i was unable to configure ms office properly in wine

Gravatar #33. Serge Norguard
3 months and 4 days ago

hey Arun. thank you so much . it works now.

Gravatar #34. Arun
3 months and 4 days ago

You are welcome Serge and Sayantan.

Gravatar #35. vimal
2 months and 22 days ago

Hi,
Thanks to your walkthrough, i was able to have XP as guest inside my Kubuntu Feisty Fawn 7.04. I am migrating from Vista and need to run office., i was able to do that as well.

Only thing troubling me is to get XP to recognize my wireless card. Any tips??

Thanks.

Gravatar #36. Arun
2 months and 21 days ago

Vimal,

I didn't try wireless connectivity. Did you see if your wireless card was listed under Devices menu or check the settings option. May be it was not enabled in settings.

Gravatar #37. Vimal
2 months and 20 days ago

**update
got my wireless working as well. pheww!!!
i had to choose the host interface name which needed to be mapped to the virtual adapter in the settings.

Gravatar #38. Arun
2 months and 20 days ago

Good to know it worked.

Gravatar #39. Ravi
2 months and 9 days ago

Hi Arun,
I have installed the virtualbox 1.5.6 on ubuntu and installed WinXp sp2 on it but I could never get my mouse working in the virtual box. Can you please guide me?

Thanks,

Ravi

Gravatar #40. Arun
2 months and 7 days ago

Ravi,

First, Sorry for the late response. I don't normally check my blogs on weekend.
I'm not sure why it's not working for you. Did you install it in your laptop or desktop? Couple of people complained about laptop installation. Did you check the settings to see if you have to manually enable the mouse, esp if it's USB one?

Also, try disabling Keyboard Auto Capture in the VirtualBox Preferences and see if it works.

Gravatar #41. Ravi
2 months and 7 days ago

Thanks, Arun. I have got it going after I installed the guest applications.

Gravatar #42. Arun
2 months and 6 days ago

Good to know it worked. :)

Gravatar #43. Reedyseth
1 month and 5 days ago

Thanks a lot Arun, I had a little difficulties but I did it, now my Virutalbox Works at 100 %.

Gravatar #44. Arun
1 month and 5 days ago

Good to know that. :)

Gravatar #45. three
1 month and 4 days ago

Im having trouble trying to get my wireless card recognized in virtualbox any ideas Arun?

Gravatar #46. Arun
1 month and 3 days ago

Did you check the settings in Virtualbox. I'm not sure why.

Write a comment

If you want to add your comment on this post, simply fill out the next form:





* Required fields

You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>.

1 trackback

To notify a mention on this post in your blog, enable automated notification (Options > Discussion in WordPress) or specify this trackback url: http://​www.blog.arun-prabha.com/​2007/​05/​21/​configuring-virtualbox-for-sharing-and-mouse-control/​trackback/