When my Android phone is mounted by jmtpfs, I can perform all these operations from within the file manager (caja) on my Devuan laptop without any problems:
- copy and paste files in either direction (phone <-> laptop)
- cut and paste files in either direction (phone <-> laptop)
- create new files on the phone
- delete files from the phone
- open and view files on the phone
However, jmtpfs mounts the phone in such a way that GUI applications such as pluma cannot modify files on the phone--I am able to start editing files that are on the phone, but I get an I/O error when I try to save the modified file. I did some duck-ducking and it seems this a known mtp limitation (https://askubuntu.com/questions/284762/ … why/421503).
Interestingly, gvfs (when it works) mounts my phone in such a way that pluma and other GUI applications can modify and save files on the phone. How does gvfs-mtp-volume-monitor magically work around an mtp limitation? I'd love to learn the trick so that I can implement it in my workaround. Anybody know?
]]>Here is my graybearded workaround:
1. sudo apt-get install jmtpfs
2. sudo chmod a-x /usr/lib/gvfs/gvfs-mtp-volume-monitor
3. Create /etc/udev/rules.d/80-mtp-mount.rules with this in it:
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", RUN+="/bin/su bruno -c /opt/scripts/mtp-mount"
4. Create /opt/scripts/mtp-mount with this in it, then make it executable:
#!/bin/sh
# mount the device
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/scripts
export DISPLAY=:0.0
mkdir $HOME/Phone && jmtpfs $HOME/Phone && caja $HOME/Phone
# create a .desktop file to unmount the device
desktop_file=$HOME/Desktop/Phone-unmounter.desktop
cat << EOF > $desktop_file
[Desktop Entry]
Comment=Phone Unmounter
Exec=sh -c "fusermount -u ~/Phone; rm -r ~/Phone; rm $desktop_file"
Icon=media-eject
Terminal=false
Type=Application
Name[en_US]=Eject Phone
EOF
sleep 0.5 # to make sure .desktop exists
sudo chmod a+x $desktop_file
The above is as reliable as a faithful old dog, with never any surprises.
Folks experiencing flaky mounting of their Android phones (or other mtp device) can recycle the above workaround with only minimal modifications:
- change "bruno" to your username in the udev rule
- change the idVendor attribute in the udev rule to match your device's manufacturer
I tried re-installing all packages with gvfs in the name. Also, in caja's media preferences I unchecked "Browse media when inserted" and checked "Never prompt or start programs on media insertion". Still, two desktop icons show up on the desktop when the phone is connected--the only difference now is that two caja windows do not automatically pop up when I plug in the phone.
Therefore, the issue here is not that caja is detecting the device twice: gvfs is the one that's detecting the device twice. Alas, I think I have the right diagnosis but still have no clue regarding the proper treatment.
]]>I have an old Arch Linux machine I've kept updated. Will try plugging into that and will update this thread with result.
]]>a) A process called /usr/lib/gvfs/gvfs-mtp-volume-monitor is normally running in the background
b) If I kill the above process, my phone gets mounted/shown 0 times when I plug it in
c) If I then run /usr/lib/gvfs/gvfs-mtp-volume-monitor in the background again--or if I reboot--then we're back to "normal" behavior where my phone gets mounted/shown 2 times when I plug it in
I'm after the Goldilocks behavior where my phone gets mounted/shown 1 time when it is plugged in. I'm not sure what to try next.
]]>Regarding the current issue, it does not affect thumbdrives and external hard drives, only my phone (which is unique in that it's my only mtp device).
]]>https://dev1galaxy.org/viewtopic.php?id=1910
Have you duplicated a config file somewhere? Maybe fire up a vm and if it doesn't duplicate icons, start comparing directories/files
]]>The last little thing I'd like to fix is this issue: When I plug in my android phone (an MTP device), the system mounts/shows it twice. See screenshot of my desktop:
These are the gvfs packages installed:
bruno@thinkpad:~$ dpkg -l | grep gvfs
ii gvfs:amd64 1.30.4-1 amd64 userspace virtual filesystem - GIO module
ii gvfs-backends 1.30.4-1 amd64 userspace virtual filesystem - backends
ii gvfs-bin 1.30.4-1 amd64 userspace virtual filesystem - binaries
ii gvfs-common 1.30.4-1 all userspace virtual filesystem - common data files
ii gvfs-daemons 1.30.4-1 amd64 userspace virtual filesystem - servers
ii gvfs-libs:amd64 1.30.4-1 amd64 userspace virtual filesystem - private libraries
I'd like to fix this so that the phone is mounted only once, but I have no idea how to do it. Can someone please point me in the right direction?
]]>