13

(Note: This question originally expressed two problems. After creating the bounty, I figured some things out, so I've narrowed it down to just one problem.)

I have just made a fresh install of Ubuntu 14.04.

When I plug in my Android phone by USB, I can access the files on the phone, though not smoothly. Image and sound files won't open unless I copy them to the computer first. Banshee crashes if the Android is connected.

This is the error if I try to open an image file:

enter image description here

"Failed to open input stream for file"

Why am I getting this error and how do I get my Android to connect without problems?

Note, I have tried switching from MTP to PTP mode, and when I do, I can't seem to acess files on the phone at all. I have installed mtp-tools. I can connect by USB mass storage, and then I can view image files and use Banshee. The downside there is that it takes half a dozen screens and selections on the Android device to enable USB mass storage mode each time I connect, and I'm looking for plug and play functionality.

Also note, I am agnostic about solutions in that I don't care if it means using MTP, PTP, or USB mass storage. I want to be able to use my Android device seemlessly, just plug it in and use, and I'm not bothered about how that happens.

The Android device is a Samsung Galaxy S2, running Android 4.1.2.

  • switch to mass storage mode and then connect your phone. – Avinash Raj Apr 18 '14 at 9:34
  • @AvinashRaj, it takes about 5 steps to get to mass storage mode. I hope it's not the case that the only solution is to go through that every time I connect my phone. – Questioner Apr 18 '14 at 9:36
  • The problem is mtp devices doesn't support basic file I/O. Take a look at this answer from another question. – 465544 May 5 '14 at 17:55
  • What android device do you have? – Seth May 5 '14 at 19:11
  • @Seth, added the device information to the question. – Questioner May 6 '14 at 10:45
7

The error which was clearly shown is, Unable to mount MTP device. So your system fails to mount(open) this mtp device. Installing mtp-tools package will solve this error and makes your mtp device to get connected.

sudo apt-get install mtp-tools
  • 1
    Connect your phone in USB 3.0 port not in 2.0 – Avinash Raj Apr 20 '14 at 1:18
  • The one with bluetongue=USB 3.0. Make sure that you have disabled USB tethering option on your phone. – Avinash Raj Apr 20 '14 at 1:27
  • 2
    According to lsusb, all my USB ports are USB 2.0. Also, USB tethering is not enabled. I appreciate your help, and you may be right that this error is partly to do with my computer's USB 2.0 connection, but I find it hard to believe there is no way to solve this error without getting a USB 3.0 port. – Questioner Apr 20 '14 at 1:31
  • @AvinashRaj wow wow wow! Connecting to usb 3.0 solved my problem (of file transfering failures with random kind) after trying a lotof solutions, thank you! Can you explain please, why usb 3.0 connection is significant? – ASten Mar 18 '17 at 22:08
2

Resolved this issue by upgrading to Android 4.4. Now, when I plug in the device, I get an "Android" device in Nautilus, which has two separate drives available, my internal and external SD card. There are no interface actions on the phone needed to connect the device. I actually can't tell if it's connecting using MTP or USB mass storage or what, but so long as it's working, I'm not too concerned about it.

Media files don't have preview icons, but can be opened and viewed without any errors.

2

On my galaxy s3 (android 4.4), I changed my settings from Media Device (MTP) to Camera (PTP) and I was able to view my Pictures and others files just fine.

1
+50

You'll be happy to know the previous set of USB utilities is still there to use. This is a work around rather than a permanent fix. RC

  1. On your android phone, go to Application->Settings
  2. In there, go to Wireless and Network and select USB Utilities
  3. Click on Connect Storage to PC, before you connect a USB cable
  4. A message should pop up: Connect USB cable to use mass storage
  5. Now connect the USB cable to computer
  6. The green android robot should be displayed with an option button for "Connect USB storage;" click on that.
  7. The green robot turns orange and now you can access the files on the internal storage and SD card of your phone.

source: http://catlingmindswipe.blogspot.com/2012/05/how-to-connect-android-samsung-galaxy.html

My tests indicate that installing PCManFM from Software Center will also allow you to access your files on the device in the way it worked in years gone by.

  • 1
    Thank you for this answer. As mentioned in the question, I am aware that this option existed. However, I am looking to have plug-and-play functionality. Having to go through that set of options every time is inconvenient and prone to error. – Questioner May 8 '14 at 1:39
  • @ Dave M G I'm sorry that your Samsung Galaxy S2 requires more steps to connect that you like. Perhaps the community can correct me If I'm wrong, but I believe changes to your Samsung firmware and/or Android 4.1.2 are a bit beyond the scope of this forum. – Elder Geek May 8 '14 at 13:40
  • The issue is that the kind of connectivity I am speaking about used to exist. A few years ago, I could plug in my Android, and it would just show up as an external drive, and that was that. However, my understanding is that Google decided to make their Android devices MTP by default, but that the Ubuntu support for MTP has been very patchy. I believe my Android device is doing the standard of what Android devices do, but that Ubuntu's support for it is weak. So, I think that puts the onus on Ubuntu. – Questioner May 8 '14 at 13:45
  • I have the exact same results with my android device under 14.04 as I have under 12.04. Granted my device is running an older version of the Android system than yours (2.37) and I am unable to reproduce with either that device nor a newer device running 4.3.2 I will install mtp-tools and see if I can reproduce and if so see if uninstalling same solves the problem and edit my answer accordingly. – Elder Geek May 8 '14 at 14:31
  • My results with mpt-tools are worse than yours (No Devices detected thus far) – Elder Geek May 8 '14 at 15:56
0

This may work with 4.1.2 as well.... cannot confirm

Storage [Tip] Re-enabling Mass Storage Mode Android 4.2.2 Just wanted to share some tips to those who wanted to re-enable the Mass Storage Mode on their Android 4.2.2

  1. Connect your phone to a computer (The device will be connected in MTP mode as default)
  2. Reboot your phone while connected to the computer
  3. Wait until you see the USB icon on your Notification Bar
  4. You will now have an option to select Mass Storage henceforth

source: http://forum.xda-developers.com/showthread.php?t=2350542

  • Thank you for this suggestion. Just tried it, and unfortunately, the only options it shows are MTP and PTP. It may be a 4.2.2 only option. – Questioner May 8 '14 at 15:35
  • 1
    @DaveMG Well, it was a long shot. Still might help someone. Hopefully something better suited will arrive. – Elder Geek May 8 '14 at 15:54
  • @DaveMG Here's another interesting thread which may be of some use: ubuntuforums.org/showthread.php?t=2194853 – Elder Geek May 8 '14 at 16:03
  • Install PCManFM File manager. This works seemlessly for me under 14.04. I discovered it worked under Lubuntu which uses PCMan File Manager by default so, tested and confirmed under Ubuntu 14.10 – Elder Geek May 9 '14 at 16:56
  • 1
    Won't PCManFM File Manager replace my window interface entirely? It's not that I'm against using a different interface if it works better, it's just that seems like a large scale change with possible side effects and reprocussions. I'd have to be sure about the degree of upheaval it would cause before using it just to solve this one issue. – Questioner May 9 '14 at 17:30
0

I have got a Galaxy S6, and I saw the same issue in Ubuntu 15.10 when accessing the files on the device (Failed to open input stream for image).

However, I was able to copy the files to my laptop and viewing them there, without altering any settings on phone/computer.

0

Having run into this problem many times, my feeling is, that it appears to happen more often with Samsung phones than with Huawei phones. I have not tested with others.

The problem is by my analysis, that Samsung allows exactly one MTP session after an USB cable has been connected and the user authorized file transfer. However, Ubuntu (and Kubuntu as well) apparently close and re-open the MTP session after already a few seconds of inactivity, or they try to use parallel MTP sessions (like one for directory listings and one for actual file transfer etc.). But the new MTP session is not authorized and boom, there is the error message, and the Samsung phone will even close the already authorized MTP session.

The best workaround is to use mtp-tools to permanently mount the android device. For reference see basically: https://wiki.ubuntuusers.de/MTP/

So I typed in a terminal window:

sudo apt-get install mtp-tools
sudo apt-get install jmtpfs
mkdir ~/samsung

(This needs only to be done once. On older Ubuntu versions, install package mtpfs instead of jmtpfs)

Then each time you want to connect the phone, connect the USB cable, unlock the phone, then on the phone bring up the message list by sliding down from the top, and look for the entry "Android system - USB for nnn". Tap that item, so that an overlay window opens, that lets you set the USB mode. Explicitely select "file transfer". If file transfer is already selected, select something else instead, then bring the window up again, and select "file transfer" a second time. Yes, having to use this window twice smells very much like a Samsung bug.

Sometimes, especially after failed mount attempts, the phone also brings up an "allow phone data access" dialog, that only allows "yes" and "no" as answers. Using that dialog works, too.

After all this preparation, just do:

jmtpfs ~/samsung

And voilá, your long sought after files appear in your ~/samsung directory, and more important, stay there until you disconnect the USB cable or power off either the smartphone or the computer. It doesn't even hurt, if the phone locks its display or turns off the display, as long, as it is not completely off. But don't try to click on the icon for the phone in the Ubuntu/Kubuntu file viewer. That will attempt to open a second MTP session and could actually kill the first MTP session, too. Instead, access the aforementioned ~/samsung directory.

To unmount the phone later, just type:

fusermount -u ~/samsung

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.