3

I have a Smasung A40, and when I connect it via MTP to get some data off of it, it takes AGES. When I connect it first and attempt to open the phone, it takes a solid 30 seconds before any folder appear, and the same goes if I open any subdirectory. Accessing files also is not particularly fast (like 10s to open a picture)

My google search turned up no results. I am also using a short, USB 3-capabe cable, but the problem still exists, no matter which cable or which USB port I use. I am running Ubuntu 20.04 LTS with all updates installed.

Any idea on what could cause this issue?

  • I'm pretty sure MTP is to blame and we can thank Microsoft and Android for that problem. The answer is to either transfer the files using a different protocol like PTP or I would suggest installing a fileserver application on android to transfer files wirelessly over your local network or use bluetooth (it's way easier and faster without wires). – mchid Dec 12 '20 at 12:31
  • Yes, it does, but why can windows do something here that Linux can't? Transmission via bluetooth is very slow, and I don't want to set up a complete file server on my phone. And does apple have the same problem with MTP? – Vincent Guttmann Dec 12 '20 at 18:32
  • Can it? From what other people report, Windows is also painfully slow at transferring files using MTP. There's an app called "software data cable" that's supposed to work fine. After installing the app, there should be a local (ftp) address listed. Put that address into your webbrowser on your Ubuntu computer to view the files, click to download or copy and paste the address into the terminal to download with wget or aria2c this is by far the fastest method than any data cable using any protocol. – mchid Dec 13 '20 at 13:25
  • Also, you don't need to transfer over bluetooth or use a fileserver to use PTP. – mchid Dec 13 '20 at 15:44
  • Well, when using windows on completely the same hardware, it was significantly faster. As I need to get some large documents off there, I think I will just use MTP. – Vincent Guttmann Dec 13 '20 at 16:07
  • You could also use Google Drive and then you would be able to access the file(s) from any computer. I've also heard about people using kdeconnect to transfer files from Android to Ubuntu and they say you don't have to use the Kubuntu desktop but I haven't tried this method. – mchid Dec 14 '20 at 14:09

1 Answers1

3

MTP is to blame and we can thank Microsoft and Android for that problem. The answer is to either transfer the files using a different protocol like PTP or I would suggest installing a fileserver application like "software data cable" on Android to transfer files wirelessly over your local network or use bluetooth (it's way easier and faster without wires).


Side Note: If you haven't already, install ADB (sudo apt install android-tools-adb) and try transferring the files the same way as before. Sometimes, it solves those problems, and you will still be able to use the graphical file exploreo.

The other option would be to use adb which is significantly faster than MTP.

First, you will need to install ADB:

sudo apt update
sudo apt install adb

note: if you get an "unable to locate package" error, run: sudo add-apt-repository universe and try again

Then, follow these instructions to use ADB commands to "pull" files off of your phone to Ubuntu or to "push" files to your phone from Ubuntu.

You should also be able to use ls and cd commands using and adb shell:

adb shell 

and then use cd and ls as normal to change directories or list files.

If your phone isn't rooted, you will need to list files from the storage directory or you won't have permission so you can use cd /storage before using ls or you could just list everything recursively using the following command (directories will be blue or white):

ls -R --color=always /storage

and you can also use grep to find a particular filename or directory (like your DCIM directory for example):

ls -R /storage | grep DCIM

If you need an easier method to find the location of your files, you could install a shell on your Android device that has access to the find command using an app called "terminal emulator for Android".

find /storage

will list the full path of pretty much every file you have access to if you don't have a rooted phone (and it also has grep).

See here for more information about finding and listing files using adb.


Alternatively, you can also transfer files from your phone to your computer using Google Drive.

First, use the Google Drive app to upload the files to your account.

Then, use a web-browser on any computer to go to drive.google.com and sign into your account where you can download the file(s).

mchid
  • 43,546
  • 8
  • 97
  • 150
  • Well, today I went back to the problem and installed the adb tools with sudo apt install android-tools-adb, and now, I can mount the phone just as usual, and see the files in the file explorer, but now, my speeds are in the 30 MB/s range! Seems like all it needed was ADB! – Vincent Guttmann Jan 06 '21 at 12:31
  • It would also be nice if you could approve my edit. – Vincent Guttmann Jan 06 '21 at 12:34
  • adb tool significantly helped me quickly move files. Thanks for great suggestion! – alierdogan7 Aug 27 '22 at 21:45
  • Could you also mention how to locate the phone's folder when using adb (/storage isn't found)? For MTP, I opened Nautilus, opened the phone's folder, right clicked to start a terminal there and typed pwd to get this: /run/user/1000/gvfs/mtp:host=SAMSUNG_SAMSUNG_Android_758ed427/Phone. But this is still an MTP path, isn't it? When running adb shell, I get a message * daemon started successfully error: no devices/emulators found. But what do I do after this? How do I know adb is active, and how to I use it to access the folders in the phone? – Nav May 17 '23 at 08:03
  • @Nav https://stackoverflow.com/a/25646340/3393576 – mchid May 22 '23 at 04:51
  • @Nav usb debug option is in the developer tools Android settings which you need to enable if it's not enabled. To enable developer tools, open Settings on your Android device, scroll down to and select About phone and then scroll down to Build number and tap that a bunch of times until a popup tells you that developer options are enabled. Then go back one screen to your main settings, select System > Advanced > and then Developer options. Then if you scroll down slightly, Usb debugging should be the first option under the second section, titled DEBUGGING. – mchid May 22 '23 at 04:58
  • No, the problem isn't related to USB debug. That was already enabled and even without that I had always been able to access my phone without any problem. I suspect that some recent software installation caused the problem. Perhaps JRE 11, when I needed to install JabRef. Never mind. I've removed Ubuntu and switched to Mint. – Nav May 22 '23 at 06:59
  • @Nav Kind of overkill don't you think? The answer at the link said to first disable and then re-enable USB debugging. – mchid May 22 '23 at 12:27
  • @mchid: Thanks, but by the time you pointed me to that answer, I had already got fed up with Ubuntu's other bugs too, and decided to switch to Mint. Right now I'm using Mint, and I find it much more friendlier than Ubuntu. – Nav May 22 '23 at 17:57