25

I want to copy some movie files from Linux to my HTC One SV Android phone (not rooted).

In Windows, my phone mount its internal and SD-card volumes automatically when I plug it in, allowing me to transfer files.

In Linux Mint 13 Mate, I always get an error when I plug my phone in with a USB cable, then it may take some minutes to mount, and it sometimes fails. I think the error was—

Error initializing camera: -60: Could not lock the device

How can I make this work?

  • I'd say that problem lies with hardware, not with software, especially not Linux or your distribution. – Bananguin Aug 22 '13 at 10:47
  • My ancient Android 2.3-based phone is seen as an USB storage device. What version of Android you're using? – Renan Aug 22 '13 at 13:29
  • To see what happen in your phone you can try to use ADB. ADB is a tool with SDK from Android. You can see everything in your phone. And look LogError. – Ein5t3in Aug 22 '13 at 13:51
  • I am using android 4.1 – lamwaiman1988 Aug 22 '13 at 16:41
  • enabling USB debugging will prevent the device from locking while connected. I found that MTP always failed whenever the device auto-locked. – cheezsteak Sep 16 '14 at 23:55

16 Answers 16

17

UPDATE: There are several, better alternatives to Airdroid now. However, it seems most Linux distros are now working with MTP fairly well. I know in my experience, Mint (Ubuntu based) works out of the box, as does Manjaro (Arch based). If it doesn't work out of the box or natively, then be sure to search your package manager for an MTP solution.


Newer versions of Android mount storage as an MTP device instead of mass storage. The benefit to this is simultaneous access on the Android device and the PC. Unfortunately, while Windows supports it natively just fine, linux solutions are fairly buggy as of right now.

Currently, the most reliable (and it still is a little flaky to get going, but once connected is fine) that I have found is go-mtpfs. Here is a link to help you get it set up. You have to mount/dismount from command line. There is also a unity launcher in that thread if you're on Ubuntu unity, however.

The best option, though, unless you are transferring a lot of data, is to use something like AirDroid. It is a free app in the play store for local network transfers, and provides a web interface to use with your computer's browser. It even provides a drag and drop file interface, as well as even allowing access for sms messaging, call logs, app installs, and many other things.

  • I installed the latest version Linux Mint 15 Olivia as the team stated they made effort into android connection. I tried the usb connection it is working just fine. Much better than Linux Mint 13. So I think it is just problem of linux with MTP transfer and the performance varies between distros. – lamwaiman1988 Sep 6 '13 at 6:30
  • 1
    For increased speed, you can also use adb pull as outlined in this post: vxlabs.com/2014/11/06/… – Stefan van der Walt Nov 6 '14 at 9:54
  • 26
    @lamwaiman1988 I WOULDN'T TRUST AIRDROID. Airdroid app permissions: 1. Device & App History 2. Identity 3. Contacts / Calendar 4. Location 5. SMS 6. Phone 7. Photos/Media/Files 8. Camera/Microphone 9. Wifi Connection Information 10. Device ID & Call Information .... On seeing this huge list, I wanted to find out more about the company. "Sand Studio" is part of "Tongbu Networks" which operates in China. Xiamen Tongbu Networks - Details: "Xiamen Tongbu Networks Ltd; C, Room 3, No.2, Wanghai Road, Software Park II, xia men shi, fu jian, 361000, China, +86.05922179187". – a20 Nov 21 '14 at 9:02
  • Regarding the above, this PcWorld review was ironic: "This app allows you to take complete control of your Android device via your computer’s Web browser." – a20 Nov 21 '14 at 9:14
  • 2
    AirDroid is now charging now for the local file transfer "feature". – sybind May 1 '15 at 10:09
9

You could try using the free (gratis) ES File Explorer file manager on your Android phone.

Among a lot of functionality, it has an FTP server. So, if you can network your phone and your computer, you can easily transfer files both ways from your computer. I do it all the time from Ubuntu and Fedora machines (via Thunar).

The FTP server mode in this app is called "Remote Manager", it's under the Tools section.

Most modern file managers will accept the following syntax:

ftp://phone_ip_address:port
  • 1
    Now it's under the Network section. – user288316 Apr 28 '18 at 7:09
3

Basically this should be as easy as using a memory stick. Unfortunately this is not the case. But like other integrations Linux will catch up.

In the meantime you could use WiFi and sshd on Linux and an sftp-client on the smartphone side.

Or use the Linux adb CLI to use usb-transfers.

2

I agree it's not as easy as it should be. For example, KDE has an implementation of MTP, but it can only read images, not write them (at least in my version).

I found it was far easier to do it over the network. There are multiple ways to do this. Usuario mentioned ES File Explorer.

I used this free and open source Android FTP server and found it straightforward. You specify a username and password, then run the FTP server (it's very clear whether the server is running, and easy to enable/disable).

Then, you simply use any FTP client (there are many graphical clients, e.g. I used Konqueror). I was able to write the files back to the phone easily.

The only downsides are that it's probably a little slower than it would be with an efficient USB protocol, and that FTP is not secure (everything is in cleartext). It should be possible to do the same thing, but with an Android SFTP server; I just haven't personally found one yet.

2

After looking for a bunch of solutions to this problem, I've found Android File Transfer for Linux. This is the best MTP implementation for Linux, it just works.

You can see that this problem has been stated in The List of Major Linux Problems on the Desktop.

Linux doesn't have a reliably working hassle free fast native (directly mountable via the kernel; FUSE doesn't cut it) MTP implementation. In order to work with your MTP devices, like ... Linux based Android phones you'd better use ... Windows or MacOS X. Update: a Russian programmer was so irked by libMTP he wrote his own complete Qt based application which talks to the Linux kernel directly using libusb. Meet Android-File-Transfer-Linux.

1

Assuming you're using a USB connection, I found it works, but you need to do things in a specific order:

  • Don't plug in the phone to start with.
  • On the phone, go into Settings -> Wireless and Network -> USB Utilities, and click the "Connect store to PC". The phone will say "Connect USB cable to use mass storage".
  • Now plug in the USB cable to the phone. It should show the "green android" icon and USB connected message.

(I think my phone has an older version of Android, hopefully this works in the general case).

  • Ash is right, thanks for the tip!, it works fine. To transfer mp3 files, you have to press (on the mobile) where it says connect to usb; when you do that, rythym box or other program will open. Then you just drag your files from rhythm box to where it says DEVICE in rhythm box. The files will be in your mobile in a folder called Music. You can see the all your folder files on your desktop pressing the icon of your device. – user66631 May 1 '14 at 14:59
  • 1
    Unfortunately, newer versions of Android don't support mass storage mode. Only mtp (or ptp in some cases). Linux doesn't support mtp very well. – Edward Falk Jul 2 '15 at 0:20
  • @Edward: yes, you're right. After I "upgraded" from Galaxy S2 to S3, mass storage mode was no longer available. As Drake says in the accepted answer, I've found MTP to be flakier than mass storage so it's a bit unfortunate, but once you get it to work it's okay I guess. I'm using gMTP as a GUI client which works okay but it's fairly slow. – Ash Jul 2 '15 at 9:45
1

mtpfs - FUSE filesystem for Media Transfer Protocol devices

apt-get install mtpfs

Done. Works as with Windows in Linux Mint/Ubuntu/etc.

  • 2
    sudo apt-get install jmtpfs on jessie – Erik255 Dec 27 '14 at 23:21
  • it's jmptpfs also on wheezy. – sjas Feb 11 '15 at 20:31
1

I was able to use rsync to get my files over from my HTC phone. The commands were:

$ mkdir HTC_Dump
$ cd HTC_Dump
$ rsync -av /run/user/1000/gvfs/mtp\:host\=%5Busb%3A002%2C010%5D/ ./

Resulting in:

sent 12,947,428,344 bytes received 38,549 bytes 9,738,598.64 bytes/sec total size is 12,944,119,635 speedup is 1.00

I found the phone files location by looking in my /run directory.

This was on Xubuntu 17.10, Artful Aardvark, the Android was on an HTC running Android version 7.0.

  • no need to rsync,,, the copy command is enough cp -r /run/user/1000/gvfs/mtp\:host\=%5Busb%3A002%2C010%5D/ ~/Destination/Folder. I say this in the context of doing the only a copy, off-course if is to to update your PC with the latest photos taken, then rsync is the way to go. – Exadra37 Feb 24 at 12:51
1

I do this via FTP network created by ES File Explorer.

First of all, make your device as a portable hotspot in settings → Tethering & portable hotspot → check "Portable wifi hotspot", and then connect your PC to the device with WiFi.

It makes your connection faster than connection via central WLAN network. Then, do the following steps:

  1. Open ES File Explorer
  2. Go to Network → Remote Manager
  3. Press "Turn on" button
  4. In Linux (I use Ubuntu), open its file manager
  5. Click "Connect to Server" in the file manager left side
  6. Enter the address of your device has appeared in ES File Explorer

(ftp://...:...).

Now, you can treat with your device like a drive in your PC.

1

A sdcard is normaly an exfat file system, which is by default not recognized by Ubuntu by default (I do not know if this is the case with other distrubitions). To make my Ubuntu 16.04 LTS to be able to write to an exfat file system I did:

    sudo apt-get install exfat-fuse exfat-utils

Now I can just plugin my Android phone on my Ubuntu desktop with USB and copy files to my sdcard (64GB).

0

Try this command, and restart, it worked for me.

sudo apt-get install libmtp-common mtp-tools libmtp-dev libmtp-runtime libmtp9
  • Is that the extent of the solution? – Jeff Schaller Jul 6 '16 at 12:18
  • It is what worked for me, literally ran the command, was prompted to restart and once I logged in again I could read/write files on my android device using dolphin file manager. I didn't have to do anything else or change edit files. – Robby Lebotha Jul 6 '16 at 12:51
  • Im running Xubuntu with KDE Plasma 5 on my Asus ux303 – Robby Lebotha Jul 6 '16 at 12:53
  • You should add that info to the text of your answer, which is incomplete and confusing without it – nealmcb Dec 28 '16 at 14:57
0

I've found that it only works for USB if I use the cable supplied with that device or a similar device. The USB cable from my defunct Samsung tablet works fine with my Android Onix replacement. The only thing that works for my phone is that cable that came with it. Other USB charging / transfer cables don't work or not fully: won't copy .mp3 files for example. No idea why this is. But non device cables often don't show up as a USB device attachment.

I have not had to modify software or use special software. Just works.

0

In Linux Mint 19.1 transferring large numbers of photos can easily be done by activating Developer Options, and the going into the Android phone 'Settings' 'Developer Options,' 'USB Configuration." Then choose PTP (Picture Transfer Protocol) instead of MTP. Now photos will transfer at lightning speed just using the file explorer.

0

Lots of good answers I just want to simplify everything:

sudo apt install mtp-tools

Now plug in your Android phone via USB, cable matters so if one doesn't work try another.

mtp-detect

Done. Open up your file app or terminal and transfer away!

0

I just got a Google Pixel 3 phone, and I need to move pictures/videos from it to my Linux Mint 18.2. Here's how I did it:

  1. On my phone, I installed Cx File Explorer
  2. I opened the app, and hit the 'Network' tab
  3. I hit the 'Access from PC' button
  4. I left the defaults on the checkboxes ('Random port number' checked, 'Show hidden files' unchecked), and hit 'Start Service'
  5. Cx File Explorer displayed an FTP URL
  6. On my Linux laptop, I opened the file manager, and clicked on the 'File -> Connect to Server ...' option
  7. In the 'Connect to Server' dialog, I entered the FTP URL from step (5) in the 'Server' textbox, and clicked 'Connect'
  8. I can now see my phone's files in my laptop file manager
  9. The photos and videos I want to transfer are located under device/DCIM/Camera (and not in the device/Movies or device/Pictures folders, like you might think).
0

I am running Mint 19.2. My phone is a Pixel 1st Gen running Android 10. After google'ing for a solution and trying the MTP options suggested by many without success, I found that if you go to Settings -> Connect devices -> USB and change "USE USB FOR File transfer/Android Auto", Nemo mounts the phone's storage and gives access to the devices files. My phone was set the "No data transfer". Now had I checked the USB settings first the MTP solutions may have probably worked. As a side note, none of the suggested solutions on StackExchange, HowToForge or OMG! mentioned checking the USB settings on the phone first. I did read a few posts that MTP on Mint "works out of the box". But again, no mention of checking your phones settings. Hope this helps.

  • A number of comments suggest to install mtp-tools. Not saying that's not necessary. I believe the first step is to ensure the USB settings are set to allow for File Transfer before installing additional packages. In my case I installed libmtp9 (needed in 19.04 LTS) and mtp-tools. I simply got Unable to open raw device 0 error message. Uninstalled mtp-tools, enabled USB settings and viola file browser popped up with Pixel storage device like any other drive. – hackerkatt Sep 22 at 4:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.