Mount MTP device on Debian 7 wheezy

Today I needed to transfer som pictures from my phone (a Google Nexus 4) to my computer running Crunchbang (based on Debian 7 wheezy). The required packages for this to work has not yet been added to Debian stable to work around this I manually built the required tools from source.

Install required packages

sudo apt-get install libmtp-dev fuse libmtp9 pkg-config libfuse-dev libglib2.0-dev libmad0-dev libid3tag0-dev dh-make autotools-dev

Download source package of mtpfs

*Update*
Thanks to sdio for pointing out how to use the Debian package tools to create a deb file to install and uninstall instead of doing the traditional ./configure; make; make install.

Untar the archive and then use dh_make to convert the source package in a format used by debian packages:

tar zxf mtpfs-1.1.tar.gz
cd mtpfs-1.1
dh_make -s -f ../mtpfs-1.1.tar.gz

Now build the Deb-file using this command:

fakeroot debian/rules binary

The deb-file will be placed in the same directory as the tar-file, to go upp a directory and install the deb-file:

cd ..
sudo dpkg -i mtpfs_1.1-1_amd64.deb

If you want to uninstall mtpfs then run this command:

sudo dpkg --purge mtpfs

Make sure you are a member of the fuse group so that you are allowed mount filesystems in userspace (You will need to relogin or reboot for the group permissions to take effect):

sudo usermod -aG fuse $USER

Create a directory for mounting the device and mount the the device (Plugin the device first)

mkdir myPhone
mtpfs myPhone

When your done you unmount the phone with this command

fusermount -u myPhone

47 comments

  1. Mick Sulley

    I followed the instructions, created a mount point Nexus but I can’t get it to work, it ended with Permission denied so I tried sudo but still not working. Here is what I see –
    mick@mick-deb-laptop:~$ mtpfs Nexus
    Listing raw device(s)
    Device 0 (VID=18d1 and PID=4ee1) is a Google Inc (for LG Electronics) Nexus 4.
    Found 1 device(s):
    Google Inc (for LG Electronics): Nexus 4 (18d1:4ee1) @ bus 1, dev 7
    Attempting to connect device
    PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
    LIBMTP libusb: Attempt to reset device
    Android device detected, assigning default bug flags
    Listing File Information on Device with name: (NULL)
    fuse: failed to open /dev/fuse: Permission denied
    mick@mick-deb-laptop:~$ sudo mtpfs Nexus
    Listing raw device(s)
    Device 0 (VID=18d1 and PID=4ee1) is a Google Inc (for LG Electronics) Nexus 4.
    Found 1 device(s):
    Google Inc (for LG Electronics): Nexus 4 (18d1:4ee1) @ bus 1, dev 7
    Attempting to connect device
    PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
    LIBMTP libusb: Attempt to reset device
    Android device detected, assigning default bug flags
    Listing File Information on Device with name: (NULL)
    mick@mick-deb-laptop:~$

    Any idea what I have done wrong?
    Thanks
    Mick

    • roger

      Hi

      I think the permission error you get when you run as a non-root user is because the user is not a member of the group “fuse”, you can run the command “sudo adduser fuse” to add your user to the fuse group, you need to relogin in order for the new membership to be active.

      I also see the error about PTP_ERROR_IO, I my first guess is that you have your Nexus 4 configured as a PTP device instead of MTP, you can switch between PTP and MTP on the device when it’s connected to the computer.

      I hope these tips solved the problem for you

      /Roger

      • Mick Sulley

        Hi Roger,
        Thanks for the suggestions. I have added the fuse group to my user, that fixed the permission error, I checked and it is set as an MTP device, but still does not work. This is what I get now –
        mick@mick-deb-laptop:~$ mtpfs Nexus
        Listing raw device(s)
        Device 0 (VID=18d1 and PID=4ee1) is a Google Inc (for LG Electronics) Nexus 4.
        Found 1 device(s):
        Google Inc (for LG Electronics): Nexus 4 (18d1:4ee1) @ bus 1, dev 3
        Attempting to connect device
        PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
        LIBMTP libusb: Attempt to reset device
        Android device detected, assigning default bug flags
        Error 1: Get Storage information failed.
        Error 2: PTP Layer error 02fe: get_handles_recursively(): could not get object handles.
        Error 2: (Look this up in ptp.h for an explanation.)
        Listing File Information on Device with name: (NULL)
        LIBMTP_Get_Storage() failed:-1
        mick@mick-deb-laptop:~$

        Any other ideas?

        • roger

          Hi, good that the permission issue is out of the way.

          I have not seen your errors before, make sure the screen on the device is unlocked. The internal storage in the device is only available when the device screen is unlocked.

  2. Mick Sulley

    I still cannot get this to work. I copied the zip file to /usr/local/src and installed from there. I created the mount directory myPhone in my home directory and chmod 777 so permissions should not be a problem.
    I connect the phone via USB and a pop up allows to select MTP or PTP, MTP is selected
    I run mtpfs myPhone and this is what I see –
    mick@mick-deb-laptop:~$ mtpfs myPhone
    Listing raw device(s)
    Device 0 (VID=18d1 and PID=4ee1) is a Google Inc (for LG Electronics) Nexus 4.
    Found 1 device(s):
    Google Inc (for LG Electronics): Nexus 4 (18d1:4ee1) @ bus 1, dev 3
    Attempting to connect device

    it stays like that for 30 seconds or so, then I get –

    Attempting to connect device
    PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
    LIBMTP libusb: Attempt to reset device
    Android device detected, assigning default bug flags
    Listing File Information on Device with name: (NULL)
    mick@mick-deb-laptop:~$

    What am I doing wrong???

    • roger

      Hi, my computer is currently not working so I can´t check this. You can try to use gphotofs instead, you can read about it in my article about mounting a PTP device, read some comment about issues with libmtp and Nexus 4.

  3. Andrew

    Following your directions failed for me, so I jumped to instructions in another site (http://www.noobslab.com/2013/06/mount-google-nexus-4-on-ubuntulinux.html) and and started with…

    and adding this content:

    Then…

    This is now working – don’t forget to unlock the screen before mounting – and I can browse the phone…

    My point is that your instructions may have worked had I unlocked the screen… but if not, they do work when followed up with the steps above…

    Thank you!

  4. gauthier

    I am having the same kind of problem as Mick Sulley:

    gauthier@ionian:/tmp/mtpfs-1.1$ mtpfs phone
    Listing raw device(s)
    Device 0 (VID=04e8 and PID=6860) is a Samsung GT P7310/P7510/N7000/I9070/I9100/I9300 Galaxy Tab 7.7/10.1/S2/S3/Nexus/Note/Y.
    Found 1 device(s):
    Samsung: GT P7310/P7510/N7000/I9070/I9100/I9300 Galaxy Tab 7.7/10.1/S2/S3/Nexus/Note/Y (04e8:6860) @ bus 4, dev 11
    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

    • roger

      Hi Gauthier

      Sorry for my late response, I have been busy renovating my kitchen.

      I think the problem might be that your version or libmtp which mtpfs uses are to old.

      Best regards

  5. Alberto

    I followed the instructions. It’s working after unlock the screen.
    Thank you.

    Motorola Razr D3 – Android 4.1 (Jelly Bean)

  6. Bean

    Hi!
    I get this error:

    root@rafael-debian:/home/rafael/Downloads/mtpfs-1.1-2# mtpfs myPhone/
    Listing raw device(s)
    Device 0 (VID=1004 and PID=631c) is UNKNOWN.
    Please report this VID/PID and the device model to the libmtp development team
    Found 1 device(s):
    1004:631c @ bus 1, 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

  7. sdio

    ./configure
    make
    sudo make install
    It’s not a Debian way.

    tar zxf mtpfs-1.1.tar.gz
    cd mtpfs-1.1
    dh_make -f ../mtpfs-1.1.tar.gz
    Type of package: single binary, indep binary, multiple binary, library, kernel module, kernel patch?
    [s/i/m/l/k/n] s
    fakeroot debian/rules binary
    cd ..
    sudo dpkg -i mtpfs_1.1-1_amd64.deb

    uninstall: dpkg –purge mtpfs

  8. hpsaturn

    Nice post, all steps correct, I added missing step: usermod -aG fuse myuser (and reboot)…
    Results:
    mount: OK,
    list directories: OK,
    list files: FAIL (not list any file only directories)
    any idea?

    Specifications:
    Distributor ID: Debian
    Description: Debian GNU/Linux 7.3 (wheezy)
    Release: 7.3
    kernel: 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux
    device: Nexus5

    dmesg(syslog):

    Dec 17 21:05:17 ZenBook kernel: [ 1698.038043] usb 3-2: new high-speed USB device number 3 using xhci_hcd
    Dec 17 21:05:17 ZenBook kernel: [ 1698.086849] usb 3-2: New USB device found, idVendor=18d1, idProduct=4ee2
    Dec 17 21:05:17 ZenBook kernel: [ 1698.086859] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    Dec 17 21:05:17 ZenBook kernel: [ 1698.086865] usb 3-2: Product: Nexus 5
    Dec 17 21:05:17 ZenBook kernel: [ 1698.086869] usb 3-2: Manufacturer: LGE
    Dec 17 21:05:17 ZenBook kernel: [ 1698.086872] usb 3-2: SerialNumber: 03c84f16213e3e0e
    Dec 17 21:05:17 ZenBook mtp-probe: checking bus 3, device 3: “/sys/devices/pci0000:00/0000:00:14.0/usb3/3-2″
    Dec 17 21:05:17 ZenBook mtp-probe: bus: 3, device: 3 was an MTP device
    Dec 17 21:07:30 ZenBook kernel: [ 1831.617897] usb 3-2: reset high-speed USB device number 3 using xhci_hcd
    Dec 17 21:07:31 ZenBook kernel: [ 1831.665875] xhci_hcd 0000:00:14.0: xHCI xhci_drop_endpoint called with disabled ep ffff88
    Dec 17 21:07:31 ZenBook kernel: [ 1831.665881] xhci_hcd 0000:00:14.0: xHCI xhci_drop_endpoint called with disabled ep ffff88

    Command output:

    $ mtpfs nexus
    Listing raw device(s)
    Device 0 (VID=18d1 and PID=4ee2) is UNKNOWN.
    Please report this VID/PID and the device model to the libmtp development team
    Found 1 device(s):
    18d1:4ee2 @ bus 3, dev 3
    Attempting to connect device
    PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
    LIBMTP libusb: Attempt to reset device
    Android device detected, assigning default bug flags
    Listing File Information on Device with name: (NULL)

    • Roger

      Hi
      I have noticed that I can’t see all files when mounting the MTP device, it seems like I can only access a snapshot of older files and after much struggle I stopped using MTP and began to transfer files by installing an FTP server app on the phone instead.
      Thanks for telling me about the missed step.

  9. Jenny

    I’m getting stuck building the mtpfs package (debian wheezy – all files mentioned above at latest versions):

    jenny@fennel:~/mtpfs/mtpfs-1.1$ fakeroot debian/rules binary
    dh binary –with autotools-dev
    dh_shlibdeps
    dpkg-shlibdeps: error: no dependency information found for /usr/lib/libmtp.so.9 (used by debian/mtpfs/usr/bin/mtpfs)
    dh_shlibdeps: dpkg-shlibdeps -Tdebian/mtpfs.substvars debian/mtpfs/usr/bin/mtpfs returned exit code 2
    make: *** [binary] Error 2

  10. Pingback: Hooking up a phone to the PC - Page 3
  11. Paulino Pardo

    I followed your instructions with a MotoG device, it seemed to work but… only as sudo.
    I’m pretty sure that my user is in fuse group as it is in root and sudoers, but I can only mount the device with ‘sudo mtpfs MotoG’ and if I ‘ls -l’ in folder where MotoG subfolder is I get this:
    d????????? ? ? ? ? ? MotoG
    there’s no way to see contents or use any mtp tool unless sudo preceded otherwise I get error message: Device not found
    Don’t know what todo….? Any Ideas….?

    Thanks in advance.

  12. David

    These are great step by step instructions. I hit a problem though at
    # sudo dpkg -i mtpfs_1.1-1_amd64.deb
    I actually get an error
    “dpkg: error processing mtpfs_1.1-1_amd64.deb (–install):
    cannot access archive: No such file or directory
    Errors were encountered while processing:
    mtpfs_1.1-1_amd64.deb”

    It would be a fantastic result to get this up and running. For the life of me I can not understand why this is not a default in Wheezy when android phones amount to over 70% of all smartphones used today.

  13. Pingback: how do I share files with my phone?
  14. Mohamed gamal

    I follow steps exactly but final give me This:
    Listing raw device(s)
    No raw devices found.
    please help me.
    thank you

  15. websites with blogs

    you are in point of fact a excellent webmaster.

    The web site loading pace is amazing. It kind of feels that you are
    doing any distinctive trick. Furthermore, The contents
    are masterwork. you’ve performed a excellent task in this matter!

    Take a look at my website: websites with blogs

  16. Jayne

    So while she plays, I stroll amid the gamblers giving their money to the casino in their own chosen
    way. There are actually cost per action offers that only require an email address for you to
    get paid. These loyalty points entitle players to special
    discounts that s redeemable when purchasing future lottery
    tickets. You’re at the cash register paying for your
    purchase and think that maybe you’ll buy a Scratch Off and get lucky.
    The software will automatically expire after the free trial period
    and those who find it amazing and would like to place an
    order will need to click on the link that says purchase the software and she will be led to the registered lottery
    software download link.

  17. telephone number lookup

    Unlike a land line which is freely available in this white or yellow pages a radio connection is protected just by laws that forbid these being listed publicly.
    A reverse phone lookup is very much like scanning through a typical telephone directory.
    This article has been flagged as spam, if you think this
    is an error please contact us.

  18. Mariana

    The amalgamation of reasoning, sequence solving, pattern recognition, logic, strategy and
    word completion will put you straight to the main stream of the game.
    It is has already become a great market hitter and is a business industry macho.
    Not only is this marketing technique extremely
    effective, it is also highly economical.

    Here is my web blog :: Despicable Me trainer tool (Mariana)

  19. justin bieber songs

    If you consider the fact that the old Shark Steam Mop
    was considered in many customer reviews as being a better steam mop than the Bissell Steam Pocket Mop, Haan Deluxe and Eureka,
    then you have more than enough reason to spend your
    money on the new Shark Steam Pocket Mop model. A common complaint
    I seen from unhappy consumers of this mop was that it
    left the floor too wet the first time they used it. Those models with the water supply and the steam
    creating process happening on the mop head provided the
    hottest steam and the easiest clean.

  20. download free hack tool dragon city

    It will also increase the ranking of your website on search engines and will drive more traffic to your website.
    This will allow you to answer only those calls that come in on your forwarded toll free number and route
    other calls to different locations. There are other ways to improve your ranking
    in Googlemaps, the purpose of this blog post is
    not to tell you EVERYTHING Frederick Web Promotions can do to improve your ranking,
    the purpose of this particular blog post is to:.

    Take a look at my webpage :: download free hack tool dragon city

  21. perdre vite

    Hiya very nice web site!! Guy .. Excellent .. Superb ..
    I’ll bookmark your website and take the feeds
    also? I am glad to find a lot of useful information here within the
    publish, we need develop extra strategies on this regard, thanks for sharing.
    . . . . .

  22. spilleautomater.n.nu

    Good day! This is my first visit to your blog! We are
    a collection of volunteers and starting a new project
    in a community in the same niche. Your blog provided us beneficial information to work on. You have done
    a marvellous job!

    Feel free to visit my homepage; svensk spilleautomater, spilleautomater.n.nu,

  23. Carla

    I like the valuable information you provide for your articles.
    I’ll bookmark your weblog and take a look at once more
    here frequently. I am relatively sure I’ll learn plenty of new stuff right
    right here! Good luck for the following!

    Take a look at my website: how to attract women (Carla)

Post a comment

You may use the following HTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">