Well, since I do not really get it, why the Android firmwares got the mass-storage usb functionality removed (OK, locking the device exclusively is not good, but hey, if I activate storage, I want just storage, right?) instead using Media Transfer Protocol (MTP), this kills usability on Linux not natively supporting this for now. Since I refuse to just boot another OS for using my Galaxy SIII or now even Nexus 7 in order to copy data to it, this needs to be done the hard way. You might figure that there are possible workarounds with ftp/ssh servers or AirDroid, but this would make USB useless, having a bit more speed advantage after all.
Using Debian Sid over here, should work on Wheezy as well. Note: The jmtpfs described here is broken, make fails on getgid() calls, probably some header includes are wrong, but I won’t debug that.
Note: Since libmtp will not identify the newer Nexus 7, we will need to install the latest libmtp ourselves (Debian sid still ships 1.1.3). Note: I will install to /usr/local/bin/ avoiding collision with existing package installs.
Second Note: You can install the latest tarball 1.1.5 release, as Nexus 7 support was added in the latest release. Newer devices like Nexus 4 are in git only so let’s just install latest HEAD. See e.g. this bug entry. Check src/music-players.h in your source tree (or git here) if your device is already supported.
$ apt-get install git-core build-essential $ git clone git://git.code.sf.net/p/libmtp/code libmtp-code $ cd libmtp-code $ sh autogen.sh $ ./configure --prefix=/usr/local $ make $ sudo make install
Important: Copy the udev rules first before proceeding! Otherwise your USB plugged device won’t be recognized as such.
$ sudo cp 69-libmtp.rules /etc/udev/rules.d/
Reboot. Otherwise udev won’t load the new ruleset for recognizing the device properly.
$ sudo apt-get install golang fuse git-core libmtp-dev libfuse-dev $ sudo adduser $USER fuse $ mkdir ~/tools/go-mtpfs $ GOPATH=/home/dnsmichi/tools/go-mtpfs go get github.com/hanwen/go-mtpfs $ sudo cp ~/tools/go-mtpfs/bin/go-mtpfs /usr/local/bin/ $ sudo chmod a+x /usr/local/bin/go-mtpfs $ sudo mkdir /media/Nexus7 $ sudo chmod 777 /media/Nexus7
Important: Fuse does not allow to access file systems to others other than the user having mounted it by default. Re-enable that one with
$ sudo chmod a+r /etc/fuse.conf $ sudo vim /etc/fuse.conf # Allow non-root users to specify the allow_other or allow_root mount options. user_allow_other
If required, reboot once more.
Now, mount the filesystem.
$ go-mtpfs /media/Nexus7 2013/01/27 14:37:10 compiled against libmtp 1.1.5 Device 0 (VID=18d1 and PID=4e41) is a Google Inc (for Asus) Nexus 7 (MTP). 2013/01/27 14:37:10 found device Google Inc (for Asus): Nexus 7 (MTP) (18d1:4e41) @ bus 5, dev 2 : Android device detected, assigning default bug flags 2013/01/27 14:37:10 storage ID 65537: Interner Speicher 2013/01/27 14:37:10 backing data /tmp/go-mtpfs338939414 2013/01/27 14:37:10 starting FUSE unknown $ ls /media/Nexus7/Interner Speicher/ Alarms/ Android/ DCIM/ Download/ Movies/ Music/ Notifications/ Pictures/ Podcasts/ Ringtones/
Look, how beautiful 🙂
If you’re done and want to safely unmount, just call
$ umount /media/Nexus7
Anyhow, this method requires a lot of compiling, hacking and may not be upgrade safe after all. Likely, you prefer the easy way.
Man, thanks a lot for the tutorial! I had some problems with some steps, but Google helped with that… 🙂
Awesome. Was a bit pissed at first with lack of mtp support on wheezy but this did the trick.
ty very much, I had some problem and I found solutions :
no “s” :
apt-get install git-core build-essentials
-> apt-get install git-core build-essential
autogen.sh: 19: autogen.sh: libtoolize: not found
-> aptitude install libtool
./configure: line 11925: AC_LIB_PREPARE_PREFIX: command not found
./configure: line 11926: AC_LIB_RPATH: command not found
./configure: line 11931: syntax error near unexpected token `iconv’
./configure: line 11931: ` AC_LIB_LINKFLAGS_BODY(iconv)’
-> aptitude install gettext
-> aptitude install libiconv-hook1 (not sure)
configure: error: *** libusb not found! (missing -dev/-devel package?) ***n*** prefer to install libusb-1 if you can! ***
-> aptitude install libusb-1.0-0-dev
libtool: link: gcc -g -O2 -Wall -Wmissing-prototypes -o .libs/mtp-connect connect.o delfile.o getfile.o newfolder.o sendfile.o sendtr.o pathutils.o util.o ../src/.libs/libmtp.so
../src/.libs/libmtp.so: undefined reference to `use_mtpz’
-> aptitude install libgcrypt20-dev
Thank you emmanuel
I also got “autogen.sh: 25: autogen.sh: aclocal: not found”. I fix it with installing “automake” package
I dont understand what am I doing wrong :'(
ricardo@debian:~$ go-mtpfs /media/Nexus7/
2016/08/03 10:50:45 detect failed: no MTP devices found
I also tried mtp-detect
Unable to open ~/.mtpz-data for reading, MTPZ disabled.
libmtp version: 1.1.11
Listing raw device(s)
No raw devices found.
I used to write the blog entry for Debian Wheezy some years ago. I would guess this changed with Debian Jessie and newer distributions. A while back I’ve also dropped my Android device so I cannot test that again, sorry.