How to connect Android 7.1 to Ubuntu Linux with USB?

107,424

Solution 1

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

Solution 2

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.

Solution 3

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!
Share:
107,424

Related videos on Youtube

Sullivan
Author by

Sullivan

Updated on September 18, 2022

Comments

  • Sullivan
    Sullivan over 1 year

    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!

  • Darren Cook
    Darren Cook about 7 years
    Thanks. Just finding that notification and choosing transfer files was enough for me. It seems it doesn't remember, though, and I'll have to do that each time. (BTW, it is very possible I've installed something like mpt-tools, for an earlier version of Android, my previous phone, which is why it "just worked")
  • cvr
    cvr almost 7 years
    Thank you. I just followed the advice to "connect the phone" - and there is was!
  • ruleant
    ruleant over 6 years
    If you add the 'allow_other' option, the mount also is available to other users than root, using 'uid' and 'gid' you can set the user:group of the mount point : sudo jmtpfs /media/motox -o uid=1000,gid=1000,allow_other
  • ThN
    ThN almost 6 years
    Thanks. This worked for me. However, I ONLY had to go as far as Unlocking my phone And as soon as I plugged the USB, my phone's SD card was mounted and was clickable.
  • Hibou57
    Hibou57 over 5 years
    It can be mounted on a user directory too, no need for sudo.
  • elig
    elig about 5 years
    In Android Oreo going to Settings -> Advanced -> Developer options -> Default USB configuration and selecting File transfer worked for me. I noticed it had "No data transfer" enabled by default.
  • nmz787
    nmz787 over 2 years
    works for me on antix distro with a Google Pixel 4a... I swear the better hardware gets, the stupider software becomes