57

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?

6
  • I'd say that problem lies with hardware, not with software, especially not Linux or your distribution.
    – Bananguin
    Commented Aug 22, 2013 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
    Commented Aug 22, 2013 at 13:29
  • 1
    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
    Commented Aug 22, 2013 at 13:51
  • I am using android 4.1 Commented Aug 22, 2013 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
    Commented Sep 16, 2014 at 23:55

18 Answers 18

20

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.

11
  • 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. Commented Sep 6, 2013 at 6:30
  • 2
    For increased speed, you can also use adb pull as outlined in this post: vxlabs.com/2014/11/06/… Commented Nov 6, 2014 at 9:54
  • 42
    @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
    Commented Nov 21, 2014 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
    Commented Nov 21, 2014 at 9:14
  • 2
    AirDroid is now charging now for the local file transfer "feature".
    – sybind
    Commented May 1, 2015 at 10:09
11

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
2
  • 2
    Now it's under the Network section.
    – user288316
    Commented Apr 28, 2018 at 7:09
  • There's an open source alternative that has this as well: Material Files
    – aardbol
    Commented Sep 30, 2023 at 21:09
7

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
  • nice: you can "sudo apt install android-file-transfer", and it has an option to kill the other programs that are using the interface -- that last one is key! Commented Aug 20, 2022 at 16:20
6

mtpfs - FUSE filesystem for Media Transfer Protocol devices

apt-get install mtpfs

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

4
  • 6
    sudo apt-get install jmtpfs on jessie
    – Erik255
    Commented Dec 27, 2014 at 23:21
  • 2
    it's jmptpfs also on wheezy.
    – sjas
    Commented Feb 11, 2015 at 20:31
  • 1
    jmtpfs still is valid for both bionic and focal Commented Aug 15, 2022 at 15:54
  • Just tried installing jmtpfs on Ubuntu 22.04.4 and it works great for me. Didn't need to do anything else.
    – j3py
    Commented Aug 31 at 15:36
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.

3

Here's another very easy way. If you have xfce4 installed, run thunar. It just works. No mount-ing no mtp-ing. You can drag and drop in the thunar windows.

I have a full install of Slackware, so Xfce is just there even though I never use it as a desktop. It doesn't eat up disk space and is occasionally useful.

NB: You have to tell the phone to use USB for file transfer or PTP so that thunar can see it. On my OnePlus5 android 9, there's a notification when I plug in the USB cable that allows me to choose connection options.

2
  • That looks great, better than the default MTP system in the nautilus. But it doesn't look like that helps with newer Pixel 5 phones... that one is still invisible. Commented Sep 23, 2021 at 16:36
  • Wow! Did not know this, but it just works.
    – Alcamtar
    Commented Jul 11, 2023 at 1:52
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

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.

1
  • 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
    Commented Feb 24, 2019 at 12:51
2

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.

2

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.

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).

3
  • 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
    Commented May 1, 2014 at 14:59
  • 2
    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. Commented Jul 2, 2015 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
    Commented Jul 2, 2015 at 9:45
1

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.

1

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!

1

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).
1

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.

1
  • 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
    Commented Sep 22, 2019 at 4:09
1

An sdcard is normally 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 distributions. 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

You don't have to install anything.

just follow as follows :

  1. connect your USB cable(?) between your linux machine and your smart phone. (USB cable(?) : you always use when charging your smart phone.)

  2. Then your phone ask if you allow access to device data If you choose Allow, then an MTP connection will be established to access.

  3. You can transfer files between your linux machine and your adndroid.

That's all.

-1

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

sudo apt-get install libmtp-common mtp-tools libmtp-dev libmtp-runtime libmtp9
4
  • Is that the extent of the solution?
    – Jeff Schaller
    Commented Jul 6, 2016 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. Commented Jul 6, 2016 at 12:51
  • Im running Xubuntu with KDE Plasma 5 on my Asus ux303 Commented Jul 6, 2016 at 12:53
  • 1
    You should add that info to the text of your answer, which is incomplete and confusing without it
    – nealmcb
    Commented Dec 28, 2016 at 14:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .