• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

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

Search This thread

commandar

Member
Jun 17, 2009
24
29
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/installing-ubuntu-904-in-virtualbox-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:

MJ57a.png


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

1aYp7.png


which should give you this:

bTi6P.png


* 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!
 
Last edited:

farbird

Senior Member
Jun 1, 2005
234
2
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
 

commandar

Member
Jun 17, 2009
24
29
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.
 

commandar

Member
Jun 17, 2009
24
29
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.
 

commandar

Member
Jun 17, 2009
24
29
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.
 

strikeir13

Senior Member
Oct 23, 2010
241
26
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.
 
Last edited:
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.

any news yet? I am using e4gt and just set up my repos now i need the device specific files to get it working for a test build. Thanks

Edit: the op trick worked. I am on lisa via virtualbox and adb crazy
 
Last edited:

mateorod

Inactive Recognized Developer
Nov 16, 2011
1,982
3,503
New Orleans
www.gigmasters.com
I cannot believe that this has been here for a year and no one thanked the OP.

Maybe its just common knowledge now, but I don't know anything about virtual machines and was going crazy. Seriously, I am running a nook here, and just found this by accident. Well written and clear, thanks a million.
 

exb0

Senior Member
Oct 24, 2010
1,830
426
25
Spokane
www.onecameraarmy.com
I cannot believe that this has been here for a year and no one thanked the OP.

Maybe its just common knowledge now, but I don't know anything about virtual machines and was going crazy. Seriously, I am running a nook here, and just found this by accident. Well written and clear, thanks a million.

I don't use the G1 anymore but I agree, this guide was nicely written and very informative. Gave it a thanks :D
 

bsegovia

Member
Jul 2, 2009
11
1
Houston, TX
I love you.

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/installing-ubuntu-904-in-virtualbox-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:

MJ57a.png


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

1aYp7.png


which should give you this:

bTi6P.png


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

Seriously. Thank you.
 
  • Like
Reactions: Leoxur

warrior812many

New member
Nov 26, 2018
1
0
I Created an Account to Thank You

I have been banging my head against a wall for days over this problem.

I am sitting on 3 bricked phones right now and this was the key to getting them factory reset. :good::)

Thank you
 
Last edited:

Leoxur

Senior Member
Apr 27, 2014
388
51
I'm try to use this sistema with an Xp virtual machine, beacuse Xperia S have problem with windows vista and newer.
Virtual machine recognise the phone, but I'm not able to install adb 15second driver, how can I do to run adb command?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 29
    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/installing-ubuntu-904-in-virtualbox-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:

    MJ57a.png


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

    1aYp7.png


    which should give you this:

    bTi6P.png


    * 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!
    1
    I love you.

    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/installing-ubuntu-904-in-virtualbox-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:

    MJ57a.png


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

    1aYp7.png


    which should give you this:

    bTi6P.png


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

    Seriously. Thank you.