[GUIDE] How to transfer files in Linux

Search This thread

bcmobile

Senior Member
Jan 9, 2009
357
97
Sydney
Now works on 32bit and 64bit Linux

Just a quick guide on how to configure Linux for file transfers using MTP. I wrote the instructions and config for Ubuntu Natty 32bit and 64bit, though the same process will work on other platforms - the only real difference being the package manager commands and possibly the config file locations.

The attached files are for the Galaxy Tab 10.1v but should work for the 10.1g / 10.1 as well. See the end of the post to learn how to modify this config to work for other devices.

How to configure for gMTP and other Media Sync tools

1) Install aptitude
Code:
sudo apt-get install aptitude
2) Install mtp-tools and mtpfs
Code:
sudo aptitude install mtpfs mtp-tools
3) Download the attached file ( View attachment 98-gtab.zip for 32bit Linux or View attachment 98-gtab.rules-AMD64.zip for 64bit Linux ) to your desktop.
4) Extract the 98-gtab.rules file to your desktop
5) Copy the rules file to /etc/udev/rules.d/
Code:
sudo cp ~/Desktop/98-gtab.rules /etc/udev/rules.d
6) Reboot
7) Connect your Tab
8) Run the following command to confirm it is working:
Code:
ls /dev | grep gtab
...which should return "gtab" if successful. If not, follow the "Modifying" guide below.
9) Download / install gMTP
Code:
sudo apt-get install gmtp
10) Open gMTP and select "connect" from the menu
11) Hit the thanks button :D
12) Go nuts!

Setting up for Automount (Optional, but recommended)

***You must have completed Steps 1-8 above before proceeding***
1) Edit your fstab file to add your gtab:
Code:
sudo gedit /etc/fstab
2) Add this to the end of the file:
Code:
#gtab
mtpfs     /media/gtab     fuse     user,noauto,allow_other      0      0
3) Save and exit
4) Open fuse.conf for editing:
Code:
sudo gedit /etc/fuse.conf
5) Find the following line and remove the #
Code:
#user_allow_other
6) Save and exit
7) Open and edit the groups file:
Code:
sudo gedit /etc/group
8) Find the details for the group 'fuse' and append your username to the end of the line eg.
Code:
fuse:x:104:<YOUR USER NAME>
9) Save and exit
10) Create the folder to mount your Tab:
Code:
sudo mkdir /media/gtab
11) Take ownership of the folder:
Code:
sudo chown <YOUR USER NAME>:users /media/gtab
12) Reboot
13) Plug in your Tab.
14) Click on the Places menu and click gtab.
15) You're in business!


Modifying for other devices

If the above doesn't work immediately on the 10.1g / 10.1 (I have only tested on the 10.1v), you can easily edit the rules file to support your device.

1) Install lsusb
Code:
sudo apt-get install lsusb
2) Run lsusb
Code:
lsusb
3) Check the output of this command to find your device. The 10.1v is shown like this:
Code:
Bus 001 Device 010: ID 04e8:6860 Samsung Electronics Co., Ltd
4) Make a note of the Vendor and Product IDs. In the example above, the vendor ID is 04e8 and device ID is 6860 (note 04e8:6860 in the output).
5) Open the rules file for editing (if it's not already in /etc/udev/rules.d, copy it there now)
Code:
sudo gedit /etc/udev/rules.d/98-gtab.rules
6) Find this line:
Code:
ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6860", MODE="0666" SYMLINK+="gtab"
7) Replace the Vendor ID (04e8) and Product ID (6860) with the ones that you got from step 3 above.
8) Save and exit
9) Reboot
10) Follow step 7 onward in the first guide above
11) Hit the thanks button :D


If you modify it for a particular device, please post the contents of your new 'rules' file here.


32bit RULES FILE:
Code:
ACTION!="add", GOTO="gtab_rules_end"
SUBSYSTEM!="usb|usb_device", GOTO="gtab_usb_end"

ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6860", MODE="0666" SYMLINK+="gtab"

LABEL="gtab_usb_end"

LABEL="gtab_rules_end"

64bit RULES FILE:
Code:
ACTION!="add", GOTO="gtab_rules_end"
SUBSYSTEM!="usb|usb_device", GOTO="gtab_usb_end"

ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6860", MODE="0777" SYMLINK+="gtab"

LABEL="gtab_usb_end"

LABEL="gtab_rules_end"
 
Last edited:

Konklone

Member
Aug 12, 2009
22
1
Everything worked for me up to the GMTP part - I can grep through /dev and I can see the "gtab" device there. But GMTP insists "Detect: No raw devices found."

I'm still running Maverick, but I added the maverick-backports repo, which has gmtp, so I would think it would work.

This is a Samsung Galaxy Tab 10.1v (from Google I/O). Any ideas?

EDIT: I also tried the automounting option with FUSE. Attempts to cd into it with bash or open it from the Places menu in GNOME both give the message "Transport endpoint is not connected".

EDIT again:

OK, I disabled USB Debugging and now have a different set of problems. mtp-detect sees the device now, but the message upon running it is:

Code:
libmtp version: 1.0.3

Listing raw device(s)
Device 0 (VID=04e8 and PID=6860) is UNKNOWN.
Please report this VID/PID and the device model to the libmtp development team
   Found 1 device(s):
   04e8:6860 @ bus 2, dev 26
Attempting to connect device(s)
ignoring usb_claim_interface = -16ignoring usb_claim_interface = -22PTP_ERROR_IO: Trying again after re-initializing USB interface
inep: usb_get_endpoint_status(): Device or resource busy
outep: usb_get_endpoint_status(): Device or resource busy
usb_clear_halt() on IN endpoint: Device or resource busy
usb_clear_halt() on OUT endpoint: Device or resource busy
usb_clear_halt() on INTERRUPT endpoint: Device or resource busy
LIBMTP PANIC: Could not open session! (Return code 767)
  Try to reset the device.
Unable to open raw device 0
OK.
 
Last edited:

bcmobile

Senior Member
Jan 9, 2009
357
97
Sydney
Everything worked for me up to the GMTP part - I can grep through /dev and I can see the "gtab" device there. But GMTP insists "Detect: No raw devices found."

I'm still running Maverick, but I added the maverick-backports repo, which has gmtp, so I would think it would work.

This is a Samsung Galaxy Tab 10.1v (from Google I/O). Any ideas?

EDIT: I also tried the automounting option with FUSE. Attempts to cd into it with bash or open it from the Places menu in GNOME both give the message "Transport endpoint is not connected".

Can you post the output from 'lsusb' ?

re the "Transport endpoint is not connected" - I just got this same error on 64bit Natty. Will try and see if I can find out why..
 
  • Like
Reactions: Konklone

Konklone

Member
Aug 12, 2009
22
1
Ah, just saw your reply. I edited my post up above, but the gist is - you can't do this while USB Debugging is enabled. The Tab has to be running its "MTP Application".

Now I'm getting the stranger errors above. I'm going to try mounting it with FUSE now to see if that helps for some reason.

EDIT: For the record, I'm using the correct vendor and product IDs in my rules file:

Code:
ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6860", MODE="0666" SYMLINK+="gtab"
 
Last edited:

bcmobile

Senior Member
Jan 9, 2009
357
97
Sydney
I edited my post up above, but the gist is - you can't do this while USB Debugging is enabled.

You may be right. When I wrote this guide, I was using a VM. It is possible that the fact that I was using both MTP and ADB at the same time has something to do with how VMWare presents the devices to the guest OS.

Now I am using 'bare metal' Natty 64 bit and have the same problem as you.

I have to go out for a while but will look at it again when I get back.

EDIT: Just tried mtp-detect and it is finding the device. I suspect USB Debug is not the issue, but I'll leave it in your capable hands - really got to go now

EDIT2: See here http://www.usb.org/developers/devclass_docs/MTP_1.0.zip OK - Im really REALLY going now. Back online in a few hours :D
 
Last edited:

Konklone

Member
Aug 12, 2009
22
1
I couldn't get anywhere until I turned off USB debugging. When USB debugging is enabled, I *can* use adb to get into the shell, see files, install apps, etc. I can even transfer files over adb, through the command line! Can you get MTP to detect it with USB debugging enabled?

With USB debugging off, I have once in a great while (only twice in all my attempts) while gotten mtp-detect to connect to the device and print sane output describing the device. Even when those happened, running the command immediately again didn't connect correctly, and gave me the same error messages I was getting before. Both times I got it to connect, it was soon after plugging in the cable, but it doesn't happen every time.

Intermittent heisenbugs are the worst, yet I don't think I have a busted cable, given that adb works perfectly consistently.

Maybe I should try this again after updating to Natty...I'd been meaning to do it anyhow...

EDIT: One thing I notice is that on the Tab, when the "MTP Application" is running after plugging in, the 5-dot "in progress" animation is extremely choppy, as if the device were very very busy. If the device were very very busy for some reason, this could explain why a successful connection can happen only once in a great while. I'll try rebooting the device, I guess.

EDIT2: I rebooted the device, and I removed the USB extension cord I was using, but neither helped, still getting the same intermittent success. (I got mtp-detect to connect to it a few more times - all soon after plugging in the cable, and none were repeatable without unplugging and replugging it in.) The animation actually wasn't choppy before, that's just how it looks - 5 discrete animation frames, one for each dot.

Something interesting though: this time I had the Tab resting on my knee, and I felt a haptic buzz after running mtp-detect on one occasion. I looked down and saw the MTP Application restart itself. Then I ran mtp-detect again and I felt 3 haptic buzzes in quick succession, followed by a successful detection and output. But when running mtp-detect *again*, no dice.

This is messed up.
 
Last edited:

bcmobile

Senior Member
Jan 9, 2009
357
97
Sydney
Messed up indeed.

Can you get MTP to detect it with USB debugging enabled?

Yes, both work simultaneously on 32bit Natty

Note that you have to unmount the gtab for mtp-detect to work. I compared the output from mtp-detect on the 32bit working VM and the 64bit non-working 'bare metal' machine and the output was identical. I suspect this means that mtpfs is not where the problem is :confused:

Re the strange problem with haptic feedback - I have had mine power off all by itself when testing some different parameters in the rules file.
 
  • Like
Reactions: Konklone

bcmobile

Senior Member
Jan 9, 2009
357
97
Sydney
[64bit working]

OK. Problem solved... kind of. There seems to be some kind of bug in fuse which requires the filesystem to mount with higher permissions to run properly (at least on Natty AMD64)

If you use the new 64bit rules file I have attached, it should work. Basically it uses 777 permissions instead of 666. Not great, but working nonetheless.

New rules file for 64bit:
Code:
ACTION!="add", GOTO="gtab_rules_end"
SUBSYSTEM!="usb|usb_device", GOTO="gtab_usb_end"

ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6860", MODE="0777" SYMLINK+="gtab"

LABEL="gtab_usb_end"

LABEL="gtab_rules_end"

EDIT: If someone wants to experiment with lesser permissions and see what the minimum is and post back, that would be helpful for all.
 
Last edited:
  • Like
Reactions: Konklone

Konklone

Member
Aug 12, 2009
22
1
Sigh, thank you for taking so much time to help me so far, but I wonder if I'm a lost cause.

I spent a bunch of today finishing my upgrade to Natty, including a full wipe and reinstall. (I have a 32-bit machine, btw.) Now I can't even get it to detect my MTP device at all (mtp-detect says "No raw devices found."), with or without debugging enabled.

One possibly important topic - it's really surprising to me that yours works either way, because lsusb shows that a different product ID is exposed to the host, depending on whether debugging is on or not. With debugging disabled, it's 6860, like your example. With debugging enabled, it's 685e. When I run lsusb, only one of those will show up, never both. So if yours is the same device, I have no idea how your rules file could be agnostic to debugging being enabled. If yours is not, then that might explain our different experiences.

Anyway, I've Thanks'd all your posts in this thread, solved or not. I appreciate your help.
 

bcmobile

Senior Member
Jan 9, 2009
357
97
Sydney
With debugging enabled, it's 685e. When I run lsusb, only one of those will show up, never both

You're more than welcome.

I noticed that in Windows, both devices appear in device manager. That is a very strange problem you have discovered.

I just posted instructions and files to give you root access! Might take your mind off the MTP issues for a while :)

Who knows... the problem might just go away :D
 

ajvogel

Member
Mar 17, 2011
6
1
One possibly important topic - it's really surprising to me that yours works either way, because lsusb shows that a different product ID is exposed to the host, depending on whether debugging is on or not. With debugging disabled, it's 6860, like your example. With debugging enabled, it's 685e. help.

Are you sure? On my device its the other way around. Without debugging its 685e and with debugging its 6860?
 

Konklone

Member
Aug 12, 2009
22
1
This is craziness. Is my Galaxy Tab a rare mutant piece of hardware who had its USB numbers switched?

Also - I noticed that Ubuntu somehow automounts my tablet and can read/write to its disk, through a Nautilus plugin. But I still get nothing with mtp-detect. I don't understand how the world works.
 

mimidede

New member
Jun 12, 2011
1
0
I've also got an I/O tablet (updated to 3.1) and I followed this tutorial, so thanks for the help you provided! I managed to copy some files to the device but it ended up freezing my computer (running Ubuntu 10.10).

So I unplugged the tablet, and saw that effectively those few pictures and pdf files had been copied to the device successfully. Pictures are in the Gallery, pdf can be read with Aldiko... but the funny thing is that when I mounted again the tablet -using Ubuntu again- it shows all folders as empty!

That is, 0 files in all tablet folders.

I tried "showing all hidden files" with Nautilus. No luck, nothing is shown. Went to the folder using command line, did an ls -la (just in case who knows! maybe it would show something!). No luck either, directories are apparently empty and have "1 January 1970" as modification date... if it helps.

I can see the files inside the folders using ADB but it's obviously not ideal, specially compared with simply using Nautilus.

Does it happen to you too?
 

ikon8

Senior Member
Feb 23, 2010
407
127
L.A.
Anyone get this working? I'm having the same exact issues as Konklone. I'm on Maverick and tried the different udev rules and it still doesn't work. I'm gonna be pissed if I have to buy the stupid Samsung USB adapter just to get USB mass storage.
 

Lou2serious

Senior Member
Jun 9, 2009
292
2
Orange county
I'm having the same issue. First try I was able to plug in and mount to my netbook. Tried to plug into my mac and it didn't work. Hasn't worked since then, i'm considering doing a factory reset.
 

kungfoofool

Member
Dec 6, 2010
23
0
I'm running Ubuntu 10.10 64-bit. Note that you do have to enable backports to install gmtp.

Edit /etc/apt/sources.list, uncomment the lines with:
Code:
deb (http-url) maverick-backports main restricted universe multiverse
deb-src (http-url) maverick-backports main restricted universe multiverse

Run
Code:
sudo apt-get update && sudo apt-get install gmtp

I had to unplug the device and replug it back in a couple of times before gmtp would connect to it properly. It seems to be pretty flaky.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 17
    Now works on 32bit and 64bit Linux

    Just a quick guide on how to configure Linux for file transfers using MTP. I wrote the instructions and config for Ubuntu Natty 32bit and 64bit, though the same process will work on other platforms - the only real difference being the package manager commands and possibly the config file locations.

    The attached files are for the Galaxy Tab 10.1v but should work for the 10.1g / 10.1 as well. See the end of the post to learn how to modify this config to work for other devices.

    How to configure for gMTP and other Media Sync tools

    1) Install aptitude
    Code:
    sudo apt-get install aptitude
    2) Install mtp-tools and mtpfs
    Code:
    sudo aptitude install mtpfs mtp-tools
    3) Download the attached file ( View attachment 98-gtab.zip for 32bit Linux or View attachment 98-gtab.rules-AMD64.zip for 64bit Linux ) to your desktop.
    4) Extract the 98-gtab.rules file to your desktop
    5) Copy the rules file to /etc/udev/rules.d/
    Code:
    sudo cp ~/Desktop/98-gtab.rules /etc/udev/rules.d
    6) Reboot
    7) Connect your Tab
    8) Run the following command to confirm it is working:
    Code:
    ls /dev | grep gtab
    ...which should return "gtab" if successful. If not, follow the "Modifying" guide below.
    9) Download / install gMTP
    Code:
    sudo apt-get install gmtp
    10) Open gMTP and select "connect" from the menu
    11) Hit the thanks button :D
    12) Go nuts!

    Setting up for Automount (Optional, but recommended)

    ***You must have completed Steps 1-8 above before proceeding***
    1) Edit your fstab file to add your gtab:
    Code:
    sudo gedit /etc/fstab
    2) Add this to the end of the file:
    Code:
    #gtab
    mtpfs     /media/gtab     fuse     user,noauto,allow_other      0      0
    3) Save and exit
    4) Open fuse.conf for editing:
    Code:
    sudo gedit /etc/fuse.conf
    5) Find the following line and remove the #
    Code:
    #user_allow_other
    6) Save and exit
    7) Open and edit the groups file:
    Code:
    sudo gedit /etc/group
    8) Find the details for the group 'fuse' and append your username to the end of the line eg.
    Code:
    fuse:x:104:<YOUR USER NAME>
    9) Save and exit
    10) Create the folder to mount your Tab:
    Code:
    sudo mkdir /media/gtab
    11) Take ownership of the folder:
    Code:
    sudo chown <YOUR USER NAME>:users /media/gtab
    12) Reboot
    13) Plug in your Tab.
    14) Click on the Places menu and click gtab.
    15) You're in business!


    Modifying for other devices

    If the above doesn't work immediately on the 10.1g / 10.1 (I have only tested on the 10.1v), you can easily edit the rules file to support your device.

    1) Install lsusb
    Code:
    sudo apt-get install lsusb
    2) Run lsusb
    Code:
    lsusb
    3) Check the output of this command to find your device. The 10.1v is shown like this:
    Code:
    Bus 001 Device 010: ID 04e8:6860 Samsung Electronics Co., Ltd
    4) Make a note of the Vendor and Product IDs. In the example above, the vendor ID is 04e8 and device ID is 6860 (note 04e8:6860 in the output).
    5) Open the rules file for editing (if it's not already in /etc/udev/rules.d, copy it there now)
    Code:
    sudo gedit /etc/udev/rules.d/98-gtab.rules
    6) Find this line:
    Code:
    ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6860", MODE="0666" SYMLINK+="gtab"
    7) Replace the Vendor ID (04e8) and Product ID (6860) with the ones that you got from step 3 above.
    8) Save and exit
    9) Reboot
    10) Follow step 7 onward in the first guide above
    11) Hit the thanks button :D


    If you modify it for a particular device, please post the contents of your new 'rules' file here.


    32bit RULES FILE:
    Code:
    ACTION!="add", GOTO="gtab_rules_end"
    SUBSYSTEM!="usb|usb_device", GOTO="gtab_usb_end"
    
    ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6860", MODE="0666" SYMLINK+="gtab"
    
    LABEL="gtab_usb_end"
    
    LABEL="gtab_rules_end"

    64bit RULES FILE:
    Code:
    ACTION!="add", GOTO="gtab_rules_end"
    SUBSYSTEM!="usb|usb_device", GOTO="gtab_usb_end"
    
    ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6860", MODE="0777" SYMLINK+="gtab"
    
    LABEL="gtab_usb_end"
    
    LABEL="gtab_rules_end"
    3
    I edited my post up above, but the gist is - you can't do this while USB Debugging is enabled.

    You may be right. When I wrote this guide, I was using a VM. It is possible that the fact that I was using both MTP and ADB at the same time has something to do with how VMWare presents the devices to the guest OS.

    Now I am using 'bare metal' Natty 64 bit and have the same problem as you.

    I have to go out for a while but will look at it again when I get back.

    EDIT: Just tried mtp-detect and it is finding the device. I suspect USB Debug is not the issue, but I'll leave it in your capable hands - really got to go now

    EDIT2: See here http://www.usb.org/developers/devclass_docs/MTP_1.0.zip OK - Im really REALLY going now. Back online in a few hours :D
    1
    Everything worked for me up to the GMTP part - I can grep through /dev and I can see the "gtab" device there. But GMTP insists "Detect: No raw devices found."

    I'm still running Maverick, but I added the maverick-backports repo, which has gmtp, so I would think it would work.

    This is a Samsung Galaxy Tab 10.1v (from Google I/O). Any ideas?

    EDIT: I also tried the automounting option with FUSE. Attempts to cd into it with bash or open it from the Places menu in GNOME both give the message "Transport endpoint is not connected".

    Can you post the output from 'lsusb' ?

    re the "Transport endpoint is not connected" - I just got this same error on 64bit Natty. Will try and see if I can find out why..
    1
    Messed up indeed.

    Can you get MTP to detect it with USB debugging enabled?

    Yes, both work simultaneously on 32bit Natty

    Note that you have to unmount the gtab for mtp-detect to work. I compared the output from mtp-detect on the 32bit working VM and the 64bit non-working 'bare metal' machine and the output was identical. I suspect this means that mtpfs is not where the problem is :confused:

    Re the strange problem with haptic feedback - I have had mine power off all by itself when testing some different parameters in the rules file.
    1
    [64bit working]

    OK. Problem solved... kind of. There seems to be some kind of bug in fuse which requires the filesystem to mount with higher permissions to run properly (at least on Natty AMD64)

    If you use the new 64bit rules file I have attached, it should work. Basically it uses 777 permissions instead of 666. Not great, but working nonetheless.

    New rules file for 64bit:
    Code:
    ACTION!="add", GOTO="gtab_rules_end"
    SUBSYSTEM!="usb|usb_device", GOTO="gtab_usb_end"
    
    ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6860", MODE="0777" SYMLINK+="gtab"
    
    LABEL="gtab_usb_end"
    
    LABEL="gtab_rules_end"

    EDIT: If someone wants to experiment with lesser permissions and see what the minimum is and post back, that would be helpful for all.