4

I would like to access the filesystem of my Android mobile device in Windows-Subsystem-For-Linux:

mobile-device-filesystem

I executed the command mount, but I only see /mnt/c and /mnt/g.

Is there a way to get access to file on my mobile device.

2
  • 2
    The keyword here is “MTP” (Media Transfer Protocol). It's probably not possible, especially because this isn’t filesystem access in the first place.
    – Daniel B
    Commented Dec 18, 2021 at 11:12
  • mtpdrive.com might be a paid solution. There is a trial but it is somewhat limited. I've never tried it hence only a comment.
    – Mokubai
    Commented Dec 18, 2021 at 12:48

1 Answer 1

4

I was able to get this working using the new USB/IP feature in WSL, along with jmtpfs.

USB/IP

See the official Microsoft docs for WSL2 USB/IP support.

First, whether you are running Windows 10 or Windows 11, wsl --update to the latest kernel (or App Store release with kernel) which has USB/IP support.

After that, however, the exact steps will depend on:

  • As with most things, directions for Ubuntu are standard. See my post on Debian for the changes needed for that distro.

  • The instructions from Microsoft and the usbipd-win project both assume that you are using your default WSL distribution. If you have more than one distribution, and need to access it in a non-default one, you can still manually run usbip from within WSL2.

jmtpfs

Once you've shared your phone from Windows to WSL over USB/IP and can see it with lsusb, then you should be able to mount it using jmtpfs:

sudo apt install jmtpfs
sudo mkdir /media/android
sudo jmtpfs -o allow_other /media/android/

Refer to the jmtpfs readme for more info.

It seems that after unmounting, the USB/IP connection is "lost" or damaged, so I had to detach and attach the device again on the Windows side before I could try anything else with it.

1
  • I encountered this error: Libusb1 init failed LIBMTP PANIC: get_mtp_usb_device_list() error code: 3 on line 646 terminate called after throwing an instance of 'MtpError' what(): Aborted (core dumped)
    – mhmd
    Commented Jul 26, 2023 at 6:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .