13
Jul
12

Galaxy S3 access files in Linux

I’ve gotten myself a Samsung Galaxy S3 recently, and wanted to change the ringtones and upload some music.

The problem is, I use mainly linux (read: ‘I don’t have Windows’).

So what with the MTP/PTP?

Apparently libmtp and jmtpfs don’t work with the S3 very well. The error is something like:

$ mtp-detect
libmtp version: 1.1.3

Listing raw device(s)
Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note.
Found 1 device(s):
Samsung: GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note (04e8:6860) @ bus 2, dev 21
Attempting to connect device(s)
PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
LIBMTP libusb: Attempt to reset device
LIBMTP PANIC: failed to open session on second attempt
Unable to open raw device 0
OK.

And since Kies is not available for linux (afaik) and running it on Wine is not really something I’m fond of, I had been searching for a way to access the phones files in a fast way.

There is a way, through rooting your phone, and installing an app, but my phone is new so I didn’t want that…yet :D

Since the access would have to be fast to be of my liking, it would have to be through USB cable, not Wifi. So I would probably have to do sth with ADB (Android Debug Bridge, google it)..

There is an adbfs solution already there:
http://collectskin.com/adbfs/

But it seems to be extremely slow. Adb was NOT designed for this kind of usage (continuous I/O access).

So I went on using an app I already knew, SSHDroid:
https://play.google.com/store/apps/details?id=berserker.android.apps.sshdroid&hl=en

But doesn’t this create a SSH server for remote shell login? Yeah, kinda does… but it’s SSH! This means you can run SSHFS through it! And better, forward the listening port through ADB to your own machine, via USB cable, so no Wifi is needed.

Here are the steps:
1. Install SSHDroid and run it
2. With the phone connected via USB, test adb with

$adb devices

and see if it shows up
3. Forward the remote SSHDroid port to your machine with

$adb forward tcp:2222 tcp:2222

(2222 is the default SSHDroid port for none rooted phones)
4. Mount sshfs on your machine with:

$sshfs -p 2222 root@localhost:/mnt/ >mount point, like ~/Desktop/sshfs<

The default password should be admin, if you haven’t changed it. YOU SHOULD HAVE!
5. Done! On my Arch, nautilus did not want to unmount it, so I ran

$fusermount -u <mount point, like ~/Desktop/sshfs>

As always, don’t trust what I tell you to do, just some guidelines to be able to find a similar, if not the same, solution. Have in mind that the steps here are not idiot-proof, I expect that people at least be able to use google and the basics of linux, like installing sshfs.

UPDATE (2013-04-12):
I decided to try again using the S3 with MTP and installed go-mtpfs on Arch. https://wiki.archlinux.org/index.php/MTP

After adding me as owner to udev rule, it seems to work but has some bugs:

$ touch test
touch: failed to close ‘test’: Invalid argument

but the file shows up:

$ ls
BKP clockworkmod data DCIM Downloads LOST.DIR MOV07784.MPG Roms test Tools

$ cat test
cat: test: Invalid argument

removing it works fine…

mtpfs still doesn’t work… either with

$ mtfps ~/s3/

or

# mtfps -o allow_other /home/oliver/s3/

Just does nothing.

w00t
simple-mtfps seems to work fine, will test it further! (available in AUR from Arch or https://github.com/phatina/simple-mtpfs/)

Showing the devices:

$ simple-mtpfs -l
Device 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP).
Unable to open ~/.mtpz-data for reading, MTPZ disabled.1: SamsungGalaxy models (MTP)

Mounting:

$ simple-mtpfs –device 1 s3/
Device 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP).

Unmounting (obvious):

$ fusermount -u /home/oliver/s3

It is recomended not running simple-mtfps as root, as always… but nice that it doesn’t need to run as root :D

Touching, displaying and removing files from both Phone and Card directories worked flawlessly.
Though I did not do a stress test on this method. Will try to pass some gigs later :D

UPDATE2:
Seems jmtpfs is working too! Some time that I haven’t tried it. Another solution, I prefer simple-mtpfs though for more options, listing and specifying the device to be mounted.

About these ads

16 Responses to “Galaxy S3 access files in Linux”


  1. 1 Ricchi
    2012/07/22 at 15:08

    Lovely, worked for me =)

  2. 2012/09/26 at 14:48

    I couldn’t do it as you said. adb devices showed no device at all but mtp-detect showed my SGS3. Googling for a while gave me the solution. You can try mtpfs or jmtpfs. It works flawlessly.
    Regards.

    • 2012/09/26 at 14:58

      ADB needs to have the udev rules added.

      I haven’t tested MTP lately, though on ubuntu 12.04 it didn’t work. Didn’t work on Archlinux either… I’ll test it again when I have the oportunity.

      • 2012/09/26 at 16:30

        I forget to mention I’m on Arch. :P
        I’m trying jmtpfs and it works very fast, I don’t need other solution ;)
        Furthermore, should be a bit slower than fuse because it needs to encrypt the data, or I guess so.
        Regards!

  3. 5 Noone
    2012/12/02 at 14:32

    The trailing slash at the end of the directory you want to mount is important, else you get the following error

    ls: cannot access /media/android: Input/output error

    In this case the following works:
    sshfs -p 2222 root@localhost:/mnt/ ~/Desktop/sshfs
    but this does not work:
    sshfs -p 2222 root@localhost:/mnt ~/Desktop/sshfs

  4. 6 Pau
    2012/12/09 at 19:12

    Hi, I did as you suggested and it’s mounted… but I only see asec, obb, secure and UsbDriveB@ UsbDriveD@ UsbDriveF@ extSdCard@ sdcard@ UsbDriveA@ UsbDriveC@ UsbDriveE@

    where are the folders with the files?

    thanks

    • 2012/12/09 at 23:44

      sdcard is your internal memory and extSdCard is your microSD, or at least should be.

      • 8 Pau
        2012/12/10 at 05:10

        yes, I know that, but how do I _access_ them? They’re showing as broken symlinks….

    • 2012/12/10 at 17:23

      Where do the symlinks point to (can be seen with ls -l )? What rom/version are you using?

      Try mounting with root@localhost:/>location pointed by symlinks</ instead of mnt…

  5. 2013/01/02 at 10:24

    Try like this:

    sshfs -p 2222 root@localhost:/ mount_point

  6. 11 Michael
    2013/02/04 at 19:01

    Thank you so much! I spent all evening messing about with the bloody MTP… this saved my day!

  7. 12 BeanDaddy
    2013/02/06 at 18:12

    Great, this really saved my day since I can’t use mtp (running linux mint against galaxy note 10.1 ICS).
    The thing is, I only get a maximum of ~800k/s transfer rate, which is pretty bad considering I’ve no other traffic on the wlan and the note is right next to the router (computer is on a wired lan to the router).

  8. 2013/04/17 at 02:36

    I must be fortunate…running Arch Linux as well. :)

    All I had to do was install libmtp and open Thunar. The phone is still complaining that there’s no software installed to run it, but I’m copying files over fine.

  9. 14 Mark
    2013/04/25 at 09:03

    LOL! In Windows I just plug the USB into the S3 and it show up in explorer. Linsux :D

    • 2013/04/25 at 13:25

      Never said that Windows wasn’t a more simple operating system. Should work out of the box for the most recent Ubuntu’s too.
      On the other side you have to install drivers for adb on Windows whereas on Linux you can just add a Udev rule. I’d use Windows as main operating system the day it provides integrated update for most installed software, no need for anti-virus and decent network management.

      I gave up some time ago trying to convert people to be Linux users, they just keep bugging me for support…


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


The Author

Older Ramblings

Tweets

Linux User Sig

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: