Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
1
votes
1
answers
768
views
How to mount MTP devices independently of desktop environment
I'm using Ubuntu 22.04 with Gnome and **I want to create a bash script which copy files from my phone to my laptop**. Seeing [this answer][1], I installed [gvfs-fuse][2], reboot and now the device is available at `/usr/run/$(id -u)/gvfs`. The problem is that I want to mount MTP devices without needi...
I'm using Ubuntu 22.04 with Gnome and **I want to create a bash script which copy files from my phone to my laptop**.
Seeing this answer , I installed gvfs-fuse , reboot and now the device is available at
/usr/run/$(id -u)/gvfs
.
The problem is that I want to mount MTP devices without needing gvfs
, since I want the script to be usable in any linux environment.
I tried using jmtpfs
but it yields errors related to GVFS:
- mtp-detect
gives the error:
Attempting to connect device(s)
libusb_claim_interface() reports device is busy, likely in use by GVFS or KDE MTP device handling alreadyLIBMTP PANIC: Unable to initialize device
Unable to open raw device 0
OK.
- Trying to mount with jmtpfs
yields (understandably) the same result:
libusb_claim_interface() reports device is busy, likely in use by GVFS or KDE MTP device handling alreadyLIBMTP PANIC: Unable to initialize device
terminate called after throwing an instance of 'MtpErrorCantOpenDevice'
what(): Can't open device
fish: Job 1, 'jmtpfs /media/santatra/mtp/' terminated by signal SIGABRT (Abort)
- but jmtpfs -l
see the MTP device:
Device 0 (VID=18d1 and PID=4ee1) is a Google Inc Nexus/Pixel (MTP).
Available devices (busLocation, devNum, productId, vendorId, product, vendor):
1, 36, 0x4ee1, 0x18d1, Nexus/Pixel (MTP), Google Inc
So it seems that the desktop environment is mounting the device automatically.
**QUESTION**: How can I mount MTP devices without needing GVfs in an environment with GNOME? And how can I tell Nautilus to release the MTP device?
## What I tried
- The *Unmount* button on Nautilus does indeed unmount the device but gives the same error.
- There's no option related to automatic mounting in gnome-control-center
## Environment
- Ubuntu 22.04
- Nautilus 42.2
## NOTE
I don't think I should ask on Ask Ubuntu because
- it can also occur in a KDE environment
- I want the script to be usable in any linux environment
glacier
(391 rep)
Feb 9, 2025, 08:52 AM
• Last activity: Mar 27, 2025, 11:15 AM
9
votes
2
answers
5196
views
Why is rsync so slow when working with MTP devices?
In order to perform regular backup of my phone (Samsung A5 2016, or `SM-A510F`) using `rsync`, I used the following command: rsync --verbose --progress --omit-dir-times --no-perms --recursive --inplace --progress /run/user/1000/gvfs/mtp\:host\=%5Busb%3A002%2C018%5D/Phone/ /data/phone_back_folder/ -...
In order to perform regular backup of my phone (Samsung A5 2016, or
SM-A510F
) using rsync
, I used the following command:
rsync --verbose --progress --omit-dir-times --no-perms --recursive --inplace --progress /run/user/1000/gvfs/mtp\:host\=%5Busb%3A002%2C018%5D/Phone/ /data/phone_back_folder/
- 1000
is, obviously, the UID of my user
- mtp\:host\=%5Busb%3A002%2C018%5D
being a temporary MTP host name given to my phone when mounted (which is somehow changing every time the device is mounted)
- --omit-dir-times
and --no-perms
are here because MTP does not them apparently
Since I use the --progress
flag, I can see the estimated transmitting speed for each file, by instance:
Phone/DCIM/Camera/20180408_184356.jpg
2,814,075 100% 16.58MB/s 0:00:00 (xfr#265, to-chk=821/1262)
But these figures are hard to believe, since, most of the time, it seems that the system is idling, waiting for the next file to be transferred.
$ dstat -cd --disk-util --disk-tps
----total-cpu-usage---- -dsk/total- sda--sdb--sdc- -dsk/total-
usr sys idl wai hiq siq| read writ|util:util:util|reads writs
6 1 93 0 0 0| 344k 166k|0.03:0.37:1.43| 5 6
2 0 98 0 0 0|4096B 0 | 0: 0: 0| 0 0
3 0 97 0 0 0| 0 52k| 0:1.20: 0| 0 2
13 1 87 0 0 0| 0 0 | 0: 0: 0| 0 0
3 1 96 0 0 0| 0 0 | 0: 0: 0| 0 0
3 0 97 0 0 0| 0 152k|0.80: 0: 0| 0 2
3 0 97 0 0 0| 0 648k| 0:3.20: 0| 0 78
4 0 96 0 0 0| 0 0 | 0: 0: 0| 0 0
3 0 97 0 0 0| 0 0 | 0: 0: 0| 0 0
7 1 92 0 0 0| 0 0 | 0: 0: 0| 0 0
5 0 94 0 0 0| 0 0 | 0: 0: 0| 0 0
6 1 94 0 0 0| 0 12k| 0:0.40: 0| 0 2
6 1 93 0 0 0| 0 0 | 0: 0: 0| 0 0
6 0 94 0 0 0| 0 0 | 0: 0: 0| 0 0
7 1 91 0 0 0| 0 188k| 0:0.80: 0| 0 3
4 1 95 0 0 0| 0 0 | 0: 0: 0| 0 0
4 0 96 0 0 0|4096B 44M|8.80: 0: 0| 1 189
7 1 92 0 0 0| 0 172k| 0:3.20: 0| 0 18
6 1 93 0 0 0| 0 0 | 0: 0: 0| 0 0
3 0 96 0 0 0| 0 0 | 0: 0: 0| 0 0
6 1 93 0 0 0| 0 0 | 0: 0: 0| 0 0
6 0 93 0 0 0| 0 0 | 0: 0: 0| 0 0
7 2 91 0 0 0| 0 116k| 0:0.80: 0| 0 4
5 1 94 0 0 0| 0 0 | 0: 0: 0| 0 0
3 1 96 0 0 0| 0 0 | 0: 0: 0| 0 0
4 0 96 0 0 0| 0 0 | 0: 0: 0| 0 0
4 1 95 0 0 0| 0 0 | 0: 0: 0| 0 0
5 0 94 0 0 0| 0 0 | 0: 0: 0| 0 0
5 0 94 0 0 0| 0 224k| 0:0.80: 0| 0 3
5 1 93 0 0 0| 0 0 | 0: 0: 0| 0 0
5 1 95 0 0 0| 0 0 | 0: 0: 0| 0 0
12 3 85 0 0 0| 0 0 | 0: 0: 0| 0 0
8 1 91 0 0 0| 0 604k| 0: 0: 0| 0 59
5 0 94 0 0 0| 0 84k| 0:1.20: 0| 0 2
5 0 94 0 0 0| 0 0 | 0: 0: 0| 0 0
4 0 96 0 0 0| 0 0 | 0: 0: 0| 0 0
3 0 97 0 0 0| 0 0 | 0: 0: 0| 0 0
Update: I ran another time dstat
after unmounting and remounting the MTP device, and it started faster and falling back again to idling for most of the time.
$ dstat -cd --disk-util --disk-tps
----total-cpu-usage---- -dsk/total- sda--sdb--sdc- -dsk/total-
usr sys idl wai hiq siq| read writ|util:util:util|reads writs
5 1 94 0 0 0| 219k 603k|0.02:0.36:1.59| 3 7
6 3 90 1 0 0| 12k 25M| 0: 0:12.8| 3 44
5 2 86 7 0 0| 0 41M| 0: 0:64.0| 0 68
5 3 92 0 0 0|4096B 2744k| 0:2.00:1.60| 1 101
5 2 92 0 0 0| 20k 0 | 0: 0:3.60| 5 0
5 2 92 0 0 0| 16k 0 | 0: 0:2.40| 4 0
6 3 90 1 0 0| 12k 17M| 0: 0:14.0| 3 27
5 2 78 14 0 0| 12k 69M| 0: 0:92.0| 3 113
7 2 90 0 0 0| 12k 0 | 0: 0:2.80| 3 0
5 3 92 0 0 0| 12k 68k| 0:0.40:2.00| 3 2
6 2 92 0 0 0| 20k 0 | 0: 0:2.40| 5 0
5 2 94 0 0 0|4096B 0 | 0: 0:0.80| 1 0
3 1 91 5 0 0| 0 62M| 0: 0:45.2| 0 106
4 1 90 6 0 0| 0 2500k| 0:1.20:49.6| 0 67
4 1 95 0 0 0| 0 104k| 0:0.40: 0| 0 2
4 1 95 0 0 0| 0 192k| 0:0.80: 0| 0 3
4 2 94 0 0 0| 0 28k|0.40: 0: 0| 0 3
4 1 95 0 0 0| 0 40k| 0: 0:2.40| 0 2
4 1 95 0 0 0| 0 0 | 0: 0: 0| 0 0
4 2 94 0 0 0| 0 0 | 0: 0: 0| 0 0
4 1 95 0 0 0| 0 48k| 0:0.40: 0| 0 2
3 1 95 0 0 0| 0 16k| 0: 0: 0| 0 4
4 1 95 0 0 0| 0 0 | 0: 0: 0| 0 0
4 1 96 0 0 0| 0 0 | 0: 0: 0| 0 0
4 2 94 0 0 0| 0 332k| 0: 0: 0| 0 59
4 1 95 0 0 0| 0 0 | 0: 0: 0| 0 0
3 1 96 0 0 0| 0 0 | 0: 0: 0| 0 0
4 2 95 0 0 0| 0 16k| 0:0.80: 0| 0 2
3 1 96 0 0 0| 0 0 | 0: 0:38.4| 0 0
6 2 92 0 0 0| 0 104k| 0: 0:10.4| 0 14
5 2 93 0 0 0| 0 0 | 0: 0: 0| 0 0
4 1 95 0 0 0| 0 0 | 0: 0: 0| 0 0
3 1 95 0 0 0| 0 448k| 0: 0: 0| 0 1
3 1 95 0 0 0| 0 48k| 0:0.80: 0| 0 2
3 1 96 0 0 0| 0 32k| 0: 0: 0| 0 7
4 1 94 0 0 0| 0 548k| 0:2.00: 0| 0 66
4 1 95 0 0 0| 0 92k| 0:1.60: 0| 0 9
3 1 96 0 0 0| 0 28k| 0:1.20: 0| 0 3
7 1 92 0 0 0| 0 0 | 0: 0: 0| 0 0
3 2 95 0 0 0| 0 0 | 0: 0: 0| 0 0
3 1 96 0 0 0| 0 0 | 0: 0: 0| 0 0
3 1 96 0 0 0| 0 384k| 0: 0: 0| 0 44
4 2 95 0 0 0| 0 60k| 0:0.80: 0| 0 2
3 1 96 0 0 0| 0 0 | 0: 0:2.40| 0 0
3 1 96 0 0 0| 0 2560k| 0: 0:47.6| 0 5
4 2 94 0 0 0| 0 0 | 0: 0: 0| 0 0
3 2 95 0 0 0| 0 520k| 0:0.40: 0| 0 48
3 1 96 0 0 0| 0 0 | 0: 0: 0| 0 0
---
I was wondering if everything was normal, and, either way, why MTP transfer is so slow, especially via rsync
.
At this rate, it seems that it would take several hours to backup my phone data (without previous backup), which is not something I can really do for a total backup. For an incremental backup, that could have been acceptable, but this is not the question here.
For the record, last time I tried to backup my pictures with a tool such as Shotwell (it was a while ago), it did not seem to have taken long (but I was not very paying close attention to it).
- What would make a difference here, apart from using different libraries to handle MTP access?
- What is the state of MTP support on Linux currently? I heard of some people were using jmtpfs
to mount their MTP devices with FUSE, but not always without issues.
- Correct me if I am wrong, but I thought gvfs
was using libmtp
under the hood.
### System and machine details
$ uname -svro
Linux 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3.1 (2019-02-19) GNU/Linux
---
$ lsusb | grep MTP
Bus 002 Device 018: ID 04e8:6860 Samsung Electronics Co., Ltd Galaxy (MTP)
---
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 238.5G 0 disk
├─sda1 8:1 0 107.8G 0 part /
├─sda2 8:2 0 13.5G 0 part [SWAP]
├─sda3 8:3 0 500M 0 part
└─sda4 8:4 0 116.7G 0 part
sdb 8:16 0 119.2G 0 disk
└─sdb1 8:17 0 119.2G 0 part /home
sdc 8:32 0 2.7T 0 disk
└─sdc1 8:33 0 2.7T 0 part /data
- The data from my phone are written on sdc1
, the solely partition of an HDD.
- As you can see, sda
is where the root filesystem and the swap live (along with other partitions which are irrelevant here, sda3
and sda4
) while sdb
is dedicated to my home
directory.
Paradox
(1517 rep)
Apr 5, 2019, 02:09 PM
• Last activity: Jan 27, 2025, 08:12 PM
6
votes
2
answers
7542
views
Input/output error using jmtpfs not saving file when copying to device
I'm trying to mount an Android device on Debian using: jmtpfs /media/mobile But when I try to copy a file from my system to the device I get an input/output error saying that the file can't be closed. Am I missing some parameter or something to enable the transfer?
I'm trying to mount an Android device on Debian using:
jmtpfs /media/mobile
But when I try to copy a file from my system to the device I get an input/output error saying that the file can't be closed.
Am I missing some parameter or something to enable the transfer?
Julio Marins
(161 rep)
Jun 28, 2014, 04:18 PM
• Last activity: Jan 19, 2025, 07:51 PM
0
votes
1
answers
54
views
Mounting camera using jmtpfs within a udev rule
I am trying to use `jmtpfs` to mount my GoPro to transfer files when I plug it into my computer. I have a script that works outside a udev rule. However, when run inside the udev rule the script fails and disconnects my USB device. A minimal working example is given here: **script** ```shell #!/usr/...
I am trying to use
jmtpfs
to mount my GoPro to transfer files when I plug it into my computer.
I have a script that works outside a udev rule. However, when run inside the udev rule the script fails and disconnects my USB device.
A minimal working example is given here:
**script**
#!/usr/bin/env bash
jmtpfs /media/GoPro > /tmp/gopro.log 2> /tmp/gopro.err
**udev rule**
SUBSYSTEM=="usb", ATTR{idVendor}=="2672", ATTR{idProduct}=="004b", ACTION=="add", RUN+="/bin/bash -c /home/matt/Projects/GoProScraping/scripts/grab_go_pro_files.sh"
---
The output of the file /tmp/gopro.err
is:
Device 0 (VID=2672 and PID=004b) is UNKNOWN in libmtp v1.1.19.
Please report this VID/PID and the device model to the libmtp development team
fusermount: mount failed: Operation not permitted
The output of journalctl -f
is:
Sep 29 09:45:31 nina kernel: usb 1-4: new high-speed USB device number 16 using xhci_hcd
Sep 29 09:45:31 nina kernel: usb 1-4: New USB device found, idVendor=2672, idProduct=004b, bcdDevice= 0.01
Sep 29 09:45:31 nina kernel: usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Sep 29 09:45:31 nina kernel: usb 1-4: Product: GoPro MAX
Sep 29 09:45:31 nina kernel: usb 1-4: Manufacturer: GoPro
Sep 29 09:45:31 nina kernel: usb 1-4: SerialNumber: C3351325091705
Sep 29 09:45:31 nina sudo: root : PWD=/ ; USER=root ; COMMAND=/usr/bin/jmtpfs /media/GoPro
Sep 29 09:45:31 nina sudo: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Sep 29 09:45:34 nina sudo: pam_unix(sudo:session): session closed for user root
Sep 29 09:45:34 nina kernel: usb 1-4: USB disconnect, device number 16
Sep 29 09:45:34 nina systemd-udevd: 1-4: Process '/bin/bash -c /home/matt/Projects/GoProScraping/scripts/grab_go_pro_files.sh' failed with exit code 1.
It looks like I plug the GoPro in, udev picks up that it's connected, then there's a permission error and the error causes the USB to be disconnected and then udev picks it up again.
However, if I try running the command: jmtpfs /media/GoPro
as the root user it mounts well and I can access files manually.
I thought udev rules run as root, what am I missing?
Matt Ellis
(3 rep)
Sep 29, 2024, 09:51 AM
• Last activity: Sep 29, 2024, 02:04 PM
0
votes
1
answers
389
views
How to emulate usb-mtp device with virt-manager?
I am trying to emulate an mtp device with virt-manager. I see at https://qemu-project.gitlab.io/qemu/system/devices/usb.html that usb-mtp,rootdir=dir as in -device usb-mtp,rootdir=dir could be used to do this with qemu. How can I configure virt-manager to do this (custom xml welcome)?
I am trying to emulate an mtp device with virt-manager. I see at https://qemu-project.gitlab.io/qemu/system/devices/usb.html that usb-mtp,rootdir=dir as in -device usb-mtp,rootdir=dir could be used to do this with qemu. How can I configure virt-manager to do this (custom xml welcome)?
Yetoo
(3 rep)
Jun 26, 2022, 12:01 PM
• Last activity: Jan 3, 2024, 09:18 AM
0
votes
1
answers
4819
views
Android Studio: Running application in emulator not working
Yesterday I downloaded Android Studio for my Debian Testing system. I wanted to run a HelloWorld application (just a blank activity) but weren't able to run it. With adb I can install it without having any problems. However, if I try to do it with Android Studio, it gets stuck on 'Installing APKs'....
Yesterday I downloaded Android Studio for my Debian Testing system. I wanted to run a HelloWorld application (just a blank activity) but weren't able to run it. With adb I can install it without having any problems.
However, if I try to do it with Android Studio, it gets stuck on 'Installing APKs'. The same happens when I try to start it in an emulator (gets stuck on 'Waiting for target device to come online').
My device is a Samsung Galaxy S3 with LineageOS (Android 7.1.2) and root permissions. Android Studio recognizes my phone properly.
What I've already done:
- installed with openjdk
- installed with oracle jdk
- set android_home
- installed all the SDK-platforms since Android 4.3 and Android
Emulator from SDK tool
- installed everything from SDK tool
- enabled USB-debugging
- tried with MTP and PTP
- tried another emulated phone
- installed lib32stdc++6
- restarted my computer
- created new blank activity
- reinstalled everything: JDK, Android SDK and Android Studio
- and probably much more
I do not get any error.
Today I managed to have the emulator start by setting graphics to software but it just shows a black screen and doesn't power on.
I tried to do it until now and couldn't find a solution. I have never experienced anything close to this on other systems.
I really would like to get it running on Debian because I do not want to install Windows for this. I remember that I was able to run it on LMDE2 some time ago. So why doesn't it work on Debian Testing now? Did I forget something?
Thank you in advance.
**EDIT:** I am now able to use my phone to run the android application by using USB 2.0 instead of USB 3.0! Is that a normal behavior since it works with native adb? I mean, if I buy a new PC after some years which has got only USB 3.0 ports, will I not be able to use phone debugging with Android Studio or is this just an issue? It is still known since 2014 (https://stackoverflow.com/a/9548311/8292104) .
However, I still cannot get the app running on an ADV. I changed graphics to software, now it shows the phone but the screen remains black and the phone won't start. What can I do to fix it?
tavkomann
(103 rep)
Jul 12, 2017, 04:45 PM
• Last activity: Dec 21, 2023, 05:37 PM
6
votes
2
answers
8278
views
Mount Samsung Galaxy S7 using simple-mtpfs
I would like to mount my Samsung Galaxy **S7** to an folder using **simple-mtpfs** and I cannot do it as I used to (on previous Fedora and older Galaxy S4). If I simply plug S7 to my computer, I can browse it using Nautilius, but I cannot access it in terminal as ordinary folder, what is exactly wha...
I would like to mount my Samsung Galaxy **S7** to an folder using **simple-mtpfs** and I cannot do it as I used to (on previous Fedora and older Galaxy S4).
If I simply plug S7 to my computer, I can browse it using Nautilius, but I cannot access it in terminal as ordinary folder, what is exactly what I want to achieve.
**Every time I plug S7 I check twice that it works in MTP mode, so that isn't the problem.**
In the past, I simply plugged S4 and typed:
simple-mtpfs /home/adam/S4
Now, I can perform it and even my phone ask me to confirm MTP choice, but the catalogue S7 is still empty.
I also tried to mount it as root or ordinary user and by device number, but with no result.
# simple-mtpfs --list-devices
1: SamsungGalaxy models (MTP)
$ simple-mtpfs --device 1 /home/adam/S7
# simple-mtpfs --device 1 /media/s7
$ simple-mtpfs /dev/libmtp-3-1 /home/adam/s7
# simple-mtpfs /dev/libmtp-3-1 /media/s7
I even tried to do it by udev rules:
# dmesg | tail
[16821.258485] usb 3-1: Product: SAMSUNG_Android
[16821.258487] usb 3-1: Manufacturer: SAMSUNG
[16821.258489] usb 3-1: SerialNumber: 98867?????????????
[16827.556099] usb 3-1: USB disconnect, device number 29
[16830.383366] usb 3-1: new high-speed USB device number 30 using xhci_hcd
[16830.548882] usb 3-1: New USB device found, idVendor=04e8, idProduct=6860
[16830.548887] usb 3-1: New USB device strings: Mfr=2, Product=3, SerialNumber=4
[16830.548903] usb 3-1: Product: SAMSUNG_Android
[16830.548905] usb 3-1: Manufacturer: SAMSUNG
[16830.548907] usb 3-1: SerialNumber: 98867?????????????
# touch /etc/udev/rules.d/10-phone.rules
Content of */etc/udev/rules.d/10-phone.rules* is set to:
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}="6860", SYMLINK="S7"
After reloading rules I have */dev/S7* and I've tried to mount it:
# udevadm control --reload-rules
# ls -l /dev/S7
lrwxrwxrwx. 1 root root 15 10-20 15:03 /dev/S7 -> bus/usb/003/075
# ls -l /dev/libmtp-3-1
lrwxrwxrwx. 1 root root 15 10-20 15:03 /dev/libmtp-3-1 -> bus/usb/003/075
# simple-mtpfs /dev/S7 /media/s7
**And still without any result. Mounting doesn't give and errors, but the directory where I about to mount is still empty.**
The details about my setup:
# uname -r
4.7.7-200.fc24.x86_64
# rpm -qa | grep mtp
simple-mtpfs-0.2-6.fc24.x86_64
libmtp-1.1.11-1.fc24.x86_64
gvfs-mtp-1.28.3-1.fc24.x86_64
# rpm -qa | grep fuse
fuse-libs-2.9.7-1.fc24.x86_64
glusterfs-fuse-3.8.4-1.fc24.x86_64
fuse-2.9.7-1.fc24.x86_64
gvfs-fuse-1.28.3-1.fc24.x86_64
----
**Extract from system log (Fedora's journalctl) after plugging the phone and typing *simple-mtpfs /media/s7* :**
# journalctl -n 53
-- Logs begin at śro 2016-10-19 21:29:20 CEST, end at sob 2016-10-22 09:26:43 CEST. --
paź 22 09:24:31 PRZEDNICZEK01 kernel: usb 3-1: USB disconnect, device number 10
paź 22 09:24:31 PRZEDNICZEK01 PackageKit: get-updates transaction /384_eccedcee from uid 1000 finished with success after 45ms
paź 22 09:24:32 PRZEDNICZEK01 kernel: usb 3-1: new high-speed USB device number 11 using xhci_hcd
paź 22 09:24:32 PRZEDNICZEK01 kernel: usb 3-1: New USB device found, idVendor=04e8, idProduct=6860
paź 22 09:24:32 PRZEDNICZEK01 kernel: usb 3-1: New USB device strings: Mfr=2, Product=3, SerialNumber=4
paź 22 09:24:32 PRZEDNICZEK01 kernel: usb 3-1: Product: SAMSUNG_Android
paź 22 09:24:32 PRZEDNICZEK01 kernel: usb 3-1: Manufacturer: SAMSUNG
paź 22 09:24:32 PRZEDNICZEK01 kernel: usb 3-1: SerialNumber: 98867?????????????
paź 22 09:24:32 PRZEDNICZEK01 gvfsd: PTP: reading event an error 0x02ff occurredDevice 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP).
paź 22 09:24:32 PRZEDNICZEK01 gvfsd: LIBMTP ERROR: couldnt parse extension samsung.com/devicestatus:0
paź 22 09:24:32 PRZEDNICZEK01 tracker-miner-fs.desktop: (tracker-miner-fs:2001): Tracker-WARNING **: Could not find parent node for URI:'mtp://[usb:003,011]/'
paź 22 09:24:32 PRZEDNICZEK01 tracker-miner-fs.desktop: (tracker-miner-fs:2001): Tracker-WARNING **: NOTE: URI theme may be outside scheme expected, for example, expecting 'file://' when given 'http://' prefix.
paź 22 09:24:32 PRZEDNICZEK01 tracker-miner-fs.desktop: (tracker-miner-fs:2001): Tracker-WARNING **: Could not find parent node for URI:'mtp://[usb:003,011]/'
paź 22 09:24:32 PRZEDNICZEK01 tracker-miner-fs.desktop: (tracker-miner-fs:2001): Tracker-WARNING **: NOTE: URI theme may be outside scheme expected, for example, expecting 'file://' when given 'http://' prefix.
paź 22 09:24:32 PRZEDNICZEK01 tracker-miner-fs.desktop: (tracker-miner-fs:2001): Tracker-CRITICAL **: Could not set mount point in database 'urn:nepomuk:datasource:5e7b19a6b9795726a5c47a99a89757bf', GDBus.Error:org.freedesktop.Tracker1.SparqlError.Internal: UNIQUE constraint
paź 22 09:24:32 PRZEDNICZEK01 tracker-miner-fs.desktop: (tracker-miner-fs:2001): Tracker-CRITICAL **: Could not set mount point in database 'urn:nepomuk:datasource:5c7e6bb78b9a6691c3ecea3925b2971d', GDBus.Error:org.freedesktop.Tracker1.SparqlError.Internal: UNIQUE constraint
paź 22 09:24:34 PRZEDNICZEK01 org.gnome.Shell.desktop: (gnome-shell:1832): Gjs-WARNING **: JS ERROR: TypeError: is null
paź 22 09:24:34 PRZEDNICZEK01 org.gnome.Shell.desktop: ContentTypeDiscoverer<._onContentTypeGuessed/<@resource:///org/gnome/shell/ui/components/autorunManager.js:133
paź 22 09:24:34 PRZEDNICZEK01 org.gnome.Shell.desktop: _proxyInvoker/asyncCallback@resource:///org/gnome/gjs/modules/overrides/Gio.js:86
paź 22 09:24:34 PRZEDNICZEK01 gvfsd: ** (process:3243): WARNING **: send_infos_cb: No such interface 'org.gtk.vfs.Enumerator' on object at path /org/gtk/vfs/client/enumerator/18 (g-dbus-error-quark, 19)
paź 22 09:24:34 PRZEDNICZEK01 gvfsd: ** (process:3243): WARNING **: send_infos_cb: No such interface 'org.gtk.vfs.Enumerator' on object at path /org/gtk/vfs/client/enumerator/18 (g-dbus-error-quark, 19)
paź 22 09:24:34 PRZEDNICZEK01 gvfsd: ** (process:3243): WARNING **: send_infos_cb: No such interface 'org.gtk.vfs.Enumerator' on object at path /org/gtk/vfs/client/enumerator/18 (g-dbus-error-quark, 19)
paź 22 09:24:34 PRZEDNICZEK01 gvfsd: ** (process:3243): WARNING **: send_done_cb: No such interface 'org.gtk.vfs.Enumerator' on object at path /org/gtk/vfs/client/enumerator/18 (g-dbus-error-quark, 19)
paź 22 09:24:35 PRZEDNICZEK01 PackageKit: get-updates transaction /385_decdbbba from uid 1000 finished with success after 45ms
paź 22 09:26:37 PRZEDNICZEK01 kernel: usb 3-1: usbfs: process 3385 (simple-mtpfs) did not claim interface 0 before use
paź 22 09:26:37 PRZEDNICZEK01 kernel: usb 3-1: reset high-speed USB device number 11 using xhci_hcd
paź 22 09:26:38 PRZEDNICZEK01 kernel: usb 3-1: usbfs: process 3385 (simple-mtpfs) did not claim interface 0 before use
paź 22 09:26:38 PRZEDNICZEK01 kernel: usb 3-1: usbfs: process 3250 (events) did not claim interface 0 before use
paź 22 09:26:40 PRZEDNICZEK01 kernel: usb 3-1: USB disconnect, device number 11
paź 22 09:26:40 PRZEDNICZEK01 kernel: usb 3-1: new high-speed USB device number 12 using xhci_hcd
paź 22 09:26:40 PRZEDNICZEK01 kernel: usb 3-1: New USB device found, idVendor=04e8, idProduct=6860
paź 22 09:26:40 PRZEDNICZEK01 kernel: usb 3-1: New USB device strings: Mfr=2, Product=3, SerialNumber=4
paź 22 09:26:40 PRZEDNICZEK01 kernel: usb 3-1: Product: SAMSUNG_Android
paź 22 09:26:40 PRZEDNICZEK01 kernel: usb 3-1: Manufacturer: SAMSUNG
paź 22 09:26:40 PRZEDNICZEK01 kernel: usb 3-1: SerialNumber: 98867?????????????
paź 22 09:26:41 PRZEDNICZEK01 gvfsd: PTP: reading event an error 0x02ff occurredDevice 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP).
paź 22 09:26:41 PRZEDNICZEK01 gvfsd: LIBMTP ERROR: couldnt parse extension samsung.com/devicestatus:0
paź 22 09:26:41 PRZEDNICZEK01 tracker-miner-fs.desktop: (tracker-miner-fs:2001): Tracker-WARNING **: Could not find parent node for URI:'mtp://[usb:003,012]/'
paź 22 09:26:41 PRZEDNICZEK01 tracker-miner-fs.desktop: (tracker-miner-fs:2001): Tracker-WARNING **: NOTE: URI theme may be outside scheme expected, for example, expecting 'file://' when given 'http://' prefix.
paź 22 09:26:41 PRZEDNICZEK01 tracker-miner-fs.desktop: (tracker-miner-fs:2001): Tracker-WARNING **: Could not find parent node for URI:'mtp://[usb:003,012]/'
paź 22 09:26:41 PRZEDNICZEK01 tracker-miner-fs.desktop: (tracker-miner-fs:2001): Tracker-WARNING **: NOTE: URI theme may be outside scheme expected, for example, expecting 'file://' when given 'http://' prefix.
paź 22 09:26:41 PRZEDNICZEK01 tracker-miner-fs.desktop: (tracker-miner-fs:2001): Tracker-CRITICAL **: Could not set mount point in database 'urn:nepomuk:datasource:0e6a8582e05ac627e4014d1ca1e6ec87', GDBus.Error:org.freedesktop.Tracker1.SparqlError.Internal: UNIQUE constraint
paź 22 09:26:41 PRZEDNICZEK01 tracker-miner-fs.desktop: (tracker-miner-fs:2001): Tracker-CRITICAL **: Could not set mount point in database 'urn:nepomuk:datasource:5c7e6bb78b9a6691c3ecea3925b2971d', GDBus.Error:org.freedesktop.Tracker1.SparqlError.Internal: UNIQUE constraint
paź 22 09:26:41 PRZEDNICZEK01 dbus-daemon: [session uid=1000 pid=1760] Activating service name='org.gnome.Shell.HotplugSniffer' requested by ':1.16' (uid=1000 pid=1832 comm="/usr/bin/gnome-shell " label="unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023")
paź 22 09:26:41 PRZEDNICZEK01 dbus-daemon: [session uid=1000 pid=1760] Successfully activated service 'org.gnome.Shell.HotplugSniffer'
paź 22 09:26:42 PRZEDNICZEK01 org.gnome.Shell.desktop: (gnome-shell:1832): Gjs-WARNING **: JS ERROR: TypeError: is null
paź 22 09:26:42 PRZEDNICZEK01 org.gnome.Shell.desktop: ContentTypeDiscoverer<._onContentTypeGuessed/<@resource:///org/gnome/shell/ui/components/autorunManager.js:133
paź 22 09:26:42 PRZEDNICZEK01 org.gnome.Shell.desktop: _proxyInvoker/asyncCallback@resource:///org/gnome/gjs/modules/overrides/Gio.js:86
paź 22 09:26:43 PRZEDNICZEK01 gvfsd: ** (process:3399): WARNING **: send_infos_cb: No such interface 'org.gtk.vfs.Enumerator' on object at path /org/gtk/vfs/client/enumerator/17 (g-dbus-error-quark, 19)
paź 22 09:26:43 PRZEDNICZEK01 gvfsd: ** (process:3399): WARNING **: send_infos_cb: No such interface 'org.gtk.vfs.Enumerator' on object at path /org/gtk/vfs/client/enumerator/17 (g-dbus-error-quark, 19)
paź 22 09:26:43 PRZEDNICZEK01 gvfsd: ** (process:3399): WARNING **: send_infos_cb: No such interface 'org.gtk.vfs.Enumerator' on object at path /org/gtk/vfs/client/enumerator/17 (g-dbus-error-quark, 19)
paź 22 09:26:43 PRZEDNICZEK01 gvfsd: ** (process:3399): WARNING **: send_done_cb: No such interface 'org.gtk.vfs.Enumerator' on object at path /org/gtk/vfs/client/enumerator/17 (g-dbus-error-quark, 19)
paź 22 09:26:43 PRZEDNICZEK01 PackageKit: get-updates transaction /386_acdeddea from uid 1000 finished with success after 48ms
Adam Przedniczek
(198 rep)
Oct 20, 2016, 01:21 PM
• Last activity: Nov 5, 2023, 01:59 PM
2
votes
1
answers
2304
views
How to clone an MTPFS partition of a mounted Android phone?
Using `mtpfs` I've mounted a Samsung Galaxy S5 and I need to make an image of its root partition. I want to use `dd` or the like, but nothing seems to be able to detect/reference an MTP and/or FUSE partition, whether it be mounted or not. But there's no apparent way to do this. How do I reference an...
Using
mtpfs
I've mounted a Samsung Galaxy S5 and I need to make an image of its root partition. I want to use dd
or the like, but nothing seems to be able to detect/reference an MTP and/or FUSE partition, whether it be mounted or not. But there's no apparent way to do this.
How do I reference an mtpfs
partition to clone it, and create an image I can mount as ext2
for example? I am using Mint 17.1 and the device is a Lolipop Android OS.
Ultimately I need to run data recovery tools on the partition, so I need to copy the "empty" segments of the FAT more than the populated areas.
digitalextremist
(160 rep)
Jun 4, 2015, 01:38 AM
• Last activity: Oct 4, 2023, 06:24 AM
0
votes
1
answers
604
views
When copying files from Android to Linux via mtp datetime unadvertently changes by diffrence of mobile's and Linux time zones
Edit 2: Issue: Modification time of file as shown by `stat` in Linux for files copied from Android via usb is effected by changing of time zone setting on Android after file was created. Reperformance: 1. Boot Ubuntu 20.4 (or Linux Mint 21) from live USB. 2. On Android (I had version 11, also observ...
Edit 2:
Issue:
Modification time of file as shown by
stat
in Linux for files copied from Android via usb is effected by changing of time zone setting on Android after file was created.
Reperformance:
1. Boot Ubuntu 20.4 (or Linux Mint 21) from live USB.
2. On Android (I had version 11, also observed the effect for 9) set datetime and time zone to manual, put in offline mode.
3. Connect Android to Linux via usb.
4. Pick a file on Android, copy via file manager to location_1 on Linux.
5. Run stat
on copied file (one in location_1).
6. Disconnect usb (important).
7. Change time zone on Android by several hours.
8. Reconnect usb.
9. Copy same file from Android to location_2.
10. Run stat
on copied file (one in location_2).
11. Observe difference on line with Modify
of several hours.
**OP:**
There was a question asked in 2013 https://unix.stackexchange.com/questions/87762/how-do-i-transfer-files-between-android-and-linux-over-usb . Updated answer dated 2018 states that mtp works:
> it seems most Linux distros are now working with MTP fairly well. I
> know in my experience, Mint (Ubuntu based) works out of the box
Indeed I connect device via USB, click in Nemo (GUI) on an icon, storage mounts and I can transfer files in GUI.
However I just noted time zone matters. When I change time zone on a phone files modification times change. And copied to Linux, they remain with those times and Linux time zone (per stat
), regardless of device's time zone, so files' "original" (phone's) time zone correction info is just lost. IMO not a desired effect, albeit rarely manifested as usually devices in close physical proximity have same time zone set.
Does that effect is due to how mtp
works or it might depend on something else? Any advice how to copy with correct times w/out making sure both devices have same time zone set at the time of copying files? TIA
P.S. I think I want to report a bug, but not sure where: Mint, Ubuntu, Debian, kernel, else?
**Added example:**
A file on Android with time zone +1, Linux time zone +1
Android modification time as seen in both Android file manager and mtp mount in Linux Mint 21 based system in Nemo, say: 9:45:00.
After copy to ext4 fs stat
shows for Modify:
9:45:00.000000000 +0100
Change time zone on Android to +3 (maybe unmount/replug usb/remount just in case), copy same file to other location on ext4, stat
shows
11:45:00.000000000 +0100
Change time zone on Linux to +3. For second copy stat
shows:
13:45:00.000000000 +0300
*Note: when time zones are selected via GUI by city (I don't know other way in my Linux BTW) due to possibility of date savings results might differ even more or less by one hour.*
Alex Martian
(1287 rep)
Sep 21, 2023, 05:01 PM
• Last activity: Sep 27, 2023, 05:12 AM
7
votes
2
answers
22398
views
How do I resolve "The name was not provided by any .service files" when connecting Galaxy Tab A via USB?
I am running Debian Linux 11 with LXDE and I am trying to connect a Galaxy Tab A tablet. When I do, I get the Removable Medium Is Inserted dialog with the type of medium being "removable disk" and the only action available is "Open in File Manager". I click OK and I get an Error dialog box with the...
I am running Debian Linux 11 with LXDE and I am trying to connect a Galaxy Tab A tablet.
When I do, I get the Removable Medium Is Inserted dialog with the type of medium being "removable disk" and the only action available is "Open in File Manager". I click OK and I get an Error dialog box with the do-not-enter icon and the message
The name :1.31 was not provided by any .service files
It is always this message (with that specific number).
The file manager opens up to "mtp://SAMSUNG_SAMSUNG_Android_b269fabb" but it is always empty (there should be a Card directory and a Tablet directory).
What does the error message mean? Is Linux looking for a driver that is not installed? If so, which one and how do I install it?
Thanks.
Null Pointers etc.
(173 rep)
Sep 2, 2022, 04:45 AM
• Last activity: Jul 23, 2023, 11:16 PM
1
votes
0
answers
82
views
Can't list folder on USB connected drive but it's there!
When I run ``` ls /run/user/1000/gvfs/mtp:host=OPPO_SM6375-QRD__SN%3AD5F9F680_d5f9f680/ ``` The following is returned ``` 'Internal shared storage' 'SD card' ``` When I run ``` ls /run/user/1000/gvfs/mtp:host=OPPO_SM6375-QRD__SN%3AD5F9F680_d5f9f680/SD\ card/ ls /run/user/1000/gvfs/mtp:host=OPPO_SM63...
When I run
ls /run/user/1000/gvfs/mtp:host=OPPO_SM6375-QRD__SN%3AD5F9F680_d5f9f680/
The following is returned
'Internal shared storage' 'SD card'
When I run
ls /run/user/1000/gvfs/mtp:host=OPPO_SM6375-QRD__SN%3AD5F9F680_d5f9f680/SD\ card/
ls /run/user/1000/gvfs/mtp:host=OPPO_SM6375-QRD__SN%3AD5F9F680_d5f9f680/Internal\ shared\ storage/
I get the message **"No such file or directory"**.
I used to hit TAB to complete the path but it stops after
ls /run/user/1000/gvfs/mtp:host=OPPO_SM6375-QRD__SN%3AD5F9F680_d5f9f680/
If I run
ls /run/user/1000/gvfs/mtp:host=OPPO_SM6375-QRD__SN%3AD5F9F680_d5f9f680/*
the following is returned:
'/run/user/1000/gvfs/mtp:host=OPPO_SM6375-QRD__SN%3AD5F9F680_d5f9f680/Internal shared storage':
Alarms Audiobooks Documents Movies Notifications Pictures Recordings temp
Android DCIM Download Music oua_classifier Podcasts Ringtones
'/run/user/1000/gvfs/mtp:host=OPPO_SM6375-QRD__SN%3AD5F9F680_d5f9f680/SD card':
Alarms Audiobooks DCIM Download Music Pictures Recordings
Android data Documents Movies Notifications Podcasts Ringtones
So the two directories (Internal shared drive
and SD card
) are not empty.
This used to work until a few days ago. There have been Linux Mint updates but no phone update. I have a second phone with two similar directories and everything works on that phone when connected.
In the file explorer, nemo, I can navigate the directories. However, there is an oddity, which didn't exist when all was working. If I press the toolbar button *Toggle Location Entry*, the following appears.
For 'Internal shared storage':
mtp://OPPO_SM6375-QRD__SN%3AD5F9F680_d5f9f680/%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8F%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8F%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8F%E2%80%8E%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8EInternal%20shared%20storage%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8E
For 'SD card':
mtp://OPPO_SM6375-QRD__SN%3AD5F9F680_d5f9f680/%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8F%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8ESD%20card%E2%80%8E%E2%80%8F%E2%80%8E%E2%80%8E%E2%80%8F%E2%80%8E
When I saw the above, I tried putting the path in quotes:
ls "/run/user/1000/gvfs/mtp:host=OPPO_SM6375-QRD__SN%3AD5F9F680_d5f9f680/"
Then when I hit TAB after final forward slash, the two long folder names above (with all the %E%80, etc) were shown and the directories were listed!
This is made worse because I have a Python script that takes the full paths to the two directories as input (Internal shared storage
and SD card
) but now when trying to recurse them, the script fails. It doesn't see the directories. Again, this used to be fine.
Please can someone shed light on this and tell me what I've done to get into this state!
inxi
output:
CPU: dual core Intel Core i7-6500U (-MT MCP-) speed/min/max: 700/400/3100 MHz
Kernel: 6.2.6-060206-generic x86_64 Up: 20h 34m
Mem: 7048.4/15765.9 MiB (44.7%) Storage: 1.38 TiB (48.5% used) Procs: 347
Shell: Zsh inxi: 3.3.13
I tried updating the kernel (as seen above) to 6.x instead of the default 5.x for Linux Mint but both exhibit the same behaviour.
I also updated zsh
to the latest version, 5.9.
Praful
(11 rep)
Jun 6, 2023, 12:20 PM
• Last activity: Jun 6, 2023, 02:55 PM
3
votes
2
answers
5979
views
How to get mtp tools to mount my phone?
I've got Debian 8.5 running on top of Chrome OS, I plug in my Galaxy On5 and ChromeOS recognizes it instantly, Debian doesn't. I have mtp tools installed, and when I run mtp-detect I get the following output: Unable to open ~/.mtpz-data for reading, MTPZ disabled. libmtp version: 1.1.8 Listing raw d...
I've got Debian 8.5 running on top of Chrome OS, I plug in my Galaxy On5 and ChromeOS recognizes it instantly, Debian doesn't. I have mtp tools installed, and when I run mtp-detect I get the following output:
Unable to open ~/.mtpz-data for reading, MTPZ disabled.
libmtp version: 1.1.8
Listing raw device(s)
Device 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP).
Found 1 device(s):
Samsung: Galaxy models (MTP) (04e8:6860) @ bus 1, dev 10
Attempting to connect device(s)
ignoring libusb_claim_interface() = -6PTP_ERROR_IO: failed to open
session, trying again after resetting USB interface
LIBMTP libusb: Attempt to reset device
inep: usb_get_endpoint_status(): No such device
outep: usb_get_endpoint_status(): No such device
libusb_open() failed!: No such device
LIBMTP PANIC: Could not init USB on second attempt
Unable to open raw device 0
OK.
user1553838
(31 rep)
Sep 8, 2016, 06:10 AM
• Last activity: Apr 17, 2023, 11:27 AM
1
votes
1
answers
1442
views
Mount MTP devices using systemd
- **Linux**: build based on the [Thinstation 6.2][1] project (on systemd) - **Task**: automatic mounting of MTP devices (namely Android phones) when connected to a thin client - **Problem**: error loading the distribution when the device is connected or incorrect mounting of the device. - **Software...
- **Linux**: build based on the Thinstation 6.2 project (on systemd)
- **Task**: automatic mounting of MTP devices (namely Android phones) when connected to a thin client
- **Problem**: error loading the distribution when the device is connected or incorrect mounting of the device.
- **Software used when mounting**: simple-mtpfs , android-file-transfer-linux , android-udev-rules
## The first attempt
In rules 51-android.rules , I added the execution of the program in case I connect my phone to a thin client:
...
# Skip other vendor tests
LABEL="android_usb_rule_match"
RUN+="/etc/udev/scripts/mtp.sh"
...
My script /etc/udev/scripts/mtp.sh
that performed device mounting when connected:
#!/bin/sh
. /etc/thinstation.env
. $TS_GLOBAL
if [[ $ACTION == "add" ]]; then
echo "********************* START MOUNT *******************" | systemd-cat -p info -t "mtp"
/bin/aft-mtp-mount /phone
grep -oe "/phone" /proc/mounts | systemd-cat -p err -t "mtp"
ls "/phone/Внутренний общий накопитель" | systemd-cat -p err -t "mtp"
echo "********************** END MOUNT ********************" | systemd-cat -p info -t "mtp"
elif [[ $ACTION == "remove" ]]; then
echo "******************** START UNMOUNT ******************" | systemd-cat -p info -t "mtp"
umount /phone
echo "********************* END UNMOUNT *******************" | systemd-cat -p info -t "mtp"
fi
*P.S. I use the construction of recording logs as echo ...
, since the logger
from BusyBox does not write to the log on TS.*
I used a logging script to see why my device was NOT mounted. Or rather, it was mounted and after some time fell off, while it was not visible in the system as a mounted device.
Googling on the internet, I found information that systemd by default runs systemd-udevd.service with a separate "mount namespace".
## The second attempt
I rewrote the rules in 51-android.rules as follows:
...
# Skip other vendor tests
LABEL="android_usb_rule_match"
ACTION=="add", PROGRAM="/bin/aft-mtp-mount -p --template=mtp@.service $env{ID_MODEL}_$env{ID_VENDOR}", ENV{SYSTEMD_WANTS}+="%c"
...
and in /etc/systemd/system/mtp@.service
placed the following:
[Service]
Type=oneshot
ExecStart=/etc/udev/scripts/mtp.sh
Accordingly, I rewrote the script /etc/udev/scripts/mtp.sh
that would respond only to the add
event:
#!/bin/sh
. /etc/thinstation.env
. $TS_GLOBAL
/bin/aft-mtp-mount /phone
It is logical to assume that during testing I unmounted the directory myself, without a script. As a result, the phone was not always connected the first time. It feels like he had some kind of timeout for the connection limit of a few minutes. In the end, I never figured out what the problem was.
## The third attempt
My whole process of solving this problem is similar to something similar that is already available on stackoverflow . I tried to reproduce the solution from this post.
Corrected the 51-android.rules script in this way:
...
# Skip other vendor tests
LABEL="android_usb_rule_match"
ACTION=="add", RUN+="/bin/systemctl start mtp@$env{ID_VENDOR}_$env{ID_MODEL}_$env{ID_REVISION}.service"
ACTION=="remove", RUN+="/bin/systemctl stop mtp@$env{ID_VENDOR}_$env{ID_MODEL}_$env{ID_REVISION}.service"
...
and in /etc/systemd/system/mtp@.service
placed the following:
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/etc/udev/scripts/mtp.sh add %I
ExecStop=/etc/udev/scripts/mtp.sh remove %I
And the mount execution script /etc/udev/scripts/mtp.sh
:
#! /bin/sh
. /etc/thinstation.env
. $TS_GLOBAL
ACTION=$1
DEVICE_NAME=$2
MOUNT=/bin/aft-mtp-mount
CURRENT_DEVICE_MOUNT_PATH=$BASE_MOUNT_PATH/$USB_MOUNT_DIR/$DEVICE_NAME
_logger() {
echo "$2" | systemd-cat -p $1 -t "mtp"
}
_mounted() {
if [ -n "$(grep -oe "$1" /proc/mounts)" ]; then
return 0
else
return 1
fi
}
_mount() {
_logger info "mount $DEVICE_NAME"
if [ -d $CURRENT_DEVICE_MOUNT_PATH ] && _mounted $CURRENT_DEVICE_MOUNT_PATH; then
_logger warning "$DEVICE_NAME already mounted"
exit 1
fi
if [ ! -d $CURRENT_DEVICE_MOUNT_PATH ]; then
mkdir $CURRENT_DEVICE_MOUNT_PATH
if is_enabled "$USB_STORAGE_SYNC" && [ ! -n "$(echo $USB_MOUNT_OPTIONS | grep -e sync)" ]; then
USB_MOUNT_OPTIONS=$USB_MOUNT_OPTIONS,sync
fi
$MOUNT -o $USB_MOUNT_OPTIONS $CURRENT_DEVICE_MOUNT_PATH
if _mounted $CURRENT_DEVICE_MOUNT_PATH && [ "$(ls -A $CURRENT_DEVICE_MOUNT_PATH)" ]; then
_logger info "mounted $DEVICE_NAME in $CURRENT_DEVICE_MOUNT_PATH"
else
_logger warning "$DEVICE_NAME failed to mount"
_umount
exit 2
fi
else
_logger warning "$CURRENT_DEVICE_MOUNT_PATH already exists"
exit 3
fi
}
_umount() {
_logger info "unmount $DEVICE_NAME"
if [[ -d $CURRENT_DEVICE_MOUNT_PATH ]]; then
while _mounted $CURRENT_DEVICE_MOUNT_PATH; do
umount $CURRENT_DEVICE_MOUNT_PATH
done
_logger info "unmounted $DEVICE_NAME in $CURRENT_DEVICE_MOUNT_PATH"
rm -r $CURRENT_DEVICE_MOUNT_PATH
else
_logger warning "$DEVICE_NAME was not mounted"
fi
}
if [ $ACTION == "add" ]; then
_mount
elif [ $ACTION == "remove" ]; then
_umount
fi
exit 0
Now everything works as it was intended! But there is a nuance.
If the phone is initially attached to a thin client during its boot process, the system refuses to turn on. If the phone is disconnected during the boot process, then the thin client loads without problems and mounting also works after connection.
It seems that in the process of downloading a thin client, systemd-udevd
tries to read the 51-android.rules rules and call the phone mount script, which creates a further problem with loading.
I tried to pull out the download data and this is what I saw:
Systemd services loading schedule
Kernel log
I don't understand, maybe I implemented everything incorrectly, or there are some pitfalls. It seems that I tried to try different options. It would be possible to try to mount the device via systemd-mount
, but it does not support the MTP protocol to mount it. Or i can somehow implement it by other means? I have not found any additional information on this topic. I ask for help from those who know, since I have reached a dead end on the Arch forum. I have created themes on GitHub , but so far there is no progress either.
alexanderzhirov
(130 rep)
Jan 29, 2023, 03:51 PM
• Last activity: Jan 30, 2023, 08:53 AM
1
votes
2
answers
13793
views
How to mount USB device using jmtpfs on Linux (Debian 9)?
Device Information `Settings -> System -> About device` SAMSUNG-SM-G900R4, Android version 6.0.1 Computer System Information (Terminal command: `uname -a`) Linux debian 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u4 (2018-08-21) x86_64 GNU/Linux Mount USB device using jmtpfs jmtpfs /media/SAMSUNG-SM-G...
Device Information
Used different USB cables and tried various combinations of the following:
SAMSUNG-SM-G900R4
Unplug USB cable
Turn on Developer options:
Set USB options:
Restart device
Plug USB cable
Computer
Restart Computer
Mount device:
SAMSUNG-SM-G900R4
If message
Computer
Check if you can access device directory:
ERROR-0 is displayed, ERROR-1 is displayed, device directory is accessible with some frequencies.
Settings -> System -> About device
SAMSUNG-SM-G900R4, Android version 6.0.1
Computer System Information (Terminal command: uname -a
)
Linux debian 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u4 (2018-08-21) x86_64 GNU/Linux
Mount USB device using jmtpfs
jmtpfs /media/SAMSUNG-SM-G900R4
ERROR-0
Device 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP).
fuse: bad mount point `/media/vassil/SAMSUNG-SM-G900R4': Input/output error
ERROR-1
Device 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP).
LIBMTP PANIC: Could not open session! (Return code 8195)
Try to reset the device.
terminate called after throwing an instance of 'MtpErrorCantOpenDevice'
what(): Can't open device
Aborted
TESTSUsed different USB cables and tried various combinations of the following:
SAMSUNG-SM-G900R4
Unplug USB cable
Turn on Developer options:
Settings -> System -> About device -> tap "Build number" at least 7 times
Set USB options:
Settings -> System -> Developer options -> USB debugging: ON, USB configuration: MTP (Media Transfer Protocol)
Restart device
Plug USB cable
Computer
Restart Computer
Mount device:
jmtpfs /media/SAMSUNG-SM-G900R4
SAMSUNG-SM-G900R4
If message
Allow access to device data appears
, then Tap ALLOW
.Computer
Check if you can access device directory:
cd /media/SAMSUNG-SM-G900R4; ls
RESULTSERROR-0 is displayed, ERROR-1 is displayed, device directory is accessible with some frequencies.
Vassil
(61 rep)
Sep 4, 2018, 06:16 PM
• Last activity: Nov 30, 2022, 12:33 AM
12
votes
3
answers
15989
views
Accessing MTP mounted device in terminal
`cd: /run/user/$UID/gvfs/mtp://%5Busb%3A001,010%5D/` gives the error : cd: no such file or directory: /run/user/1000/gvfs/mtp://%5Busb%3A001,010%5D/ Even though the device is mounted in the file manager and shows the same mtp path I'd like to access it via terminal to able to copy data out of it as...
cd: /run/user/$UID/gvfs/mtp://%5Busb%3A001,010%5D/
gives the error :
cd: no such file or directory: /run/user/1000/gvfs/mtp://%5Busb%3A001,010%5D/
Even though the device is mounted in the file manager and shows the same mtp path
I'd like to access it via terminal to able to copy data out of it as the File Manager just hangs when done via the GUI.
Distribution : Fedora 28
DevX136
(121 rep)
Aug 25, 2018, 08:39 AM
• Last activity: Nov 3, 2022, 02:04 AM
2
votes
0
answers
2037
views
Where is my Android device mounted inside my Linux?
I am trying to run a bash script on certain folder inside an Android phone, mounted in my Fedora Linux box. I can see that the phone is there with `adb devices` (no, I do not want to use ADB for this!), I can see the phone folders using `dolphin`, I can even see that the phone is there with `mount`,...
I am trying to run a bash script on certain folder inside an Android phone, mounted in my Fedora Linux box. I can see that the phone is there with
adb devices
(no, I do not want to use ADB for this!), I can see the phone folders using dolphin
, I can even see that the phone is there with mount
, showing:
kio-fuse on /run/user/500/kio-fuse-JhdSvC type fuse.kio-fuse (rw,nosuid,nodev,relatime,user_id=500,group_id=500)
Yet, the folders /run/user/500/kio-fuse-JhdSvC
, /run/user/500/gvfs
, /run/user/500/gvfsd
and ~/.gvfs
are all empty, even when I see the folders in Dolphin.
I also tried to mount the phone as I used to, with the command simple-mtpfs -o allow_root -o enable-move /mnt/phone
, but I get:
LIBMTP PANIC: Trying to dump the error stack of a NULL device
So: how can I know in which folder in my filesystem the thing is mounted? Why is the folder /run/user/500/kio-fuse-JhdSvC
empty?
**EDIT**: Following this advice I am able to prevent KDE from automouting the Android Device as mtp. Yet, the popup in the phone to "Allow USB..." disappears as soon as it appears, so I cannot click on it.
Luis A. Florit
(509 rep)
Oct 15, 2022, 12:43 PM
• Last activity: Oct 15, 2022, 03:23 PM
1
votes
0
answers
246
views
Cannot connect my phone: `mtpfs` command and `modprobe fuse` command fail
I am trying to connect my phone in `Gentoo`. I have `mtpfs` installed and `FUSE` enabled in my kernel, `user_allow_other` set in `/etc/fuse.conf`. I ran `modprobe fuse` with and without `-fv` flags and it produces no output on the console. But my device is detected but when I ran `mtpfs /path/to/mou...
I am trying to connect my phone in
Gentoo
. I have mtpfs
installed and FUSE
enabled in my kernel, user_allow_other
set in /etc/fuse.conf
. I ran modprobe fuse
with and without -fv
flags and it produces no output on the console. But my device is detected but when I ran mtpfs /path/to/mount/my/phone
it just asks to run modprobe fuse
again. I tried restarting but it didn't help. USB debugging is enabled and I have File Transfer selected. I tried running directly as root (su
) with -o allow_other
### Specifications
OS: Gentoo Linux x86-64
Host: VirtualBox 1.2
Kernel: 5.10.76-gentoo-r1
DE: Plasma 5.22.5
WM: KWin
GPU: VirtualBox Graphics Adapter
[Note: Language for above specifications is given as Ruby
for the sole purpose of highlighting. It is obviously not Ruby
]
fusermount -V
gives the version as 2.9.9
### Error
mtpfs Devices/Android/
Listing raw device(s)
Device 0 (VID=2717 and PID=ff48) is a Xiaomi Mi-2s (MTP).
Found 1 device(s):
Xiaomi: Mi-2s (MTP) (2717:ff48) @ bus 1, dev 5
Attempting to connect device
Android device detected, assigning default bug flags
Listing File Information on Device with name:
fuse: device not found, try 'modprobe fuse' first
modprobe fuse
produces no output. I tried running this as root several times. But the same error is thrown again and again.
modprobe -V
gives the following
kmod version 29
-ZSTD +XZ +ZLIB -LIBCRYPTO -EXPERIMENTAL
Suzuna Minami
(141 rep)
Dec 4, 2021, 03:38 PM
2
votes
0
answers
411
views
Difficulty mounting broken android phone
My wife has/had a Sony Xperia which the screen smashed. It had a few months worth of photos of the kids on it, which I would very much like to recover, but I can't spend several hundred dollars sending it away for recovery. I seem to remember it had some issues charging prior to getting smashed whic...
My wife has/had a Sony Xperia which the screen smashed. It had a few months worth of photos of the kids on it, which I would very much like to recover, but I can't spend several hundred dollars sending it away for recovery.
I seem to remember it had some issues charging prior to getting smashed which makes me think it might be related to this. It shows up in thunar under Devices, as 'F8332', but it won't mount, I think it might drop in and out, so I hope it's not a hardware issue which will be a total road block. I can run
dmseg
if anyone is interested. I can see it when I run lsusb
and when I run $ adb shell
I get "error: no devices/emulators found".
At this point I should note, I am not a smartphone person and I have never run adb before this fiasco and didn't even know what mtp was. Further, when I run `mtp-detect' I get:
libmtp version: 1.1.16
Listing raw device(s)
Device 0 (VID=0fce and PID=01e7) is a SONY XPeria XZ MTP.
Found 1 device(s):
SONY: XPeria XZ MTP (0fce:01e7) @ bus 2, dev 4
Attempting to connect device(s)
PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
LIBMTP libusb: Attempt to reset device
LIBMTP PANIC: failed to open session on second attempt
Unable to open raw device 0
OK.
Thanks in advance!
Rob
1toneboy
(465 rep)
Oct 23, 2021, 05:21 AM
18
votes
7
answers
25214
views
Unable to perform file operations on a MTP device mounted via GVFS: "Operation not supported"
I am running Linux Mint 17.1 64-bit (based on Ubuntu 14.04). Ever since upgrading from Linux Mint 14/Ubuntu 12.10, the Python script I use to sync music to my Walkman has stopped working. Previously, when I mounted my Walkman, it would automatically show up as the path `/run/user/1000/gvfs/WALKMAN/S...
I am running Linux Mint 17.1 64-bit (based on Ubuntu 14.04). Ever since upgrading from Linux Mint 14/Ubuntu 12.10, the Python script I use to sync music to my Walkman has stopped working.
Previously, when I mounted my Walkman, it would automatically show up as the path
/run/user/1000/gvfs/WALKMAN/Storage Media
and would work like any other file system: I could copy tracks to it, delete tracks from it, etc, all through Python. However, I can't remember if I had to make any changes to get this to happen.
Since upgrading to Linux Mint 17 (and now 17.1), when I mount the Walkman, it shows up as the path /run/user/1000/gvfs/mtp:host=%5Busb%3A002%2C007%5D/Storage Media
. Furthermore, when I try to run the same file operations, they now fail. I have discovered that this happens not just through Python, but on the command line as well. For example:
david@MILTON:~$ cp '/data/Music/10SecsWhiteNoise.mp3' '/run/user/1000/gvfs/mtp:host=%5Busb%3A002%2C006%5D/Storage Media/MUSIC'
cp: cannot create regular file ‘/run/user/1000/gvfs/mtp:host=%5Busb%3A002%2C006%5D/Storage Media/MUSIC/10SecsWhiteNoise.mp3’: Operation not supported
I have done some research on this problem, but the most common explanation seems to be that it was formerly solved by this PPA: https://launchpad.net/~langdalepl/+archive/ubuntu/gvfs-mtp
But now, Ubuntu versions since 13.10 contain all these changes so it should no longer be necessary. So why am I still having these errors? I am still able to do file operations on my Walkman through a graphical file manager (Caja, on Linux Mint), just not via the command line.
David Pitchford
(191 rep)
Mar 28, 2015, 08:26 PM
• Last activity: Jul 23, 2021, 02:21 PM
1
votes
1
answers
894
views
File visible on Android device while copying via MTP, then disappears as soon as transfer completes...why?
Linux Mint 19.3 laptop copying a 400 MB file via MTP (in Caja) to an Android 7.0 tablet. While it's copying, the file is visible in the stock Files app on the tablet, and I can keep hitting the refresh button on the tablet to see the file size grow in sync with the progress meter on the laptop. As s...
Linux Mint 19.3 laptop copying a 400 MB file via MTP (in Caja) to an Android 7.0 tablet.
While it's copying, the file is visible in the stock Files app on the tablet, and I can keep hitting the refresh button on the tablet to see the file size grow in sync with the progress meter on the laptop.
As soon as it reaches 100%, it's still visible on the laptop, but disappears from the tablet upon the next refresh, never to be seen again. Even after unmounting and remounting, the tablet cannot see it, and the laptop still can. The laptop shows the proper file name, size, type, and location; however, it:
- Shows "unknown" for "size _on disk_" and "accessed" in the Properties dialog
- Shows a modified date of 31 Dec 1969
- Gives an generic i/o error trying to open the file
- Gives the error "Sorry, could not rename ...: libmtp error: could not set object string" if I try to rename it
I had heard that MTP support in Linux was pretty good nowadays. Before I try installing extra MTP packages and whatnot, am I missing something obvious?
Kev
(1759 rep)
Jan 9, 2021, 01:24 PM
• Last activity: Jan 10, 2021, 10:07 PM
Showing page 1 of 20 total questions