How to traverse MTP mounted devices (phones) from the terminal?

Not sure if this is the best place for this post but could not think of a better place to as it.

I want to offload tons of files from my Google Pixel 2 using Rsync or CP to preserve the file attributes like the timestamps, etc.

The problem is that I cannot seem to find the exact mount point used to mount the MTP to begin with and the more I search online the more baffled I become.

from what I gather online the mount points should be either in /run/user/$USER/gvfs or in /var/run/user/$UID/gvfs while the MTP devices are connected. However, both directories are empty and lead to nothing even when the phone is connected.

I am at the end of my whits trying to figure out a way to be able to access the files on the phone which are shared on the MTP through the terminal, any help would be very much appreciated.

You seem to be sure that the phone is mounted. Then a simple

mount

will show you all mounted file systems. You only have to identify your phone in that list. It will be somewhere at the end.

Further to Henk’s advice do you have the mtpfs (or similar) FUSE file system installed?

zypper se -s mtpfs

Also, is MTP specifically enabled in your Google device?

https://wiki.archlinux.org/index.php/Media_Transfer_Protocol

Thanks for the reply,

Did check the output but my phone is nowhere on that list


taker@xps13:~> mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,size=8041932k,nr_inodes=2010483,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
/dev/mapper/system-root on / type btrfs (rw,relatime,ssd,space_cache,subvolid=747,subvol=/@/.snapshots/393/snapshot)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=34,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=20857)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
/dev/mapper/system-root on /usr/local type btrfs (rw,relatime,ssd,space_cache,subvolid=259,subvol=/@/usr/local)
/dev/mapper/system-root on /.snapshots type btrfs (rw,relatime,ssd,space_cache,subvolid=266,subvol=/@/.snapshots)
/dev/mapper/system-root on /var type btrfs (rw,relatime,ssd,space_cache,subvolid=258,subvol=/@/var)
/dev/mapper/system-root on /opt type btrfs (rw,relatime,ssd,space_cache,subvolid=263,subvol=/@/opt)
/dev/mapper/system-root on /tmp type btrfs (rw,relatime,ssd,space_cache,subvolid=260,subvol=/@/tmp)
/dev/mapper/system-root on /root type btrfs (rw,relatime,ssd,space_cache,subvolid=262,subvol=/@/root)
/dev/mapper/system-root on /boot/grub2/i386-pc type btrfs (rw,relatime,ssd,space_cache,subvolid=265,subvol=/@/boot/grub2/i386-pc)
/dev/mapper/system-root on /srv type btrfs (rw,relatime,ssd,space_cache,subvolid=261,subvol=/@/srv)
/dev/mapper/system-root on /boot/grub2/x86_64-efi type btrfs (rw,relatime,ssd,space_cache,subvolid=264,subvol=/@/boot/grub2/x86_64-efi)
/dev/nvme0n1p1 on /boot/efi type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/mapper/system-home on /home type xfs (rw,relatime,attr2,inode64,noquota)
/var/lib/snapd/snaps/core_5714.snap on /snap/core/5714 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core_5548.snap on /snap/core/5548 type squashfs (ro,nodev,relatime,x-gdu.hide)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
vmware-vmblock on /run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=1610632k,mode=700,uid=1000,gid=100)
pcloud on /tmp/.mount_pcloudq1wtFf type fuse.pcloud (ro,nosuid,nodev,relatime,user_id=1000,group_id=100)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=100)
pCloud.fs on /home/taker/pCloudDrive type fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=100)

Yes I have simple-mtpfs installed and MTP is officially enabled in my Google Pixel device along with USB debugging. I followed the first half of this video to mount my phone to a directory in my home directory but I recive an error depite the simple-mtpfs seeing my phone.


taker@xps13:~> simple-mtpfs -l
1: Google IncNexus/Pixel (MTP+ADB)
taker@xps13:~/Temp> simple-mtpfs --device 1 ~/Temp/cell/
LIBMTP PANIC: Trying to dump the error stack of a NULL device!

I have no idea how to bypass the LIBMTP PANIC error. I tried looking online for a solution as well but there doesn’t seem to be much available on that PANIC error out there.

[QUOTE=TakerTX;2911019]


gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=100)
pCloud.fs on /home/taker/pCloudDrive type fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=100)

Just speculating here…not a conflict with between gvfsd-fuse and simple-mtpfs trying to concurrently access the device perhaps?

One of many results I found online…

Yes I have simple-mtpfs installed and MTP is officially enabled in my Google Pixel device along with USB debugging. I followed the first half of this video to mount my phone to a directory in my home directory but I recive an error depite the simple-mtpfs seeing my phone.

taker@xps13:~> simple-mtpfs -l
1: Google IncNexus/Pixel (MTP+ADB)
taker@xps13:~/Temp> simple-mtpfs --device 1 ~/Temp/cell/
LIBMTP PANIC: Trying to dump the error stack of a NULL device!

I have no idea how to bypass the LIBMTP PANIC error. I tried looking online for a solution as well but there doesn’t seem to be much available on that PANIC error out there.

Actually, I get numerous results googling “LIBMTP PANIC: Trying to dump the error stack of a NULL device!”

I also wanted to share this redhat bug report just in case it is relevant with respect to the fuse kernel module perhaps.

[quote="“deano_ferrari,post:5,topic:137500”]

I found and followed the suggestion in the link you provided when I did my search eaerlier but that did not help. I cannot seem to be able to remove gvfsd-fuse and killing all of its processes using the commands provided in the link does not help either the first two killall commands cannot find any processes, only the last one finds one or two that it successfully kills but I still keep receiving the same error when trying simple-mtpfs command. Other links I found online were pretty much in the same category as well.

[quote="“deano_ferrari,post:5,topic:137500”]

I should also add that the process that killall -v mtp.so finds and kills keeps being relaunched somehow despite being killed so running the command again and again finds the same process and kills it 6 times out of 10. But the same error occurs when I try running the simple-mtpfs command even when no more processes were found.

The process is as follows:


killall -v mtp.so
Killed mtp.so(19336) with signal 15

Hmmm… which desktop environment is in use here? Is the nautilus file manager in use?

Not sure if it is nautilus or not but I am running the default installation of OpenSUSE Tumbleweed with KDE Plasma 5

Dolphin is the default file manager for KDE.

Thanks, I didn’t know that.

Any ideas based on that?

Would KDE Connect work for you?
https://en.opensuse.org/SDB:KDE_Connect

Tried KDE connect a while back, and many times before actually, and it was very slow and buggy on my phone for some reason. many attempts to fix the issue resulted in nothing so I gave it all up.

This *might *help?

these are the outputs of the /var/logs/messages when the phone is connected:


2019-08-11T13:23:39.240339+04:30 xps13 kernel: [13514.583698] usb 4-1: new SuperSpeed Gen 1 USB device number 14 using xhci_hcd
2019-08-11T13:23:39.260399+04:30 xps13 kernel: [13514.605110] usb 4-1: New USB device found, idVendor=18d1, idProduct=4ee7, bcdDevice= 4.40
2019-08-11T13:23:39.260409+04:30 xps13 kernel: [13514.605111] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
2019-08-11T13:23:39.260410+04:30 xps13 kernel: [13514.605112] usb 4-1: Product: Pixel 2 XL
2019-08-11T13:23:39.260411+04:30 xps13 kernel: [13514.605113] usb 4-1: Manufacturer: Google
2019-08-11T13:23:39.260411+04:30 xps13 kernel: [13514.605113] usb 4-1: SerialNumber: 711KPZK0625725
2019-08-11T13:23:39.265249+04:30 xps13 mtp-probe: checking bus 4, device 14: "/sys/devices/pci0000:00/0000:00:1c.4/0000:03:00.0/0000:04:02.0/0000:39:00.0/usb4/4-1"
2019-08-11T13:23:39.265332+04:30 xps13 mtp-probe: bus: 4, device: 14 was not an MTP device
2019-08-11T13:23:39.805675+04:30 xps13 mtp-probe: checking bus 4, device 14: "/sys/devices/pci0000:00/0000:00:1c.4/0000:03:00.0/0000:04:02.0/0000:39:00.0/usb4/4-1"
2019-08-11T13:23:39.805803+04:30 xps13 mtp-probe: bus: 4, device: 14 was not an MTP device
2019-08-11T13:23:39.806765+04:30 xps13 kiod5[5421]: UdevQt: unhandled device action "bind"
2019-08-11T13:23:39.806969+04:30 xps13 dolphin[5396]: UdevQt: unhandled device action "bind"
2019-08-11T13:23:39.807149+04:30 xps13 org_kde_powerdevil[2693]: UdevQt: unhandled device action "bind"
2019-08-11T13:23:39.807324+04:30 xps13 krunner[2608]: UdevQt: unhandled device action "bind"
2019-08-11T13:23:39.807491+04:30 xps13 kdeinit5[2568]: UdevQt: unhandled device action "bind"
2019-08-11T13:23:39.807668+04:30 xps13 plasmashell[2610]: UdevQt: unhandled device action "bind"
2019-08-11T13:23:39.807828+04:30 xps13 baloo_file[2606]: UdevQt: unhandled device action "bind"
2019-08-11T13:23:49.816095+04:30 xps13 kernel: [13525.159857] usb 4-1: USB disconnect, device number 14
2019-08-11T13:23:49.823168+04:30 xps13 kdeinit5[2568]: UdevQt: unhandled device action "unbind"
2019-08-11T13:23:49.824251+04:30 xps13 kiod5[5421]: UdevQt: unhandled device action "unbind"
2019-08-11T13:23:49.825144+04:30 xps13 krunner[2608]: UdevQt: unhandled device action "unbind"
2019-08-11T13:23:49.826023+04:30 xps13 org_kde_powerdevil[2693]: UdevQt: unhandled device action "unbind"
2019-08-11T13:23:49.826651+04:30 xps13 dolphin[5396]: UdevQt: unhandled device action "unbind"
2019-08-11T13:23:49.827255+04:30 xps13 plasmashell[2610]: UdevQt: unhandled device action "unbind"
2019-08-11T13:23:49.827844+04:30 xps13 baloo_file[2606]: UdevQt: unhandled device action "unbind"
2019-08-11T13:23:50.232334+04:30 xps13 kernel: [13525.574498] usb 4-1: new SuperSpeed Gen 1 USB device number 15 using xhci_hcd
2019-08-11T13:23:50.252094+04:30 xps13 kernel: [13525.595328] usb 4-1: New USB device found, idVendor=18d1, idProduct=4ee2, bcdDevice= 4.40
2019-08-11T13:23:50.252150+04:30 xps13 kernel: [13525.595338] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
2019-08-11T13:23:50.252153+04:30 xps13 kernel: [13525.595343] usb 4-1: Product: Pixel 2 XL
2019-08-11T13:23:50.252155+04:30 xps13 kernel: [13525.595348] usb 4-1: Manufacturer: Google
2019-08-11T13:23:50.252158+04:30 xps13 kernel: [13525.595353] usb 4-1: SerialNumber: 711KPZK0625725
2019-08-11T13:23:50.809708+04:30 xps13 kiod5[5421]: kf5.kiod.kmtpd: New device attached with udi= "/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1c.4/0000:03:00.0/0000:04:02.0/0000:39:00.0/usb4/4-1" . Checking if PortableMediaPlayer...
2019-08-11T13:23:50.810278+04:30 xps13 kiod5[5421]: kf5.kiod.kmtpd: SOLID: New Device with udi= "/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1c.4/0000:03:00.0/0000:04:02.0/0000:39:00.0/usb4/4-1"
2019-08-11T13:23:50.810723+04:30 xps13 kiod5[5421]: kf5.kiod.kmtpd: new device, getting raw devices
2019-08-11T13:23:50.811072+04:30 xps13 kiod5[5421]: kf5.kiod.kmtpd: No Error, continuing
2019-08-11T13:23:50.811196+04:30 xps13 kiod5[5421]: kf5.kiod.kmtpd: Found device matching the Solid description
2019-08-11T13:23:50.814514+04:30 xps13 org_kde_powerdevil[2693]: UdevQt: unhandled device action "bind"
2019-08-11T13:23:50.814655+04:30 xps13 krunner[2608]: UdevQt: unhandled device action "bind"
2019-08-11T13:23:50.814744+04:30 xps13 baloo_file[2606]: UdevQt: unhandled device action "bind"
2019-08-11T13:23:50.814817+04:30 xps13 kdeinit5[2568]: UdevQt: unhandled device action "bind"
2019-08-11T13:23:50.815770+04:30 xps13 dolphin[5396]: UdevQt: unhandled device action "bind"
2019-08-11T13:23:50.815856+04:30 xps13 kdeinit5[2568]: UdevQt: unhandled device action "bind"
2019-08-11T13:23:50.815924+04:30 xps13 krunner[2608]: UdevQt: unhandled device action "bind"
2019-08-11T13:23:50.815991+04:30 xps13 org_kde_powerdevil[2693]: UdevQt: unhandled device action "bind"
2019-08-11T13:23:50.816047+04:30 xps13 dolphin[5396]: UdevQt: unhandled device action "bind"
2019-08-11T13:23:50.816165+04:30 xps13 baloo_file[2606]: UdevQt: unhandled device action "bind"
2019-08-11T13:23:50.819017+04:30 xps13 plasmashell[2610]: UdevQt: unhandled device action "bind"
2019-08-11T13:23:50.820943+04:30 xps13 plasmashell[2610]: UdevQt: unhandled device action "bind"
2019-08-11T13:23:50.858143+04:30 xps13 kiod5[5421]: kf5.kiod.kmtpd: Created device  "Pixel 2 XL"   with udi= "/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1c.4/0000:03:00.0/0000:04:02.0/0000:39:00.0/usb4/4-1"  and timeout  48
2019-08-11T13:23:50.858486+04:30 xps13 kiod5[5421]: UdevQt: unhandled device action "bind"
2019-08-11T13:23:50.858566+04:30 xps13 kiod5[5421]: UdevQt: unhandled device action "bind"
2019-08-11T13:24:20.298059+04:30 xps13 dbus-daemon[1572]: [system] Activating via systemd: service name='org.freedesktop.resolve1' unit='dbus-org.freedesktop.resolve1.service' requested by ':1.7' (uid=0 pid=1845 comm="/usr/sbin/NetworkManager --no-daemon ")
2019-08-11T13:24:20.298395+04:30 xps13 dbus-daemon[1572]: [system] Activation via systemd failed for unit 'dbus-org.freedesktop.resolve1.service': Unit dbus-org.freedesktop.resolve1.service not found.

and this is the output when I run the mount command using simple-mtpfs:


2019-08-11T13:24:56.825007+04:30 xps13 sudo:    taker : TTY=pts/2 ; PWD=/home/taker ; USER=root ; COMMAND=/usr/bin/simple-mtpfs --device 1 cell/
2019-08-11T13:24:56.826715+04:30 xps13 sudo: pam_unix(sudo:session): session opened for user root by taker(uid=0)
2019-08-11T13:24:56.951275+04:30 xps13 sudo: pam_unix(sudo:session): session closed for user root

Thought they might be useful in getting tot he bottom of this.

It does indeed look like KDE is getting in the way… this might take a bug report to progress.

https://en.opensuse.org/openSUSE:Submitting_bug_reports

Hopefully, others more knowledgeable than myself can chime in here.

I just filed the bug report.

This was my first bug report so I hope I had done it the correct way. Hopefully this gets resolved as it is very frustrating and in my case time sensitive.