Difference between revisions of "MTP"

From ArchWiki
Jump to: navigation, search
m (gvfs-mtp: Added link to ABS)
m (go-mtpfs: No fuse group exists in arch)
 
(131 intermediate revisions by 52 users not shown)
Line 1: Line 1:
[[Category:Sound]]
+
[[Category:Storage]]
MTP is the "Media Transfer Protocol" and is used by many mp3 players (e.g. Creative Zen) and mobile phones (e.g. Android 3+ devices). It is part of the "Windows Media" Framework and has close relationship with Windows Media Player.
+
[[Category:Mobile devices]]
 +
[[fa:MTP]]
 +
[[ja:MTP]]
 +
[[ru:MTP]]
 +
[[zh-CN:MTP]]
 +
{{Related articles start}}
 +
{{Related|USB storage devices}}
 +
{{Related articles end}}
 +
[[Wikipedia:Media_Transfer_Protocol|MTP]], or the ''Media Transfer Protocol'', is a USB device class which is used by many mobile phones (e.g. Samsung Galaxy S4) and media players (e.g. Creative Zen).
  
==Installation==
+
== Installation ==
MTP support is provided by [http://libmtp.sourceforge.net/ libmtp], [[pacman|installable]] with the {{Pkg|libmtp}} package from the [[official repositories]].
+
 
 +
=== Functionality ===
 +
 
 +
Linux MTP support is provided by [[installing]] the {{Pkg|libmtp}} package. It can be installed on its own and used to access devices. However, a number of packages are available that use it as a dependency and add additional convenience (e.g. filemanager) functionalities and compatibility with particular device types - which includes improving transfer access speeds.
 +
 
 +
These packages to choose from all implement a [[Wikipedia:Filesystem in Userspace]]:
 +
 
 +
* {{Pkg|mtpfs}}
 +
* {{AUR|jmtpfs}} - is reported to work well for newer Android 4+ devices
 +
* {{AUR|go-mtpfs-git}} - is reported to work well for newer Android 3+ devices
 +
* {{AUR|simple-mtpfs}}
 +
* {{Pkg|android-file-transfer}} - MTP client with minimalistic UI
 +
 
 +
All of them aim at better functionality and performance over {{ic|libmtp}}. Since there are a lot of different USB devices, you might want to research first which one looks most suitable for yours.
 +
 
 +
{{Tip|It is recommended to reboot your computer after installing MTP related packages.}}
 +
 
 +
=== Integration with file managers ===
 +
 
 +
To view the contents of your Android device's storage via MTP in your file manager, install the corresponding plugin:
 +
 
 +
* For file managers that use [[GVFS]] (GNOME Files), install {{Pkg|gvfs-mtp}} for MTP or {{Pkg|gvfs-gphoto2}} for PTP support.
 +
* For file managers that use KIO (KDE's Dolphin), MTP support is included in {{Pkg|kio-extras}} (dependency of dolphin).
 +
 
 +
After installing the required package, the device should show up in the file manager automatically and be accessible via an URL, for example {{ic|mtp://[usb:002,013]/}}.
 +
 
 +
== Usage ==
 +
 
 +
It might be required to create a mount-point directory first. The directory {{ic|~/mnt}} is used as an example below. Also do not forget to unlock your phone's screen before connecting it to the computer.
 +
 
 +
=== libmtp ===
 +
 
 +
Detect your device:
  
==Usage==
 
After installation, you have several MTP tools available.
 
Upon connecting your MTP device, you use:
 
 
  # mtp-detect
 
  # mtp-detect
to see if your MTP device is detected.
 
  
To connect to your MTP device, you use:
+
If an error is returned, see [[#libmtp 2|troubleshooting libmtp]].
# mtp-connect
+
  
If connection is successful, you will be given several switch options in conjunction with {{ic|mtp-connect}} to access data on the device.
+
{{Note|Your regular user must be in the {{ic|uucp}} [[users_and_groups#Example_adding_a_user|group]].}}
  
There are also several stand alone commands you can use to access your MTP device such as,
+
Connect to your device:
{{Warning | Some commands may be harmful to your MTP device!!! }}
+
# mtp-connect
  
 +
If connection is successful, there are several switch options to use in conjunction with ''mtp-connect'' to access data on the device. You might want to use some stand alone commands:
 
   mtp-albumart        mtp-emptyfolders    mtp-getplaylist    mtp-reset          mtp-trexist
 
   mtp-albumart        mtp-emptyfolders    mtp-getplaylist    mtp-reset          mtp-trexist
 
   mtp-albums          mtp-files          mtp-hotplug        mtp-sendfile
 
   mtp-albums          mtp-files          mtp-hotplug        mtp-sendfile
Line 25: Line 61:
 
   mtp-detect          mtp-getfile        mtp-playlists      mtp-tracks
 
   mtp-detect          mtp-getfile        mtp-playlists      mtp-tracks
  
==Using media players==
+
=== mtpfs ===
You can also use your MTP device in music players such as Amarok. To do this you may have to edit {{ic|/etc/udev/rules.d/51-android.rules}} (the MTP device used in the following example is a Galaxy Nexus):
+
 
To do this run:
+
{{Note | The following is likely to not work and you might have to resort to [[Digital_Cameras#libgphoto2|gphoto2]] or a file manager with gvfs support like [[PCManFM]]. }}
 +
 
 +
First edit your {{ic|/etc/fuse.conf}} and uncomment the following line:
 +
user_allow_other
 +
 
 +
Mount your device on {{ic|~/mnt}}:
 +
$ mtpfs -o allow_other ~/mnt
 +
 
 +
Unmount device mounted on {{ic|~/mnt}}:
 +
 
 +
$ fusermount -u ~/mnt
 +
 
 +
=== jmtpfs ===
 +
 
 +
Mount device on {{ic|~/mnt}}:
 +
 
 +
$ jmtpfs ~/mnt
 +
 
 +
Unmount device mounted on {{ic|~/mnt}}:
 +
 
 +
$ fusermount -u ~/mnt
 +
 
 +
Make this cohere to the rest of Linux (use regular mount/umount commands) by doing two steps
 +
 
 +
$# ln -s <actual mount command's path/name>  <a name consistent with Linux's mount convention>
 +
$  ln -s /sbin/jmtpfs                        /sbin/mount.jmtpfs
 +
 
 +
add this line to /etc/fstab;
 +
 
 +
  #jmtpfs <mount path>        fuse nodev,allow_other,<other options>                            0    0
 +
  jmtpfs /home/sam/run/motog fuse nodev,allow_other,rw,user,noauto,noatime,uid=1000,gid=1000    0    0
 +
 
 +
Now mount the device and see if the options "took"
 +
 
 +
  $ mount /home/sam/run/motog
 +
  Device 0 (VID=22b8 and PID=2e82) is a Motorola Moto G (ID2).
 +
  Android device detected, assigning default bug flags
 +
  $ mount
 +
  ...
 +
  jmtpfs on /home/sam/run/motog type fuse.jmtpfs (rw,nosuid,nodev,noexec,noatime,user_id=1000,group_id=1000,allow_other,user=sam)
 +
 
 +
=== go-mtpfs ===
 +
 
 +
{{Note|Mounting with {{ic|go-mtpfs}} might fail if an external SD Card is present. If you try to access your device while having an SD card and go-mtpfs complains, try removing the SD card and mounting again.}}
 +
 
 +
Install {{Pkg|android-udev}}, which will allow you to edit {{ic|/etc/udev/rules.d/51-android.rules}} and apply to your {{ic|idVendor}} and {{ic|idProduct}}, which you can see after running ''mtp-detect''. To the end of the line, add your user {{ic|<nowiki>OWNER="<user>"</nowiki>}}.
 +
 
 +
Mount device on {{ic|~/mnt}}:
 +
 
 +
$ go-mtpfs ~/mnt
 +
 
 +
Unmount device mounted on {{ic|~/mnt}}:
 +
 
 +
$ fusermount -u ~/mnt
 +
 
 +
=== simple-mtpfs ===
 +
 
 +
List MTP devices:
 +
 
 +
$ simple-mtpfs --list-devices
 +
 
 +
Mount your device on {{ic|~/mnt}}:
 +
 
 +
$ simple-mtpfs ~/mnt
 +
 
 +
Unmount device mounted on {{ic|~/mnt}}:
 +
 
 +
$ fusermount -u ~/mnt
 +
 
 +
=== Android File Transfer ===
 +
 
 +
;FUSE interface
 +
 
 +
Mount your device on {{ic|~/my-device}}:
 +
$ mkdir ~/my-device
 +
$ aft-mtp-mount ~/my-device
 +
 
 +
If you want album art to be displayed, it must be named {{ic|albumart.xxx}} and placed first in the destination folder. Then copy other files. Also, note that fuse could be 7-8 times slower than ui/cli file transfer.
 +
 
 +
Unmount device mounted on {{ic|~/my-device}}:
 +
 
 +
$ fusermount -u ~/my-device
 +
 
 +
;Qt user interface
 +
 
 +
Start the application, choose a destination folder and click any button on the toolbar. Available options are: ''Upload Album'', ''Upload Directory'' and ''Upload Files''. The latter two are self-explanatory. ''Upload album'' searches the source directory for album covers, and sets the best available cover.
 +
 
 +
=== Media players ===
 +
 
 +
You can also use your MTP device in music players such as Amarok. To achieve this, you might have to edit {{ic|/etc/udev/rules.d/51-android.rules}} (the MTP device used in the following example is a Galaxy Nexus).
 +
Run:
 +
 
 
  $ lsusb
 
  $ lsusb
and look for your device, it will be something like:
+
 
 +
Search for your device. It should be something like that:
 
  Bus 003 Device 011: ID 04e8:6860 Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II], GT-P7500 [Galaxy Tab 10.1]
 
  Bus 003 Device 011: ID 04e8:6860 Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II], GT-P7500 [Galaxy Tab 10.1]
in which case the entry would be:
+
 
 +
And entry to {{ic|/etc/udev/rules.d/51-android.rules}} will be this:
 
  SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0666", OWNER="[username]"
 
  SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0666", OWNER="[username]"
Then, reload udev rules:
+
 
 +
Also reload udev rules:
 
  # udevadm control --reload
 
  # udevadm control --reload
  
{{Note|After installing MTP you may have to reboot for your device to be recognised}}
+
== Troubleshooting ==
  
==mtpfs==
+
=== libmtp ===
Mtpfs is FUSE filesystem that supports reading and writing from any MTP device. Basically it allows you to mount your device as an external drive.
+
  
Mtpfs can be installed with the packge {{Pkg|mtpfs}}, available from the [[official repositories]].
+
==== Unknown device ====
*First edit your {{ic|/etc/fuse.conf}} and uncomment the following line:
+
user_allow_other
+
  
*To mount your device
+
If you see a message like:
$ mtpfs -o allow_other /media/YOURMOUNTPOINT
+
*To unmount your device
+
$ fusermount -u /media/YOURMOUNTPOINT
+
*To unmount your device as root
+
# umount /media/YOURMOUNTPOINT
+
  
Also, you can put them into your ~/.bashrc:
+
  Device 0 (VID=XXXX and PID=XXXX) is UNKNOWN.
  alias android-connect="mtpfs -o allow_other /media/YOURMOUNTPOINT"
+
  Please report this VID/PID and the device model to the libmtp development team
alias android-disconnect="fusermount -u /media/YOURMOUNTPOINT"
+
Or, with sudo
+
  alias android-disconnect="sudo umount -u /media/YOURMOUNTPOINT"
+
{{Note|if you want not be asked for password when using sudo, please refer to [[USB Storage Devices#Mounting USB devices]]}}
+
  
==jmtpfs==
+
You should check whether your device is listed in the [http://sourceforge.net/p/libmtp/code/ci/HEAD/tree/src/music-players.h supported devices list]. If it is not, you should report it to the developers team. If it is, your {{ic|libmtp}} might be slightly outdated. To allow it to be properly used by {{ic|libmtp}}, you can add your device to:
[http://research.jacquette.com/jmtpfs-exchanging-files-between-android-devices-and-linux/ jmtpfs] is a FUSE and libmtp based filesystem for accessing MTP (Media Transfer Protocol) devices. It was specifically designed for exchanging files between Linux systems and newer Android devices that support MTP but not USB Mass Storage.
+
jmtpfs is available as {{aur|jmtpfs}} in the [[AUR]].
+
  
Use these commands to mount and unmount your device :
+
  /etc/udev/rules.d/69-libmtp.rules
  $ jmtpfs ~/mtp
+
  
$ fusermount -u ~/mtp
+
==== Unable to enumerate USB device ====
 +
{{Deletion|This should be an old kernel bug, and should have been fixed already. There is no bug report to confirm though.}}
 +
{{Merge||Unrelated to MTP, perhaps suited for [[USB storage devices]]}}
  
==go-mtpfs==
+
If you see a message like this in system log ({{ic|journalctl}})
{{Note|Go-mtpfs gives a better performance while writing files to some devices than mtpfs/jmtpfs. Try it if you have slow speeds.}}
+
If the above instructions don't show any positive results one should try {{aur|go-mtpfs-git}} from the [[AUR]].
+
The following has been tested on a Samsung Galaxy Nexus GSM, Asus/Google Nexus 7 (2012 1st gen model) and Samsung Galaxy S 3 mini.
+
  
If you want do it simpler, install {{Pkg|go}}, {{Pkg|libmtp}} and {{Pkg|git}} from the [[official repositories]]. After that install {{AUR|go-mtpfs-git}} from the [[AUR]].
+
  usb usb4-port2: unable to enumerate USB device
  
 +
You can try following temporary [https://bbs.archlinux.org/viewtopic.php?pid=1087323#p1087323 workaround]
  
As in the section above install {{aur|android-udev}} which will provide you with "/usr/lib/udev/rules.d/51-android.rules" edit it to apply to
+
  # modprobe -vr uhci_hcd
your vendorID and productID, which you can see after running mtp-detect. To the end of the line add with a comma OWNER="yourusername". Save the file.
+
  # modprobe -va ohci_hcd
 +
  # modprobe -va uhci_hcd
  
*Add yourself to the "fuse" group:
+
If it works you should create {{ic|/etc/modprobe.d/usb_hci_order.conf}} with following content
gpasswd -a [user] fuse
+
  
*If the group "fuse" doesn't exist create it with:
+
  # create a dependency on ohci for uhci, which fixes problems
groupadd fuse
+
  # with external usb devices not showing up
 +
  #
 +
  softdep uhci_hcd pre: ohci_hcd
  
Logout or reboot to apply these changes.
+
=== jmtpfs ===
  
*To create a mount point called "Android" issue the following commands:
+
==== Input/output error upon first access ====
mkdir Android
+
  
*To mount your phone use:
+
Symptoms: jmtpfs successfully mounts, but as soon as one attempts to access files on the device (e.g. via {{ic|ls}}), an error is reported:
go-mtpfs Android
+
  
*To unmount your phone:
+
  cannot access <mount-point>: Input/output error
fusermount -u Android
+
  
You can create a .bashrc alias as in the example above for easier use.
+
This appears to be a security feature: MTP does not work when the phone is locked by the lockscreen. Unlock the phone and it should work again as long as the cord remains connected.
  
==gvfs-mtp==
+
=== gvfs-mtp ===
  
Philip Langdale is has implemented native MTP support for gvfs. The weaknesses of gphoto2 and mtpfs are listed in his [http://intr.overt.org/blog/?p=153 blog post].
+
{{Merge|udev}}
*The native mtp implementation for gvfs [https://bugzilla.gnome.org/show_bug.cgi?id=666195 has been merged upstream] and has been released in gvfs [http://git.gnome.org/browse/gvfs/commit/?id=d6c8e3a4910ee2c5968886328ebe9456b445796b 1.15.2].
+
* You can grab the stable {{Pkg|gvfs-mtp}} package from extra. You may want to reboot your PC to make it actually working.
+
  
*Devices will have gvfs paths like this
+
If you have installed the {{Pkg|gvfs-mtp}} package, and your device does not show up in the file manager, you might need to reboot or write a udev rule in order to auto-mount the device.
gvfs-ls mtp://[usb:002,013]/
+
  
==simple-mtpfs==
+
Plug your device and get the vendor-id and product-id,respectively:
  
This is another FUSE filesystem for MTP devices. You may find this to be more reliable than {{Pkg|mtpfs}}. {{aur|simple-mtpfs}} is available in the AUR or can be built from source. Remember '''do not''' run the following commands as root.
+
$ lsusb
 +
Bus 001 Device 007: ID 0421:0661 Nokia Mobile Phones Lumia 920
 +
(...)
  
* To list MTP devices run
+
The two numbers after ID are ''vendorId'' : ''productID''
  simple-mtpfs --list-devices
+
  
* To mount a MTP devices (in this example device 0) run
+
Then make a udev rule, e.g.
simple-mtpfs /path/to/your/mount/point
+
  
* To un mount run
+
# nano /etc/udev/rules.d/51-android.rules
  fusermount -u /path/to/your/mount/point
+
  
==KDE MTP KIO Slave==
+
and type this rule:
There is a MTP KIO Slave built upon libmtp availiable as package {{Pkg|kio-mtp}}.
+
  
Using KIO makes file access in KDE seamless, in principle any KDE application would be able read/write files on the device.
+
ATTR{idVendor}=="YOUR VENDOR ID HERE", ATTR{idProduct}=="YOUR PRODUCT ID HERE", SYMLINK+="libmtp",  MODE="660", ENV{ID_MTP_DEVICE}="1"
  
===Usage===
+
Reload the udev rules.
The device will be available under the path mtp:/
+
  
===Workaround if the KDE device actions doesn't work===
+
# udevadm control --reload
If you are not able to use the action "Open with File Manager", you may work around this problem by editing the file /usr/share/apps/solid/actions/solid_mtp.desktop
+
  
Change the line
+
And reboot the system. Now file managers (like Thunar) should be able to automount the MTP Device. [https://bbs.archlinux.org/viewtopic.php?id=180719]
Exec=kioclient exec mtp:udi=%i/
+
To
+
Exec=dolphin "mtp:/"
+
  
==GNOME gMTP==
+
=== kio-mtp ===
gMTP is a native Gnome application used for MTP access.
+
  
{{aur|gmtp}} is currently located in the [[AUR]] .
+
If you are not able to use the action "Open with File Manager", you may work around this problem by editing the file {{ic|/usr/share/apps/solid/actions/solid_mtp.desktop}}.
  
==Workarounds for Android==
+
Change the line
* HTC Phones automatically enter usb debugging mode on usb connect. Manually turn it off once connected to give libmtp access to the device.
+
  
MTP is still buggy and may crash despite the best efforts of developers. The following are alternatives:
+
Exec=kioclient exec mtp:udi=%i/
* AirDroid - an Android app to access files via your web browser.
+
* FTP client on Android - If you run a local FTP server on Arch (such as [[Vsftp]]), there are many FTP clients available on the Play Store which will give read/ write access to your device's files.
+
* FTP Server on Android. Note: since FTP client using passive transfer (server connect to client) do not forget to disable firewall or adding rules for allowing FTP server connect to your PC.
+
** Ftp Server (by The Olive Tree) app in Play Store acts as FTP server on Android and allows RW access to pretty much all your storage.
+
*** Pro: Doesn't require root and just works!
+
*** Cons: Doesn't work with tethering network.
+
** FTPServer (by Andreas Liebig) - Just work.
+
* SSH server on Android.
+
** For example, SSHelper, available on the Play Store, just works without requiring root access. Assuming SSHelper is listening on port 20 and the phone's IP address is 192.168.0.20, the following command will synchronise a local directory with the external SD card of the Android device:
+
  rsync --rsh="ssh -p 20" --modify-window=1  ~/local_files  192.168.0.20:/mnt/extSdCard/remote_files
+
Note the {{ic|--modify-window}} option, which is often used when rsyncing to a FAT filesystem (such as the one used by Android devices for their internal memory and external SD cards).
+
* Samba - an Android app to share your SD card as a windows fileshare. Pros: Your desktop apps work as before (since the SD card appears as a windows fileshare). Cons: you need to root your phone.
+
* adb - Part of the Android development kit is adb android debug bridge. It can be used to push and pull files from an Android device.
+
** The device need USB debbuging to be active and later connected to the computer with usb.
+
** To send a file to the device use {{ic|adb push /what-to-copy /where-to-place-it}}
+
** To receive a file {{ic|adb pull /what-you-want-to-copy /where-you-want-it}}
+
*** Pro: Stable, can be used for a lot more then just copy files back and forth.
+
*** Cons: Can be somewhat slow.
+
  
==Security features on android==
+
To
If you use android 4.x please unlock phone (screen unlock) and then connect phone to USB.
+
  
If you not unlock you have in KDE "No Storages found. Maybe you need to unlock your device?" or error 02fe in console.
+
Exec=dolphin "mtp:/"

Latest revision as of 00:00, 8 July 2016

Related articles

MTP, or the Media Transfer Protocol, is a USB device class which is used by many mobile phones (e.g. Samsung Galaxy S4) and media players (e.g. Creative Zen).

Installation

Functionality

Linux MTP support is provided by installing the libmtp package. It can be installed on its own and used to access devices. However, a number of packages are available that use it as a dependency and add additional convenience (e.g. filemanager) functionalities and compatibility with particular device types - which includes improving transfer access speeds.

These packages to choose from all implement a Wikipedia:Filesystem in Userspace:

All of them aim at better functionality and performance over libmtp. Since there are a lot of different USB devices, you might want to research first which one looks most suitable for yours.

Tip: It is recommended to reboot your computer after installing MTP related packages.

Integration with file managers

To view the contents of your Android device's storage via MTP in your file manager, install the corresponding plugin:

  • For file managers that use GVFS (GNOME Files), install gvfs-mtp for MTP or gvfs-gphoto2 for PTP support.
  • For file managers that use KIO (KDE's Dolphin), MTP support is included in kio-extras (dependency of dolphin).

After installing the required package, the device should show up in the file manager automatically and be accessible via an URL, for example mtp://[usb:002,013]/.

Usage

It might be required to create a mount-point directory first. The directory ~/mnt is used as an example below. Also do not forget to unlock your phone's screen before connecting it to the computer.

libmtp

Detect your device:

# mtp-detect

If an error is returned, see troubleshooting libmtp.

Note: Your regular user must be in the uucp group.

Connect to your device:

# mtp-connect

If connection is successful, there are several switch options to use in conjunction with mtp-connect to access data on the device. You might want to use some stand alone commands:

 mtp-albumart        mtp-emptyfolders    mtp-getplaylist     mtp-reset           mtp-trexist
 mtp-albums          mtp-files           mtp-hotplug         mtp-sendfile
 mtp-connect         mtp-folders         mtp-newfolder       mtp-sendtr
 mtp-delfile         mtp-format          mtp-newplaylist     mtp-thumb
 mtp-detect          mtp-getfile         mtp-playlists       mtp-tracks

mtpfs

Note: The following is likely to not work and you might have to resort to gphoto2 or a file manager with gvfs support like PCManFM.

First edit your /etc/fuse.conf and uncomment the following line:

user_allow_other

Mount your device on ~/mnt:

$ mtpfs -o allow_other ~/mnt

Unmount device mounted on ~/mnt:

$ fusermount -u ~/mnt

jmtpfs

Mount device on ~/mnt:

$ jmtpfs ~/mnt

Unmount device mounted on ~/mnt:

$ fusermount -u ~/mnt

Make this cohere to the rest of Linux (use regular mount/umount commands) by doing two steps

$# ln -s <actual mount command's path/name>  <a name consistent with Linux's mount convention>
$  ln -s /sbin/jmtpfs                        /sbin/mount.jmtpfs

add this line to /etc/fstab;

 #jmtpfs <mount path>        fuse nodev,allow_other,<other options>                             0    0
  jmtpfs /home/sam/run/motog fuse nodev,allow_other,rw,user,noauto,noatime,uid=1000,gid=1000    0    0

Now mount the device and see if the options "took"

 $ mount /home/sam/run/motog
 Device 0 (VID=22b8 and PID=2e82) is a Motorola Moto G (ID2).
 Android device detected, assigning default bug flags
 $ mount 
  ...
  jmtpfs on /home/sam/run/motog type fuse.jmtpfs (rw,nosuid,nodev,noexec,noatime,user_id=1000,group_id=1000,allow_other,user=sam)

go-mtpfs

Note: Mounting with go-mtpfs might fail if an external SD Card is present. If you try to access your device while having an SD card and go-mtpfs complains, try removing the SD card and mounting again.

Install android-udev, which will allow you to edit /etc/udev/rules.d/51-android.rules and apply to your idVendor and idProduct, which you can see after running mtp-detect. To the end of the line, add your user OWNER="<user>".

Mount device on ~/mnt:

$ go-mtpfs ~/mnt

Unmount device mounted on ~/mnt:

$ fusermount -u ~/mnt

simple-mtpfs

List MTP devices:

$ simple-mtpfs --list-devices

Mount your device on ~/mnt:

$ simple-mtpfs ~/mnt

Unmount device mounted on ~/mnt:

$ fusermount -u ~/mnt

Android File Transfer

FUSE interface

Mount your device on ~/my-device:

$ mkdir ~/my-device
$ aft-mtp-mount ~/my-device

If you want album art to be displayed, it must be named albumart.xxx and placed first in the destination folder. Then copy other files. Also, note that fuse could be 7-8 times slower than ui/cli file transfer.

Unmount device mounted on ~/my-device:

$ fusermount -u ~/my-device
Qt user interface

Start the application, choose a destination folder and click any button on the toolbar. Available options are: Upload Album, Upload Directory and Upload Files. The latter two are self-explanatory. Upload album searches the source directory for album covers, and sets the best available cover.

Media players

You can also use your MTP device in music players such as Amarok. To achieve this, you might have to edit /etc/udev/rules.d/51-android.rules (the MTP device used in the following example is a Galaxy Nexus). Run:

$ lsusb

Search for your device. It should be something like that:

Bus 003 Device 011: ID 04e8:6860 Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II], GT-P7500 [Galaxy Tab 10.1]

And entry to /etc/udev/rules.d/51-android.rules will be this:

SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0666", OWNER="[username]"

Also reload udev rules:

# udevadm control --reload

Troubleshooting

libmtp

Unknown device

If you see a message like:

Device 0 (VID=XXXX and PID=XXXX) is UNKNOWN.
Please report this VID/PID and the device model to the libmtp development team

You should check whether your device is listed in the supported devices list. If it is not, you should report it to the developers team. If it is, your libmtp might be slightly outdated. To allow it to be properly used by libmtp, you can add your device to:

/etc/udev/rules.d/69-libmtp.rules

Unable to enumerate USB device

Tango-edit-cut.pngThis section is being considered for removal.Tango-edit-cut.png

Reason: This should be an old kernel bug, and should have been fixed already. There is no bug report to confirm though. (Discuss in Talk:MTP#)

Merge-arrows-2.pngThis article or section is a candidate for merging with [[]].Merge-arrows-2.png

Notes: Unrelated to MTP, perhaps suited for USB storage devices (Discuss in Talk:MTP#)

If you see a message like this in system log (journalctl)

 usb usb4-port2: unable to enumerate USB device

You can try following temporary workaround

 # modprobe -vr uhci_hcd
 # modprobe -va ohci_hcd
 # modprobe -va uhci_hcd

If it works you should create /etc/modprobe.d/usb_hci_order.conf with following content

 # create a dependency on ohci for uhci, which fixes problems
 # with external usb devices not showing up
 #
 softdep uhci_hcd pre: ohci_hcd

jmtpfs

Input/output error upon first access

Symptoms: jmtpfs successfully mounts, but as soon as one attempts to access files on the device (e.g. via ls), an error is reported:

 cannot access <mount-point>: Input/output error

This appears to be a security feature: MTP does not work when the phone is locked by the lockscreen. Unlock the phone and it should work again as long as the cord remains connected.

gvfs-mtp

Merge-arrows-2.pngThis article or section is a candidate for merging with udev.Merge-arrows-2.png

Notes: please use the second argument of the template to provide more detailed indications. (Discuss in Talk:MTP#)

If you have installed the gvfs-mtp package, and your device does not show up in the file manager, you might need to reboot or write a udev rule in order to auto-mount the device.

Plug your device and get the vendor-id and product-id,respectively:

$ lsusb
Bus 001 Device 007: ID 0421:0661 Nokia Mobile Phones Lumia 920
(...)

The two numbers after ID are vendorId : productID

Then make a udev rule, e.g.

# nano /etc/udev/rules.d/51-android.rules

and type this rule:

ATTR{idVendor}=="YOUR VENDOR ID HERE", ATTR{idProduct}=="YOUR PRODUCT ID HERE", SYMLINK+="libmtp",  MODE="660", ENV{ID_MTP_DEVICE}="1"

Reload the udev rules.

# udevadm control --reload

And reboot the system. Now file managers (like Thunar) should be able to automount the MTP Device. [1]

kio-mtp

If you are not able to use the action "Open with File Manager", you may work around this problem by editing the file /usr/share/apps/solid/actions/solid_mtp.desktop.

Change the line

Exec=kioclient exec mtp:udi=%i/

To

Exec=dolphin "mtp:/"