From Gentoo Wiki
Jump to: navigation, search
External resources

MTP (Media Transfer Protocol) is a protocol to allow the transfer of files to external devices.



Install sys-fs/mtpfs:

→ Information about USE flags
USE flag Default Recommended Description
debug No Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see
mad No Enable handling of MP3's metadata
root # emerge --ask mtpfs


Your user needs to be in the "plugdev" group:

root # gpasswd -a YOUR_USER plugdev

Modify your /etc/fuse.conf:




user $ mkdir ~/AndroidDevice
user $
mtpfs -o allow_other ~/AndroidDevice
Be patient, as this can take several minutes. Upon successful mount, mtpfs will background itself.
  • Unmount:
user $ fusermount -u ~/AndroidDevice


Newer Galaxy Devices (S3, S4, Note2, etc.) use their own MTP-stack and don't work reliably, although this should be fixed in newer versions. See Bug#29


Install sys-fs/go-mtpfs:

We need to unmask 2 packages in /etc/portage/package.keywords:


dev-libs/go-fuse **
sys-fs/go-mtpfs **
root # emerge --ask go-mtpfs


Your user needs to be in the "plugdev" group:

root # gpasswd -a YOUR_USER plugdev


user $ mkdir ~/AndroidDevice
user $
go-mtpfs ~/AndroidDevice &

Note: If you don't run go-mtpfs in the background (with & at the end), you will need another console to browse the device and to unmount it.

  • unmount:
user $ fusermount -u ~/AndroidDevice

When you unmount the device, go-mtpfs will quit.


gphotofs is a FUSE file system for interfacing with digital cameras using gphoto2. Most modern mobile phones are cameras at the same time, and gphotofs can be a good alternative to tmpfs or go-mtpfs.


Install media-gfx/gphotofs:


user $ mkdir ~/AndroidDevice
user $
gphotofs ~/AndroidDevice -o alllow_other
  • unmount:
user $ fusermount -u ~/AndroidDevice


Another FUSE file system implementation for use with MTP devices is simple-mtpfs.


Install sys-fs/simple-mtpfs:


user $ mkdir ~/AndroidDevice
user $
simple-mtpfs ~/AndroidDevice
  • unmount:
user $ fusermount -u ~/AndroidDevice


kio-mtp is a slave for KDE's KIO framework.

As kio-mtp is still unstable, but is now part of main repository. Then:

root # echo kde-misc/kio-mtp >> /etc/portage/package.accept_keywords
root # emerge --ask kio-mtp

Finally quit KDE, and relaunch it. Now your MTP devices appear e.g. in Dolphin.


gMTP is a simple MTP client for Solaris and Linux.

It is just to install and run media-sound/gmtp:

root # emerge --ask gmtp
user $ gmtp

Click on connect. A few second later, you will get the file hierarchy of your device. You can start to manipulate the files. It support features like Album Artwork and play lists.


I am a newbie with an Android phone, and it look like the ones that know are very tired to answer the same questions again and again. That imply it took me hours and even days to find what is possible and not possible to do with a non rooted device. In short, with a non rooted device, the only things you can backup locally is what the couple device/android will let you do. That is pretty much the same files you can copy with the already mentioned software. With the Android 4.x devices, a nice solution to make such a partial backup is the so-called "adb backup".

On gentoo, You can install adb with portage. adb mean Android Debug Bridge, and it is a part of the Android Software Development Kit (SDK).

root # emerge --ask android-sdk-update-manager
root # android

When it is done, you may have to logout and login in order to backup the files with

user $ adb backup [-f <file>] [-apk|-noapk] [-shared|-noshared] [-all] [-system|nosystem] [<packages...>]


  • -f : the path of the *.ab file that will be saved on your computer. This file is a compressed file that contains an archive of the data/apks from your device.
  • -apk|-noapk : indicates if the *.apk files should be backed up (default is -noapk)
  • -shared|-noshared: enable/disable backup of the device's shared storage / SD card contents (default is -noshared)
  • -all : indicates that you want the entire system backed up. you can use the packages filter to just backup specific packages, or use -all for a full system backup.
  • -system|-nosystem: indicates if all the system applications and data are included when backing up. (default is -system)
  • <packages> : this is where you can list specific packages to backup. Use these if you want to back up only specific applications. If using -all, you do not need to specify packages.

To backup the phone into ~/HTC_backup :

user $ cd ~
user $ mkdir HTC_backup
user $ adb devices

will start the daemon and show you the devices on the USB.

user $ adb backup -apk -shared -all -system -f ~/HTC_backup/backup<date_of_the_day>.ab

will backup every thing the device will let you to backup.

user $ adb restore ~/HTC_backup/backup<date_of_the_day>.ab

will restore the backup into the device.

To stop the daemon:

user $ adb kill-server


  • If your device is not recognized by libmtp, try upgrading to latest (or even live) version.
  • 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 recognize 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".