FORUMS
Remove All Ads from XDA

[HOW-TO] ADB via VirtualBox USB passthrough (Windows host to Ubuntu guest)

24 posts
Thanks Meter: 23
 
By commandar, Junior Member on 12th October 2009, 03:29 PM
Post Reply Email Thread
After spending the last 45 minutes or so trying to figure this one out, I figured I'd document it for the next person that tries this. It's not particularly hard, but it's not quite as straight-forward as expected, either.

Virtualbox is an open source virtual machine host, allowing you to run one operating system from inside of another. Since some of the AOSP stuff requires a Linux or OS X box, and I don't have a spare machine currently, I figured I'd create an Ubuntu VM and use that.

I've tested this using a Vista x64 host with an Ubuntu 9.04 guest, but I don't see any reason it shouldn't work with other versions of Windows.

If you're not familiar with Virtualbox, here's a basic walkthrough on setting up the VM itself:

http://moxiefoxtrot.com/2009/04/23/i...irtualbox-202/

It's for Virtualbox 2.2, but the process is the same for Virtualbox 3.

Next up, wggdlr previously posted a helpful how-to on setting up the Android SDK on Ubuntu that you can find here:

http://forum.xda-developers.com/showthread.php?t=537508

Now here comes the voodoo magic part. Normally you can set up USB devices to pass through to the guest OS just by clicking the USB icon at the bottom of the VB window and checking the device. Unfortunately, Windows grabs onto the device at a low enough level that if you try this, VB will error out on trying to grab the device.

Here's how we get around that:

* Shut down your VM.

* Plug your G1 into your computer's USB port and allow Windows to recognize it.

* In the main Virtualbox window, select your Ubuntu VM and then click on the USB properties link:



* Then click on the green plus icon to add a new USB filter, and select "HTC Android Phone [0100]":



which should give you this:



* Click okay and close out the preferences window
* Unplug your G1
* Start your Ubuntu VM
* Now plug your G1 back in. You should see a device manager pop-up in the corner of your screen telling you that Windows is installing a Virtualbox USB Device.

From here, you should be able to use ADB from your guest operating system. I did reboot my VM one time after the VB USB device finished installing just to be sure, though. The only caveats should be that the phone must be unplugged when you start Virtualbox and you have to plug the phone in after you start your VM each time. If you need to use fastboot from the VM, you'll need to repeat this process with the phone loaded into the bootloader as the phone reports itself slightly differently to the host OS in fastboot mode.

Basically, what's happening here is that Windows is very touchy about the G1 USB device for some reason, and once it gets hold of it, it doesn't really want to give it up. I had a bit of a hard time getting ADB drivers for Windows installed on this same machine for this reason. What we've done here is set up a filter so that Virtualbox grabs the device on plug-in before Windows sinks its teeth into it.

Enjoy!
The Following 23 Users Say Thank You to commandar For This Useful Post: [ View ] Gift commandar Ad-Free
 
 
12th October 2009, 03:52 PM |#2  
Junior Member
Leiden
Thanks Meter: 0
 
More
great
Thanks! I was trying to get this to work on winxp sp3 etc but I can't seem to get a connection. Going to give this a try tonight
12th October 2009, 05:16 PM |#3  
Senior Member
Thanks Meter: 2
 
More
welcome to the world of linux...

soon u will throw away your xp and vista and stay on ubuntu or other linux distro..

the only thing u'd ever run on virtualbox in the future may just be your main M$ operating system now..

hehe
12th October 2009, 05:29 PM |#4  
OP Junior Member
Thanks Meter: 23
 
More
Quote:
Originally Posted by farbird

welcome to the world of linux...

soon u will throw away your xp and vista and stay on ubuntu or other linux distro..

the only thing u'd ever run on virtualbox in the future may just be your main M$ operating system now..

hehe

Heh, I've actually been a Linux user for about a decade and a Mac user for almost five years now. It just happens that everything I have at home right now is running Windows. Vista on my gaming rig and W7 on my netbook.

Also, just a heads up, but for some reason you may need to close and restart VB between sessions. Gonna take some trial and error to figure out exactly what the problem is, but I'm mostly happy to have it working at all now.
12th October 2009, 06:14 PM |#5  
CrazyEye's Avatar
Senior Member
Flag Vegas, Nevada
Thanks Meter: 1
 
More
Great tutorial!
12th October 2009, 06:23 PM |#6  
OP Junior Member
Thanks Meter: 23
 
More
Okay, after playing with it a bit more, it looks like the magic combination is that your G1 has to be unplugged when you open Virtualbox and then plugged in after you've started the VM. For whatever reason, it looks like if you start VB while the phone is plugged in, it'll still be unable to grab the device.
13th October 2009, 04:46 AM |#7  
OP Junior Member
Thanks Meter: 23
 
More
Alright, found one more roadbump here that has to be addressed - looks like the phone reports itself differently for normal debug and for fastboot. So if you need to use fastboot, you'll have to boot the phone into the bootloader and then create a second filter for it in Virtualbox.
16th October 2009, 03:49 AM |#8  
Senior Member
Austin, Texas
Thanks Meter: 17
 
More
Thanks! I downloaded/installed VB last week and was planning on trying it out. Now, when I start working with it I'll know how to make it work!!

Subcribed to thread!
18th October 2009, 09:15 AM |#9  
OP Junior Member
Thanks Meter: 23
 
More
Quote:
Originally Posted by shaneaus

Thanks! I downloaded/installed VB last week and was planning on trying it out. Now, when I start working with it I'll know how to make it work!!

Subcribed to thread!

Not a problem. I was somewhat surprised that this hadn't been documented before me.
24th February 2011, 07:27 PM |#10  
Senior Member
Thanks Meter: 18
 
More
I was thinking of playing around and learn to cook my own rom or at least tweak my fav rom.

Good guide. Thanks a bunch.
9th January 2012, 03:44 AM |#11  
Senior Member
Thanks Meter: 26
 
More
I realize this is an old thread and as such the situation may not completely apply, but I'm trying to get my Ubuntu 11.10 guest (Win7 host) access my Samsung Galaxy Nexus (LTE) via adb and I'm failing. It works great in Win7, and I've tried everything in this thread. Virtualbox even looks like it gets the right USB device, but "adb devices" gives me nothing. Any suggestions?

Edit: a simple lsusb shows me that the USB devices (specifically, the phone) aren't being accessed by Ubuntu. So I'll investigate that some more.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes