HOWTO: Linux and MTP

Search This thread

Lloir

Inactive Recognized Developer
Mar 23, 2009
6,240
8,029
This is a quick how to get MTP working on Linux, the guide is for distro's based on Debian (mint\debian\ubuntu) OpenSuse, Fedora AND Gentoo. If there's any missing for major distro's let me know, or add them to a separate post and i'll put them up here


***Debian based distros**

Code:
sudo apt-get install mtpfs
sudo mkdir /media/onex
sudo chmod 775 /media/onex
sudo mtpfs -o allow_other /media/onex
gedit /etc/udev/rules.d/51-android.rules
and add the following line:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
and then:
sudo service udev restart

***Arch Linux***
Code:
pacman -S libmtp

After installation, you have several mtp tools available. Upon connecting your MTP device, you use:

mtp-detect

and add the following line:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
and then reload udev rules:
udevadm control --reload

Arch Linux guide is from the ArchLinux wiki

**Redhat\Fedora16**
First of all, I using my computer with other people, who can come over the network, so the 0666 mode bits not a right choice for me. I make it all on a fedora 16, but the distro is really not important.

So the steps:
- add a user to the "disk" group (or whatever You want)
- make a mount point (the media doesn't work for me, across the init removes the content)
- add this mount point to the fstab, with some parameter
- create udevd rules
- restart udevd
- install fuse-mtpfs
- (re)login user
- try it

My common experience is that, the mtpfs is very very very very slow. Really slow, so I can use it only with CLI, any GUI has been coming back with time out

And the "code":
Code:
usermod -a -G disk $LOGINUSER
Code:
sudo mkdir /mnt/sgs2 ; sudo chgrp disk /mnt/sgs2; sudo chmod 0770 /mnt/sgs2
Code:
sudo echo "mtpfs /mnt/sgs2 fuse users,noauto 0 0" >> /etc/fstab
Code:
cat > /etc/udev/rules.d/51-android.rules <<EOF
SUBSYSTEM!="usb_device", GOTO="label_end"
ACTION!="add", GOTO="label_end"

# ATRRS{idVendor}== ertekei:
#Acer	0502
SUBSYSTEM=="usb",ATTRS{idVendor}=="0502",MODE="0660",GROUP="disk"
#ASUS	0b05
SUBSYSTEM=="usb",ATTRS{idVendor}=="0b05",MODE="0660",GROUP="disk"
#Dell	413c
SUBSYSTEM=="usb",ATTRS{idVendor}=="413c",MODE="0660",GROUP="disk"
#Foxconn	0489
SUBSYSTEM=="usb",ATTRS{idVendor}=="0489",MODE="0660",GROUP="disk"
#Fujitsu	04c5
SUBSYSTEM=="usb",ATTRS{idVendor}=="04c5",MODE="0660",GROUP="disk"
#Fujitsu Toshiba	04c5
SUBSYSTEM=="usb",ATTRS{idVendor}=="04c5",MODE="0660",GROUP="disk"
#Garmin-Asus	091e
SUBSYSTEM=="usb",ATTRS{idVendor}=="091e",MODE="0660",GROUP="disk"
#Google	18d1
SUBSYSTEM=="usb",ATTRS{idVendor}=="18d1",ATTRS{idProduct}=="4ee1",MODE="0660",GROUP="disk"
#Hisense	109b
SUBSYSTEM=="usb",ATTRS{idVendor}=="109b",MODE="0660",GROUP="disk"
#HTC	0bb4
SUBSYSTEM=="usb",ATTRS{idVendor}=="0bb4",MODE="0660",GROUP="disk"
#Huawei	12d1
SUBSYSTEM=="usb",ATTRS{idVendor}=="12d1",MODE="0660",GROUP="disk"
#K-Touch	24e3
SUBSYSTEM=="usb",ATTRS{idVendor}=="24e3",MODE="0660",GROUP="disk"
#KT Tech	2116
SUBSYSTEM=="usb",ATTRS{idVendor}=="2116",MODE="0660",GROUP="disk"
#Kyocera	0482
SUBSYSTEM=="usb",ATTRS{idVendor}=="0482",MODE="0660",GROUP="disk"
#Lenovo	17ef
SUBSYSTEM=="usb",ATTRS{idVendor}=="17ef",MODE="0660",GROUP="disk"
#LG	1004
SUBSYSTEM=="usb",ATTRS{idVendor}=="1004",MODE="0660",GROUP="disk"
#Motorola	22b8
SUBSYSTEM=="usb",ATTRS{idVendor}=="22b8",MODE="0660",GROUP="disk"
#NEC	0409
SUBSYSTEM=="usb",ATTRS{idVendor}=="0409",MODE="0660",GROUP="disk"
#Nook	2080
SUBSYSTEM=="usb",ATTRS{idVendor}=="2080",MODE="0660",GROUP="disk"
#Nvidia	0955
SUBSYSTEM=="usb",ATTRS{idVendor}=="0955",MODE="0660",GROUP="disk"
#OTGV	2257
SUBSYSTEM=="usb",ATTRS{idVendor}=="2257",MODE="0660",GROUP="disk"
#Pantech	10a9
SUBSYSTEM=="usb",ATTRS{idVendor}=="10a9",MODE="0660",GROUP="disk"
#Pegatron	1d4d
SUBSYSTEM=="usb",ATTRS{idVendor}=="1d4d",MODE="0660",GROUP="disk"
#Philips	0471
SUBSYSTEM=="usb",ATTRS{idVendor}=="0471",MODE="0660",GROUP="disk"
#PMC-Sierra	04da
SUBSYSTEM=="usb",ATTRS{idVendor}=="04da",MODE="0660",GROUP="disk"
#Qualcomm	05c6
SUBSYSTEM=="usb",ATTRS{idVendor}=="05c6",MODE="0660",GROUP="disk"
#SK Telesys	1f53
SUBSYSTEM=="usb",ATTRS{idVendor}=="1f53",MODE="0660",GROUP="disk"
#Samsung	04e8
SUBSYSTEM=="usb",ATTRS{idVendor}=="04e8",ATTRS{idProduct}=="6860",MODE="0660",GROUP="disk"
#Sharp	04dd
SUBSYSTEM=="usb",ATTRS{idVendor}=="04dd",MODE="0660",GROUP="disk"
#Sony	054c
SUBSYSTEM=="usb",ATTRS{idVendor}=="054c",MODE="0660",GROUP="disk"
#Sony Ericsson	0fce
SUBSYSTEM=="usb",ATTRS{idVendor}=="0fce",MODE="0660",GROUP="disk"
#Teleepoch	2340
SUBSYSTEM=="usb",ATTRS{idVendor}=="2340",MODE="0660",GROUP="disk"
#Toshiba	0930
SUBSYSTEM=="usb",ATTRS{idVendor}=="0930",MODE="0660",GROUP="disk"
#ZTE	19d2
SUBSYSTEM=="usb",ATTRS{idVendor}=="19d2",MODE="0660",GROUP="disk"

LABEL="label_end"
Code:
udevadm control --reload-rules

Code:
yum/apt-get/pacman/etc install mtpfs

Logout-login, for get in to the disk group, connect the device via usb, and try
Code:
mptfs
without any parameter, and it must write out some information:
Code:
[email protected]:~$ mtpfs 
Listing raw device(s)
Device 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP).
   Found 1 device(s):
   Samsung: Galaxy models (MTP) (04e8:6860) @ bus 2, dev 4
Attempting to connect device
Android device detected, assigning default bug flags
Listing File Information on Device with name: (NULL)
fuse: missing mountpoint parameter

And finally mount /it must be working now with user account/:
[CODE]mount /mnt/sgs2
or dismount:
Code:
umount /mnt/sgs2

**OpenSuse 12.2**

this method will work for music and photos access only,

Code:
sudo zypper addrepo -f http://packman.inode.at/suse/12.2/ packman
sudo zypper ref (type a to always accept the packman repo)
sudo zypper in mtpfs
sudo vim /lib/udev/rules.d/69-libmtp.rules and add the following line (replace vim with gedit if you want a gui editor)
# HTC One X+
ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0dfc", SYMLINK+="libmtp-%k", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"

sudo cp /lib/udev/rules.d/69-libmtp.rules /etc/udev/rules.d/.
reboot

When you plug in the phone you will see android phone icon on the desktop click on it to browse your files.

*note
disable any media players from trying to read the device...

** Gentoo **

Code:
Prerequisites

If your device is not recognized by libmtp, try upgrading to latest (or even git) version.
User needs to be in group plugdev to mount device.
MTPFS

You need to add option: user_allow_other in /etc/fuse.conf
$ mkdir ~/AndroidDevice
$ mtpfs -o allow_other ~/AndroidDevice
NOTE: this can take really long time, up to several minutes. As an indication of successful mount the mtpfs will go to background.
To unmount:
$ /usr/bin/fusermount -u ~/AndroidDevice

If mtpfs doesn't work for you try updating to latest version first.
Go-MTPFS

Seems to be more stable
$ emerge -a go
$ mkdir ~/go
$ export GOPATH=/home/$USER/go
$ go get github.com/hanwen/go-mtpfs

To mount:
$ ~/go/bin/go-mtpfs ~/AndroidDevice

To unmount:
$ /usr/bin/fusermount -u ~/AndroidDevice
Troubleshooting

Sometimes (e.g. on HTC One X) USB debugging automatically turns on when device is connected to PC. You need to turn debugging off, otherwise libmtp can't recognise device.
Make sure your Android device is not going to sleep and the screen is not getting locked. Set screen timeout to very long values, or enable in Development section flag "Do not turn off the screen".

Thanks to ihavoc and Fonya1 for the opensuse and redhat\fedora tutorials
 
Last edited:

Th!baut

Member
Dec 19, 2012
7
0
thank you a lot for your help.

when i try to acces to the /media/onex direcory i have this :

ls: cannot access onex: Transport endpoint is not connected
 

somemadcaaant

Senior Member
Apr 28, 2010
1,064
361
After making changes reboot your session or pc and it will probably mount correctly which you've probably done by now.

Sent from my HTC One X+ using xda premium
 

Th!baut

Member
Dec 19, 2012
7
0
After making changes reboot your session or pc and it will probably mount correctly which you've probably done by now.

Sent from my HTC One X+ using xda premium

excuse me to ask many question but i am really noob. when all this done what would i see in /media/onex ? actualy after mounting the folder is empty

the only thing i need to do is copy files from/to my HOX+
 

Th!baut

Member
Dec 19, 2012
7
0
It still dont work, i have tryed so many things these days to mount my HTC Ox+ as a USB Mass Storage and everything failed.

I tried tou manualy mount a MTP folder on my Ubuntu like Lloir explained here.

I tried to flash a TeamWorkRecovery and a ClockWorkRecovery to access the "Mount USB" option in the menu

my Device is seen by ubuntu but i am unable to read or write anything, for example if I copy a music album, the copy operation starts, takes a very long time an then end whith an error lik "error unable to copy xxxx.mp3 file does not exist"

actualy i am almost convicted that using an MTP device as an usb mass storage under Ubuntu is purely and simply IMPOSSIBLE !
 

blackhand1001

Senior Member
Sep 3, 2011
1,302
685
Linux really needs to add native support for MTP already. They also should add native support for adb as well while they are at it. Its annoying to have to add entrees to udev to even to be able to access the device.
 
  • Like
Reactions: mikereidis

tliebeck

Senior Member
Sep 15, 2010
1,839
4,325
Southern California
One suggestion for anyone wanting to do this with a device other than an HTC:

You'll need to change the line you add to /etc/udev/rules.d/51-android.rules based on the vendor of your phone.
Code:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"

Change the code to one of the following USB vendor ids:

Code:
Acer	0502
ASUS	0b05
Dell	413c
Foxconn	0489
Fujitsu	04c5
Fujitsu Toshiba	04c5
Garmin-Asus	091e
Google	18d1
Hisense	109b
HTC	0bb4
Huawei	12d1
K-Touch	24e3
KT Tech	2116
Kyocera	0482
Lenovo	17ef
LG	1004
Motorola	22b8
NEC	0409
Nook	2080
Nvidia	0955
OTGV	2257
Pantech	10a9
Pegatron	1d4d
Philips	0471
PMC-Sierra	04da
Qualcomm	05c6
SK Telesys	1f53
Samsung	04e8
Sharp	04dd
Sony	054c
Sony Ericsson	0fce
Teleepoch	2340
Toshiba	0930
ZTE	19d2

Most up-to-date list is here: http://developer.android.com/tools/device.html

You can also have multiple vendor lines in your /etc/udev/rules.d/51-android.rules file, just put one on each line. As someone who's testing on a bunch of different devices, I simply put a line in for all of the above :)

If your vendor code isn't listed, enter the command "lsusb" in a terminal, and you'll see something like this:
Code:
Bus 001 Device 119: ID 04e8:6860 Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II]
Bus 001 Device 112: ID 18d1:4e42 Google Inc.

The first four hex values of the id is the vendor ID, e.g., for the Samsung it's 04e8.
 

Nschneider7

Senior Member
Sep 23, 2011
99
21
Buffalo NY
Hey I have to say first off thanks for taking the time to figure this out! My problem is I am very new to linux and ubuntu. So when I open the terminal and type all the commands after "sudo mtpfs -o allow_other /media/onex" I get the response: "Listing raw device(s) No raw devices found." So should I have the device attached when I do this? Secondly the following command opens a text window. Is this where i type "SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"? Because now I can't save the text file because I don't have root. Should I be typing literally everything in Terminal? or am I just too new and missing a step. Your help would be greatly appreciated because I would really like to learn a lot more about linux however I'm a bit cautious asking for root for things and ****ing up lol. I'm over windows and will never use a mac so I want to learn! Sorry to be an idiot and a pain just wanna learn.
 

tliebeck

Senior Member
Sep 15, 2010
1,839
4,325
Southern California
Hey I have to say first off thanks for taking the time to figure this out! My problem is I am very new to linux and ubuntu. So when I open the terminal and type all the commands after "sudo mtpfs -o allow_other /media/onex" I get the response: "Listing raw device(s) No raw devices found." So should I have the device attached when I do this? Secondly the following command opens a text window. Is this where i type "SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"? Because now I can't save the text file because I don't have root. Should I be typing literally everything in Terminal? or am I just too new and missing a step. Your help would be greatly appreciated because I would really like to learn a lot more about linux however I'm a bit cautious asking for root for things and ****ing up lol. I'm over windows and will never use a mac so I want to learn! Sorry to be an idiot and a pain just wanna learn.

That "SUBSYSTEM..." line needs to be appended to the file opened in the text editor. It shouldn't be entered on the command line.

And add "sudo" to in front of that gedit line...i.e., "sudo gedit /etc/udev/rules.d/51-android.rules"

Good luck!
 
  • Like
Reactions: ahlulnugraha

Top Liked Posts

  • There are no posts matching your filters.
  • 34
    This is a quick how to get MTP working on Linux, the guide is for distro's based on Debian (mint\debian\ubuntu) OpenSuse, Fedora AND Gentoo. If there's any missing for major distro's let me know, or add them to a separate post and i'll put them up here


    ***Debian based distros**

    Code:
    sudo apt-get install mtpfs
    sudo mkdir /media/onex
    sudo chmod 775 /media/onex
    sudo mtpfs -o allow_other /media/onex
    gedit /etc/udev/rules.d/51-android.rules
    and add the following line:
    SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
    and then:
    sudo service udev restart

    ***Arch Linux***
    Code:
    pacman -S libmtp
    
    After installation, you have several mtp tools available. Upon connecting your MTP device, you use:
    
    mtp-detect
    
    and add the following line:
    SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
    and then reload udev rules:
    udevadm control --reload

    Arch Linux guide is from the ArchLinux wiki

    **Redhat\Fedora16**
    First of all, I using my computer with other people, who can come over the network, so the 0666 mode bits not a right choice for me. I make it all on a fedora 16, but the distro is really not important.

    So the steps:
    - add a user to the "disk" group (or whatever You want)
    - make a mount point (the media doesn't work for me, across the init removes the content)
    - add this mount point to the fstab, with some parameter
    - create udevd rules
    - restart udevd
    - install fuse-mtpfs
    - (re)login user
    - try it

    My common experience is that, the mtpfs is very very very very slow. Really slow, so I can use it only with CLI, any GUI has been coming back with time out

    And the "code":
    Code:
    usermod -a -G disk $LOGINUSER
    Code:
    sudo mkdir /mnt/sgs2 ; sudo chgrp disk /mnt/sgs2; sudo chmod 0770 /mnt/sgs2
    Code:
    sudo echo "mtpfs /mnt/sgs2 fuse users,noauto 0 0" >> /etc/fstab
    Code:
    cat > /etc/udev/rules.d/51-android.rules <<EOF
    SUBSYSTEM!="usb_device", GOTO="label_end"
    ACTION!="add", GOTO="label_end"
    
    # ATRRS{idVendor}== ertekei:
    #Acer	0502
    SUBSYSTEM=="usb",ATTRS{idVendor}=="0502",MODE="0660",GROUP="disk"
    #ASUS	0b05
    SUBSYSTEM=="usb",ATTRS{idVendor}=="0b05",MODE="0660",GROUP="disk"
    #Dell	413c
    SUBSYSTEM=="usb",ATTRS{idVendor}=="413c",MODE="0660",GROUP="disk"
    #Foxconn	0489
    SUBSYSTEM=="usb",ATTRS{idVendor}=="0489",MODE="0660",GROUP="disk"
    #Fujitsu	04c5
    SUBSYSTEM=="usb",ATTRS{idVendor}=="04c5",MODE="0660",GROUP="disk"
    #Fujitsu Toshiba	04c5
    SUBSYSTEM=="usb",ATTRS{idVendor}=="04c5",MODE="0660",GROUP="disk"
    #Garmin-Asus	091e
    SUBSYSTEM=="usb",ATTRS{idVendor}=="091e",MODE="0660",GROUP="disk"
    #Google	18d1
    SUBSYSTEM=="usb",ATTRS{idVendor}=="18d1",ATTRS{idProduct}=="4ee1",MODE="0660",GROUP="disk"
    #Hisense	109b
    SUBSYSTEM=="usb",ATTRS{idVendor}=="109b",MODE="0660",GROUP="disk"
    #HTC	0bb4
    SUBSYSTEM=="usb",ATTRS{idVendor}=="0bb4",MODE="0660",GROUP="disk"
    #Huawei	12d1
    SUBSYSTEM=="usb",ATTRS{idVendor}=="12d1",MODE="0660",GROUP="disk"
    #K-Touch	24e3
    SUBSYSTEM=="usb",ATTRS{idVendor}=="24e3",MODE="0660",GROUP="disk"
    #KT Tech	2116
    SUBSYSTEM=="usb",ATTRS{idVendor}=="2116",MODE="0660",GROUP="disk"
    #Kyocera	0482
    SUBSYSTEM=="usb",ATTRS{idVendor}=="0482",MODE="0660",GROUP="disk"
    #Lenovo	17ef
    SUBSYSTEM=="usb",ATTRS{idVendor}=="17ef",MODE="0660",GROUP="disk"
    #LG	1004
    SUBSYSTEM=="usb",ATTRS{idVendor}=="1004",MODE="0660",GROUP="disk"
    #Motorola	22b8
    SUBSYSTEM=="usb",ATTRS{idVendor}=="22b8",MODE="0660",GROUP="disk"
    #NEC	0409
    SUBSYSTEM=="usb",ATTRS{idVendor}=="0409",MODE="0660",GROUP="disk"
    #Nook	2080
    SUBSYSTEM=="usb",ATTRS{idVendor}=="2080",MODE="0660",GROUP="disk"
    #Nvidia	0955
    SUBSYSTEM=="usb",ATTRS{idVendor}=="0955",MODE="0660",GROUP="disk"
    #OTGV	2257
    SUBSYSTEM=="usb",ATTRS{idVendor}=="2257",MODE="0660",GROUP="disk"
    #Pantech	10a9
    SUBSYSTEM=="usb",ATTRS{idVendor}=="10a9",MODE="0660",GROUP="disk"
    #Pegatron	1d4d
    SUBSYSTEM=="usb",ATTRS{idVendor}=="1d4d",MODE="0660",GROUP="disk"
    #Philips	0471
    SUBSYSTEM=="usb",ATTRS{idVendor}=="0471",MODE="0660",GROUP="disk"
    #PMC-Sierra	04da
    SUBSYSTEM=="usb",ATTRS{idVendor}=="04da",MODE="0660",GROUP="disk"
    #Qualcomm	05c6
    SUBSYSTEM=="usb",ATTRS{idVendor}=="05c6",MODE="0660",GROUP="disk"
    #SK Telesys	1f53
    SUBSYSTEM=="usb",ATTRS{idVendor}=="1f53",MODE="0660",GROUP="disk"
    #Samsung	04e8
    SUBSYSTEM=="usb",ATTRS{idVendor}=="04e8",ATTRS{idProduct}=="6860",MODE="0660",GROUP="disk"
    #Sharp	04dd
    SUBSYSTEM=="usb",ATTRS{idVendor}=="04dd",MODE="0660",GROUP="disk"
    #Sony	054c
    SUBSYSTEM=="usb",ATTRS{idVendor}=="054c",MODE="0660",GROUP="disk"
    #Sony Ericsson	0fce
    SUBSYSTEM=="usb",ATTRS{idVendor}=="0fce",MODE="0660",GROUP="disk"
    #Teleepoch	2340
    SUBSYSTEM=="usb",ATTRS{idVendor}=="2340",MODE="0660",GROUP="disk"
    #Toshiba	0930
    SUBSYSTEM=="usb",ATTRS{idVendor}=="0930",MODE="0660",GROUP="disk"
    #ZTE	19d2
    SUBSYSTEM=="usb",ATTRS{idVendor}=="19d2",MODE="0660",GROUP="disk"
    
    LABEL="label_end"
    Code:
    udevadm control --reload-rules

    Code:
    yum/apt-get/pacman/etc install mtpfs

    Logout-login, for get in to the disk group, connect the device via usb, and try
    Code:
    mptfs
    without any parameter, and it must write out some information:
    Code:
    [email protected]:~$ mtpfs 
    Listing raw device(s)
    Device 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP).
       Found 1 device(s):
       Samsung: Galaxy models (MTP) (04e8:6860) @ bus 2, dev 4
    Attempting to connect device
    Android device detected, assigning default bug flags
    Listing File Information on Device with name: (NULL)
    fuse: missing mountpoint parameter
    
    And finally mount /it must be working now with user account/:
    [CODE]mount /mnt/sgs2
    or dismount:
    Code:
    umount /mnt/sgs2

    **OpenSuse 12.2**

    this method will work for music and photos access only,

    Code:
    sudo zypper addrepo -f http://packman.inode.at/suse/12.2/ packman
    sudo zypper ref (type a to always accept the packman repo)
    sudo zypper in mtpfs
    sudo vim /lib/udev/rules.d/69-libmtp.rules and add the following line (replace vim with gedit if you want a gui editor)
    # HTC One X+
    ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0dfc", SYMLINK+="libmtp-%k", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"
    
    sudo cp /lib/udev/rules.d/69-libmtp.rules /etc/udev/rules.d/.
    reboot
    
    When you plug in the phone you will see android phone icon on the desktop click on it to browse your files.

    *note
    disable any media players from trying to read the device...

    ** Gentoo **

    Code:
    Prerequisites
    
    If your device is not recognized by libmtp, try upgrading to latest (or even git) version.
    User needs to be in group plugdev to mount device.
    MTPFS
    
    You need to add option: user_allow_other in /etc/fuse.conf
    $ mkdir ~/AndroidDevice
    $ mtpfs -o allow_other ~/AndroidDevice
    NOTE: this can take really long time, up to several minutes. As an indication of successful mount the mtpfs will go to background.
    To unmount:
    $ /usr/bin/fusermount -u ~/AndroidDevice
    
    If mtpfs doesn't work for you try updating to latest version first.
    Go-MTPFS
    
    Seems to be more stable
    $ emerge -a go
    $ mkdir ~/go
    $ export GOPATH=/home/$USER/go
    $ go get github.com/hanwen/go-mtpfs
    
    To mount:
    $ ~/go/bin/go-mtpfs ~/AndroidDevice
    
    To unmount:
    $ /usr/bin/fusermount -u ~/AndroidDevice
    Troubleshooting
    
    Sometimes (e.g. on HTC One X) USB debugging automatically turns on when device is connected to PC. You need to turn debugging off, otherwise libmtp can't recognise device.
    Make sure your Android device is not going to sleep and the screen is not getting locked. Set screen timeout to very long values, or enable in Development section flag "Do not turn off the screen".

    Thanks to ihavoc and Fonya1 for the opensuse and redhat\fedora tutorials
    10
    One suggestion for anyone wanting to do this with a device other than an HTC:

    You'll need to change the line you add to /etc/udev/rules.d/51-android.rules based on the vendor of your phone.
    Code:
    SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"

    Change the code to one of the following USB vendor ids:

    Code:
    Acer	0502
    ASUS	0b05
    Dell	413c
    Foxconn	0489
    Fujitsu	04c5
    Fujitsu Toshiba	04c5
    Garmin-Asus	091e
    Google	18d1
    Hisense	109b
    HTC	0bb4
    Huawei	12d1
    K-Touch	24e3
    KT Tech	2116
    Kyocera	0482
    Lenovo	17ef
    LG	1004
    Motorola	22b8
    NEC	0409
    Nook	2080
    Nvidia	0955
    OTGV	2257
    Pantech	10a9
    Pegatron	1d4d
    Philips	0471
    PMC-Sierra	04da
    Qualcomm	05c6
    SK Telesys	1f53
    Samsung	04e8
    Sharp	04dd
    Sony	054c
    Sony Ericsson	0fce
    Teleepoch	2340
    Toshiba	0930
    ZTE	19d2

    Most up-to-date list is here: http://developer.android.com/tools/device.html

    You can also have multiple vendor lines in your /etc/udev/rules.d/51-android.rules file, just put one on each line. As someone who's testing on a bunch of different devices, I simply put a line in for all of the above :)

    If your vendor code isn't listed, enter the command "lsusb" in a terminal, and you'll see something like this:
    Code:
    Bus 001 Device 119: ID 04e8:6860 Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II]
    Bus 001 Device 112: ID 18d1:4e42 Google Inc.

    The first four hex values of the id is the vendor ID, e.g., for the Samsung it's 04e8.
    2
    Can anyone please confirm if this is exclusive to the HTC One X+, or would it work for other similar HTC devices such as One X, One S etc. as well?

    works for ALL MTP devices
    2
    gentoo

    I'm using gentoo.
    Tried mtpfs, it said that it can't recognize my device. Upgraded to GIT version of libmtp, that helped to get my device recognized but it couldn't connect. Don't know why, device always turned on USB debugging when I insert the cable, so I turned debugging off - that finally helped to get it connected. However it literally took 5 mins for mtp mount to complete, and it couldn't see part of my files. Then I realized that you actually need to keep device unlocked - i.e. when screen turns off and device locks, mtp will fail to read files from this point onwards. But even with unlocked device, I wasn't happy with the speed. Then I found the post about go-mtp (google it, I can't insert link :( )

    I followed the steps there - and finally it works like a charm! I guess it will work for any distro as it uses go directly, no packaging or anything.

    Hope that will help someone.

    UPD: I documented it on Gentoo wiki, article called MTP. wiki.gentoo(dot)org/wiki/MTP
    Sorry forum doesn't allow me to post normal link :(
    1
    Waiting for Ubuntu instructions (maybe)?
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone