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.

Questioner
  • 6,959

7 Answers7

6

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
Mark Kirby
  • 18,949
  • 19
  • 79
  • 116
Avinash Raj
  • 80,446
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.

Questioner
  • 6,959
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

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.

Andy
  • 614
Elder Geek
  • 36,752
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
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

Elder Geek
  • 36,752
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.

raggyp
  • 111