How to Access Android Devices Internal Storage and SD Card in Ubuntu, Linux Mint using Media Transfer Protocol (MTP)

3 min


This tutorial will show how to access android devices using MTP in Ubuntu and how to access SD card contents.

MTP, or media transfer protocol, is an extension of the Picture transfer protocol and is implemented in the Android marshmallow version. After the marshmallow update, you can’t use the android devices as typical mass storage devices you can just plug in and see the internal storage contents and the SD card contents in a file manager such as in Thunar or GNOME Files. This is due to the OS being unable to determine the MTP devices, and also, a list of supported devices is not yet implemented.

Steps to access Android Devices in Ubuntu, Linux Mint

  • Install libmtp, FUSE file system for MTP enabled devices mtpfs using below commands
sudo apt install go-mtpfs
sudo apt install libmtp
sudo apt install mtpfs mtp-tools
  • Create a directory in /media using the below command and changing the permission to write
sudo mkdir /media/MTPdevice
sudo chmod 775 /media/MTPdevice
sudo mtpfs -o allow_other /media/MTPdevice
  • Plug in your Android device using a USB cable in Ubuntu.
  • On your Android device, swipe down from above on the home screen and click Touch for more options.
  • In the following menu, select the option “Transfer File (MTP)“.
MTP Option1
MTP Option2
  • Run the below command in the terminal to find out the device ID etc. You can see the VID and PID in the command output for your device. Note down these two numbers (highlighted in below image).
mtp-detect
mtp-detect Command Output
mtp-detect Command Output
  • Open the android rules file using the text editor using the below command.
sudo gedit /etc/udev/rules.d/51-android.rules
  • If you are using the latest Ubuntu, where gedit is not installed, use the below command.
sudo gnome-text-editor /etc/udev/rules.d/51-android.rules
  • Type the below line using your device’s VID and PID in the 51-android.rules file (which you note down in above step).
  • Save and close the file.
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", ATTR{idProduct}=="2e82", MODE="0666"
  • Run the below command to restart the device manager via systemd.
sudo service udev restart

Next steps to access contents

  • The next steps are mainly needed to access the contents of the external SD card memory of your android device.
  • I had to do these because the file manager was NOT showing the contents of the SD card. This is not a solution, though, but it is a workaround which works for most of the users as per this Google forum post and worked for my Motorola G 2nd Gen with SanDisk SD card.
    • Safely remove your connected device in Ubuntu.
    • Turn off the device. Remove the SD card from the device.
    • Turn on the device without the SD card.
    • Turn off the device again.
    • Put the SD card back in and turn on the device again.
  • Reboot your Ubuntu machine and plug in your android device.
  • Now you can see the contents of your android device’s internal storage and the SD card contents.
MTP Device Contents in Ubuntu
MTP Device Contents in Ubuntu

Conclusion

The above tutorial to access Android device contents in Ubuntu worked on older and new Ubuntu releases with Android devices (Samsung, OnePlus & Motorolla). Try these steps and it might work if you are facing difficulties to access the contents. In my opinion, MTP is very slow compared to good old plug and play options.


Arindam

Creator of debugpoint.com. All time Linux user and open-source supporter. Connect with me via Telegram, Twitter, LinkedIn, or send us an email.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

6 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
6
0
Would love your thoughts, please comment.x
()
x