How to mount an Android phone under Ubuntu 24.04.

1 minute read

I needed to transfer a bunch of files to my mobile phone recently, and I wanted to be able to run rsync to keep the files on my Ubuntu 24.04 laptop synchronised with my Fairphone 5. Straightforward file transfers are fine with Linux/Android but I wanted fast USB transfers (there was a lot of data) and the ability to use rsync.

I found this great post by Matt Openheim which gave me most of the information I required. However, it was written specifically for Debian, and didn’t quite work with Ubuntu.

This is what I needed to do to get it working under Ubuntu 24.04:

ON LINUX LAPTOP

  • install jmtpfs

    $ sudo apt-get install jmtpfs

  • Create a local directory:

    $ mkdir ~/tmpphone

ON PHONE

  •  On the Android phone, in settings,
    • search for ‘USB controlled by’ and then
    • select “This device” and “File Transfer”

ON LINUX LAPTOP

  • Plug the phone into the laptop.
    • It will be mounted automatically using gvfs (on my machine anyway - that may well depend on whether you have the gvfsd package installed), and will be visible in your file manager (which is Nautilus on my machine).
    • Therefore before proceeding, you you need to unmount the phone. You can do this by running nautilus file manager and ejecting the phone (press the eject icon next to your Android phone description in the LHS menu in Nautilus).

IMPORTANT - if you don’t do this you will get an error message like the following when you run the next mount command:

Device 0 (VID=18d1 and PID=4ee1) is a Google Inc Nexus/Pixel (MTP).libusb_claim_interface() reports device is busy, likely in use by GVFS or KDE MTP device handling already LIBMTP PANIC: Unable to initialize deviceterminate called after throwing an instance of ‘MtpErrorCantOpenDevice’  what():  Can’t open device[1]    348761 IOT instruction (core dumped)  

  • Now you can mount it with jmtpfs:

    $ jmtpfs ~/tmpphone

  • you should see something like the following if it works:

Device 0 (VID=18d1 and PID=4ee1) is a Google Inc Nexus/Pixel (MTP). Android device detected, assigning default bug flags

  • Now you can cd into ~/tmpphone and see the internal memory and the SD card.

    $ cd ~/tmpphone

    $ ls

    'Internal shared storage' 'Samsung SD card'

    $

  • To unmount, run this:    

    $ fusermount -u ~/tmpphone

Huge thanks to Matt Oppenheim for his blog post

Leave a Comment