Accessing your phone files using MTP on Debian Jessie/Sid

by

in

Accessing your files from your android smartphone using debian should be easy : you just need the mtpfs (currently only in sid) and libmtp9 packages.

But for me it was not just that easy. After installing this package and trying to “mount” my smartphone I would get the following error :

user@machine:~$ mtpfs temp/
Unable to open ~/.mtpz-data for reading, MTPZ disabled.Listing raw device(s)
Device 0 (VID=04e8 and PID=685c) is a Samsung Galaxy models (MTP+ADB).
Found 1 device(s):
Samsung: Galaxy models (MTP+ADB) (04e8:685c) @ bus 3, dev 18
Attempting to connect device
PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
LIBMTP libusb: Attempt to reset device
LIBMTP PANIC: failed to open session on second attempt
Unable to open raw device 0

What I had to do to make it work is :

root@machine:~# cp /lib/udev/rules.d/69-libmtp.rules /etc/udev/rules.d/

root@machine:~# /etc/init.d/udev restart

Unplug/Replug the phone (and unlock it !) and everything should be fine now :

user@machine:~$ mtpfs temp/
Unable to open ~/.mtpz-data for reading, MTPZ disabled.Listing raw device(s)
Device 0 (VID=04e8 and PID=685c) is a Samsung Galaxy models (MTP+ADB).
Found 1 device(s):
Samsung: Galaxy models (MTP+ADB) (04e8:685c) @ bus 3, dev 19
Attempting to connect device
Android device detected, assigning default bug flags
Error 7: Found a bad handle, trying to ignore it.
Listing File Information on Device with name: (NULL)

It’s a bit slow but at least it works 🙂