Media Transfer Protocol, no MTP device found

I followed the instructions in this two wiki, it seems really straightforward:

But when I tried to do # aft-mtp-mount usb1/, I get this result:

Device::Find failed:Device is already used by another process
Device::Find failed:Device is already used by another process
Device::Find failed:Device is already used by another process
Device::Find failed:Device is already used by another process
Device::Find failed:Device is already used by another process
connect failed: no MTP device found

And according to the Arch Wiki:
https://wiki.archlinux.org/index.php/Media_Transfer_Protocol#Android_File_Transfer:_connect_failed:_no_MTP_device_found

I need to install android-udev package.

Therefore, I added this in my configuration.nix:

services.udev.packages = [ pkgs.android-udev-rules ];

But I get the same results… did I miss anything?
Also tried with nixos.jmtpfs
I use a Samsung Galaxy S7 if it makes a difference.

1 Like

I have had a lot of problems with MTP on NixOS, with multiple devices. The
devices work on Debian, so there must be a way to make them work on NixOS.
Unfortunately, I do not have time to devote to the issue. (I currently manage
those devices on an Arch system.)

I do not know if it will help your specific issue, but here are my general
tips for working with MTP on NixOS:

  • Contrary to normal MTP usage, use root to mount as well as work with the
    device. (I have experienced strange issues when attempting to use my
    non-privileged user.)
  • Try various utilities. Different devices seem to work (better) with
    different utilities. (I have a device that only “works” with go-mtpfs.)
    • android-file-transfer
    • jmtpfs
    • go-mtpfs
  • When mounting, do not include a trailing / in the directory name (which
    is automatically added when using tab-completion). For example, use
    aft-mtp-mount usb1 not aft-mtp-mount usb1/. (I have a device that
    fails to mount when there is a trailing /, indicating that the program
    is not properly normalizing arguments.)
  • Check to see if the device is mounted even when you get an error. Sometimes
    an error indicates that it is not mounted when it actually is!
3 Likes

I switched to nixos-unstable and followed your tips. Now everything works fine, Thank you!

Other details I should add:

  • My device only works with go-mtpfs like you said.
  • When you try to access something on the phone, don’t go into sensitive folders or it will block your access/generate IO error for whatever reasons and you’ll have to remount.