Ubuntu – How to connect Android 7.1 to Ubuntu Linux with USB

16.04androidmtpusb

I'm trying to connect a Google Pixel phone, with android 7.1,
to a Ubuntu 16.04 laptop with a USB cable using mtp-tools.
But the mtp doesn't see the phone file system and gives the error
message "Get Storage information failed".

Then trying the mtp tools …

# mtp-detect
libmtp version: 1.1.10

Listing raw device(s)
Device 0 (VID=18d1 and PID=4ee1) is a Google Inc (for LG Electronics/Samsung) Nexus 4/5/7/10 (MTP).
   Found 1 device(s):
   Google Inc (for LG Electronics/Samsung): Nexus 4/5/7/10 (MTP) (18d1:4ee1) @ bus 2, dev 17
Attempting to connect device(s)
Android device detected, assigning default bug flags
Error 1: Get Storage information failed.                 ***** ???
USB low-level info:
   bcdUSB: 512
   bDeviceClass: 0
   bDeviceSubClass: 0
   bDeviceProtocol: 0
   idVendor: 18d1
   idProduct: 4ee1
   IN endpoint maxpacket: 512 bytes
   OUT endpoint maxpacket: 512 bytes
... many lines omitted ...


# mtp-connect
libmtp version: 1.1.10

Device 0 (VID=18d1 and PID=4ee1) is a Google Inc (for LG Electronics/Samsung) Nexus 4/5/7/10 (MTP).
Android device detected, assigning default bug flags
Usage: connect <command1> <command2>
Commands: --delete [filename]
          --sendfile [source] [destination]
          --sendtrack [source] [destination]
          --getfile [source] [destination]
          --newfolder [foldername]


# mtp-filetree
Device 0 (VID=18d1 and PID=4ee1) is a Google Inc (for LG Electronics/Samsung) Nexus 4/5/7/10 (MTP).
Attempting to connect device(s)
Android device detected, assigning default bug flags
Error 1: Get Storage information failed.
Device: (NULL)
LIBMTP_Get_Storage(): Resource temporarily unavailable
OK.

In case it's useful …

cat /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee1", MODE="0666", OWNER="sullivan"

Many thanks for any advice!

Best Answer

Here's what I found works:

  • First, ignore all the web comments you've seen about /etc/udev/rules.d/51-android.rules. That file isn't needed.

  • Second, skip mtp-tools. They aren't documented, and jmtpfs is far easier anyway.

  • Install the jmtpfs package: sudo apt-get install jmtpfs

  • Make a directory, any directory: sudo mkdir /media/myphone
  • Connect the USB cable
  • Unlock the android phone.
  • Swipe down from the top of the phone screen
  • You should see a notification "USB ..."
  • Tap that notification.
  • You should see a menu titled "Use USB to...", select "Transfer files".

  • On the linux computer issue:

sudo jmtpfs /media/myphone

ls /media/myphone

fusermount -u /media/myphone