How to connect Android 7.1 to Ubuntu Linux with USB?
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!
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
This works for me on a Motorola Moto Z Force Droid running Android 7.1.1:
On the phone go to Settings > Developer Options (turn on if not already turned on) > scroll down to Select USB Configuration > select Picture Transfer Protocol > then re-select Media Transfer Protocol. The phone's internal memory and SD card memory (if any) then mount.
I did not have to install any software on the Ubuntu 16.04.3 computer that I use.
Sullivan's answer worked for me, but only after I replaced the cable I was using. With the previous cable (2 meters long), connection was extremely slow or disconnected frequently.
Also I did the following, in addition to Sullivan's answer:
- Went into developers options in my Android 7.0 (Moto G5 Plus) and enabled USB debugging. Without that no connection was ever possible!