# Mount Galaxy Nexus Android Phone via USB [solved]

## oneself

Hi,

I'm trying to mount my Galaxy Nexus phone by connecting a USB cable to my computer.  When I connect the cable I see the following in the log:

```
Jun 16 18:32:38 lapself kernel: usb 2-2: new high-speed USB device number 5 using ehci_hcd

Jun 16 18:32:38 lapself kernel: usb 2-2: New USB device found, idVendor=04e8, idProduct=6860

Jun 16 18:32:38 lapself kernel: usb 2-2: New USB device strings: Mfr=2, Product=3, SerialNumber=4

Jun 16 18:32:38 lapself kernel: usb 2-2: Product: Galaxy

Jun 16 18:32:38 lapself kernel: usb 2-2: Manufacturer: samsung

Jun 16 18:32:38 lapself kernel: usb 2-2: SerialNumber: 0146970D0101F010

```

When I run lsusb, I can see the device:

```
Bus 002 Device 005: ID 04e8:6860 Samsung Electronics Co., Ltd 

```

I followed the Gentoo USB Guide (http://www.gentoo.org/doc/en/usb-guide.xml), however, nothing gets automounted anywhere, and I'm not sure which device I need to mount.  My laptop also has an SD card reader, and when I insert an SD card it works fine.  Unfortunately, the Nexus Galaxy doesn't support an SD card, all of the memory is internal, and the only way to get to it is via USB cable.

Are there any other kernel modules I need to enable?

Thank you

----------

## BillWho

A long shot - if you have CONFIG_USB_UAS=m in your config then try to blacklist it on the kernel line with modprobe.blacklist=uas

If it's set =y then try compiling the kernel with CONFIG_USB_UAS disabled

This has worked for another poster with usb storage errors https://forums.gentoo.org/viewtopic-t-925952-highlight-blacklist.html

Good luck   :Wink: 

----------

## oneself

No luck, it's already disabled:

```
$ grep CONFIG_USB_UAS .config

# CONFIG_USB_UAS is not set

```

----------

## BillWho

The only other help I can offer is my usb .config settings. I've mounted several dozen hard drives, four model cameras, sd cards and my garmin without any problems.

The list of  enabled  and disabled settings.

One more extra-long shot is to boot with the device plugged in. That has worked for others also, but I don't know why   :Confused: 

Good luck   :Wink: 

----------

## ppurka

The Nexus does not expose it's contents as a usb drive. You can access it only via MTP. Search google for "nexus mtp linux" and you will get lots of hits.

----------

## cach0rr0

 *ppurka wrote:*   

> The Nexus does not expose it's contents as a usb drive. You can access it only via MTP. Search google for "nexus mtp linux" and you will get lots of hits.

 

++

confirmed for me at least, had to go through the same fuss with mine. Doesn't allow for the usual mounting bits - annoying. Only mtp appears to work, and I have no interest in doing things that way

----------

## oneself

That's terrible.  Well, I emerged gmtp, and I get a segfault when I try to connect:

```
Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7510/Galaxy Tab 10.1/S2.

Android device detected, assigning default bug flags

Error 1: Get Storage information failed.

Error 2: PTP Layer error 02fe: get_handles_recursively(): could not get object handles.

Error 2: (Look this up in ptp.h for an explanation.)

zsh: segmentation fault  gmtp

```

----------

## immudium

I use

```
sys-fs/mtpfs
```

with the following line in /etc/fstab

```
mtpfs         /media/galaxy   fuse      user,noauto,allow_other   0 0
```

to mount my galaxy nexus.  It's not an automount solution but it works and is the best solution I have for now.  An alternative I suppose is to root the phone and then copy files over wifi via the sshdroid app but I haven't tried this.

----------

## yellowhat

Take a look to jmtpfs (https://forums.gentoo.org/viewtopic.php?p=7066836#7066836) it worked for my galaxy S3

----------

## DirtyHairy

It seems that Android 3+ devices don't expose their storage as usb storage devices anymore and use MTP instead. While I think this is understandable as it is much more flexible and doesn't require the device to export complete block devices (which is fine for SD cards, but awkward for internal storage), I never have had much luck with MTP and linux. I have tried mtpfs and it works for me, but each file transfer is followed by a long pause, which makes transfers of lots of files (e.g. music) slow and awkward.

Luckily, I have found QuickSSHd for android which does NOT require root. I use it to access the device via sshfs, and it works without any complications. If I connect the device via USB and use USB tethering, I get very decent transfer speeds > 10MB/s. The program is available on the android market, but not for free; still, for me it has paid off.

----------

## yellowhat

 *DirtyHairy wrote:*   

> It seems that Android 3+ devices don't expose their storage as usb storage devices anymore and use MTP instead. While I think this is understandable as it is much more flexible and doesn't require the device to export complete block devices (which is fine for SD cards, but awkward for internal storage), I never have had much luck with MTP and linux. I have tried mtpfs and it works for me, but each file transfer is followed by a long pause, which makes transfers of lots of files (e.g. music) slow and awkward.
> 
> Luckily, I have found QuickSSHd for android which does NOT require root. I use it to access the device via sshfs, and it works without any complications. If I connect the device via USB and use USB tethering, I get very decent transfer speeds > 10MB/s. The program is available on the android market, but not for free; still, for me it has paid off.

 

Can you explain how do you connect with ssh via USB?

Thanks

----------

## comprookie2000

I use AirDroid;

http://airdroid.com/

----------

## yellowhat

Airdroid ok, so do I use it. But over wifi is a bit slow if you want to transfer a lot of stuff.

----------

## DirtyHairy

@yellowhat: I activate USB tethering on the device. After establishing the connection via NetworkManager, the phone and computer are on the same network via usbnet. The device has a IP, Quicksshd shows it, I connect to it.

----------

## oneself

@DirtyHairy: That sounds awesome!  Can you post some more detailed instructions?

----------

## DirtyHairy

1) Activate USB tethering on your phone while it's connected to USB --- it's under Settings -> Networks -> Tethering (translating from german here, so I am not sure about the english labels). A usbnet device will now appear on your computer (provided you activated CONFIG_USB_USBNET and CONFIG_USB_NET_RNDIS_HOST in your kernel), you should be able to see it in ifconfig -a.

2) The device provides a dhcp server on the connection, so activate dhcp on it. You can either do it manually using dhcpcd or dhclient, or, more conveniently, if you use networkmanager in your desktop environment, an entry for the connection will appear which you can activate by clicking on it.

3) In tethering mode, the android device acts as a router and provides masquerading, so you can now access the internet using your phone's connection. As a side effect, your computer now is on a network with your device, which has an IP. The network connection is encapsulated over USB, and you can ping and ssh your phone.

4) Fire up Quicksshd. It will show a list of network interfaces and the corresponding IPs, take the one from usbnet0, rndis0 (or such, depends on your device). Start the server, connect to it, voila  :Smile:  Be aware that Quicksshd can only run on ports >1024 without root priviledges, so you'll have to adjust your ssh and sshfs commands on your side to the correct port (2222 by default).

This sounds more complicated as it really is. It boils down to: activate tethering -> activate connection (NM should even do it automatically) -> start quicksshd -> connect. If you want to mount your device into the filesystem, you can use sshfs (in portage).

The only downside is that you will be using tethering while you are connected to your device, so take care with internet access. However, if you activate wifi on your device, you will tethering the wifi instead of your mobile connection, which is harmless to your data plan. If your computer is connected via ethernet, network manager will give it precedence over the tethered connection, so that's also fine. You can also work around this point by manually configuring routes, but that's propably more hassle than it's worth as it spoils the simplicity of the solution  :Wink:  Also, take care to set a strong password in Quicksshd, depending on how your phone is connected to the net and your data plan provider's setup, the ssh server will be exposed over wifi and possibly even to the internet.

----------

## yellowhat

Thanks that worked for me

----------

## oneself

Unfortunately, I am using the Verizon Galaxy Nexus, which wants more money to tether via USB (or Wifi).

Another option I managed to find is to use adb to transfer files.  To do this, download the latest Android SDK and follow the instructions (http://developer.android.com/sdk/index.html).

Once this is installed and adb is in your path, you should be able to access your device via:

```
adb shell
```

This is a nice way to figure out the path you want to transfer to or create any directories.  Once you're done exploring, exit the shell, and use the push command to transfer files:

```
adb push  /path/to/local/file /sdcard/path/to/file
```

You can only do one file at a time, but it's easy to write a little shell for loop to move multiple files.

----------

## tonyp

 *immudium wrote:*   

> I use
> 
> ```
> sys-fs/mtpfs
> ```
> ...

 

If you change the noauto option will it auto mount?

I just use the command line options

```
mtpfs /media/android_mtp

fusermount -u /media/android_mtp
```

----------

## *zensiert*

 *oneself wrote:*   

> Unfortunately, I am using the Verizon Galaxy Nexus, which wants more money to tether via USB (or Wifi).
> 
> Another option I managed to find is to use adb to transfer files.  To do this, download the latest Android SDK and follow the instructions (http://developer.android.com/sdk/index.html).
> 
> Once this is installed and adb is in your path, you should be able to access your device via:
> ...

 

Well actually adb push supports pushing whole directories.

Unfortunately, if I use adb push to transfer music to my Galaxy Nexus, "Play Music" does not find them. However, I see the files on the phone when using ls in /sdcard/Music. If I connect via MTP, I don't see the files in the Music folder.

----------

## darkphader

Very strange scenario here - my Galaxy Nexus automounts just fine (!), but my new Nexus 7 does not. The system does see it:

```
Bus 002 Device 007: ID 0b05:179c ASUSTek Computer, Inc.
```

Weird that the one works fine and the other does not, as they are both presumably MTP.

----------

## salman malik

my usb become right protected,

is there any way that i can delete the data in my usb if any one can know then tell me the process to delete the data.

----------

## darkphader

In regards to MTP, if your device is fairly new install media-libs/libmtp-9999 (you may need to unmask and/or keyword it) - both media-sound/gmtp and sys-fs/mtpfs rely on this library.

For the Nexus 7 I just posted a diff against the current git on sourceforge:

```
--- src/music-players.h.orig   2012-07-18 14:52:26.132912175 -0400

+++ src/music-players.h   2012-07-18 15:01:54.359110664 -0400

@@ -1554,6 +1554,12 @@

   { "Google Inc (for Asus)", 0x18d1, "TF101 Transformer", 0x4e0f,

       DEVICE_FLAGS_ANDROID_BUGS },

   // Reported by Laurent Artaud <laurenta@users.sourceforge.net>

+  { "Google Inc (for Asus)", 0x18d1, "Nexus 7", 0x4e41,

+      DEVICE_FLAGS_ANDROID_BUGS },

+  // Reported by Chris Smith <chris@realcomputerguy.com>

+  { "Google Inc (for Asus)", 0x18d1, "Nexus 7 (USB debug mode)", 0x4e42,

+      DEVICE_FLAGS_ANDROID_BUGS },

+  // Reported by Chris Smith <chris@realcomputerguy.com>

   { "Google Inc (for Samsung)", 0x18d1, "Nexus S", 0x4e21,

       DEVICE_FLAGS_ANDROID_BUGS },

   // WiFi-only version of Xoom
```

NOTE: git has been updated and now works with the Nexus 7 !!

No longer a need to patch just (re)install media-libs/libmtp-9999.

Chris

----------

## cach0rr0

 *oneself wrote:*   

> Unfortunately, I am using the Verizon Galaxy Nexus, which wants more money to tether via USB (or Wifi).
> 
> 

 

immensely curious - how are they enforcing this? If you try to enable it, does it prompt you, or is it just altogether greyed out? 

That, to me, would be infuriating - having to pay money to enable a feature the OS/phone supports by default. Ergo, why I've bought the entire family the unlocked GSM Galaxy Nexus, and while we're stuck with TMO's garbage network, our phones are ours to use and abuse as we see fit.

----------

## kfirufk

thanks! i add the mtpfs mount line to /etc/fstab

mount finally works! thnks a lot  :Smile: 

----------

## jasn

 *darkphader wrote:*   

> Very strange scenario here - my Galaxy Nexus automounts just fine (!), but my new Nexus 7 does not.

 

I had the same problem, however using the solution immudium pointed out above, didn't even allow me to manually manage the files on my Nexus 7. Using sys-fs/mtpfs-1.1, and manually mounting the device appeared to mount the internal storage and show the correct directory structure, but it showed no files, (and was read only of course). So it definitely wasn't working right. (BTW, same when I tried accessing the Nexus 7 with gMTP)

My solution was to use jmtpfs instead. I used the ebuild from this Gentoo forum post, copied to my local overlay, to install sys-fs/jmtpfs-0.4 into my system, and then modified my /etc/fstab line to;

```
jmtpfs         /mnt/nexus      fuse      user,noauto,allow_other               0 0
```

So now, after I plug my Nexus 7 in, when I issue the command;

```
mount /mnt/nexus
```

I can manage the files on my device. BTW, I don't know if it matters, but in order to keep my mtp support up to date, I keyworded and emerged media-libs/libmtp-9999, and then I made sure to create a symbolic link in my udev directory for the rules file that is installed with it;

```
ln -s /lib64/udev/rules.d/69-libmtp.rules /etc/udev/rules.d/69-libmtp.rules
```

At least I notice that when the Nexus 7 is mounted, there's no "unknown device" message.

Good Luck..

----------

## Markus1999

 *immudium wrote:*   

> I use
> 
> ```
> sys-fs/mtpfs
> ```
> ...

 

thank you, immudium, that just did the trick for me!

----------

## gr0x0rd

The sys-fs/mtpfs / fstab solution isn't quite there with the Nexus 4 just yet...

```
gr0x0rd@teletran4 ~ $ sudo mtpfs /media/nexus

Error: Unable to open ~/.mtpz-data for reading.

Device 0 (VID=18d1 and PID=4ee1) is UNKNOWN.

Please report this VID/PID and the device model to the libmtp development team

Android device detected, assigning default bug flags
```

Hopefully a newer release of mtpfs will do the trick...

----------

