You are not logged in.

#1 2018-04-06 00:13:45

CarterCox
Member
From: Argentina
Registered: 2018-02-24
Posts: 116

[SOLVED]Mounting devices on plug

Hello! I've been researching this topic for a bit, and, since I use Thunar, I tried the "gvfs" and "gvfs-mtp" method. as described in the Wiki. This, however presents a problem. When mounting my Android device, it's not actually assigned a mountpoint (in /run or /mnt) and there is no way to transfer files between devices. I also tried the "udisks" method, but seems tedious to configure every device, and also there is no way to predict what you'll want to mount in the future.

So, to summarize:

  • Is there a simpler, more universal method?

  • What do the other major, "pre-configured" distributions (Ubuntu, Mint, Fedora, Manjaro) use?

Thanks for any assitance you can provide!!

Last edited by CarterCox (2018-04-07 00:04:54)


And neither the angels in Heaven above
   Nor the demons down under the sea
Can ever dissever my soul from the soul
   Of the beautiful Annabel Lee;

Offline

#2 2018-04-06 07:20:06

seth
Member
Registered: 2012-09-03
Posts: 50,957

Re: [SOLVED]Mounting devices on plug

simple-mtpfs (the only mtpfuckings implementation I found to work half wise reliably across all OS...) + a udisks rule? https://wiki.archlinux.org/index.php/Udisks

Offline

#3 2018-04-06 07:42:10

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,645

Re: [SOLVED]Mounting devices on plug

Pre-configured distributions use whatever their pre-configured DE uses/provides which is gvfs for most GNOME/GTK things and kio-mtp for KDE. 

What is the "udisks" method you are refering to? The whole point of udisks is that it will automatically correctly mount (block) devices (and is in fact, what gvfs will use for traditional mount points/harddisks), however MTP is a special case anyway. You do not actually have access to the hardware/filesystem like when you plug in a normal USB stick and any udisks configuration is irrelevant in that regard.

More universal methods than relying on the default gvfs behaviour are detailed in https://wiki.archlinux.org/index.php/MTP

However, MTP as a protocol is very limited and no implementation can lift these limits without breaking the spec. Depending on what you are intending to do utilising a network protocol might be much more fruitful.

However for the actual problem you are having did you see https://wiki.archlinux.org/index.php/Th … me_Manager ? In particularly starting thunar in daemon mode might be necessary for it to pick up the MTP device.

Offline

#4 2018-04-06 07:49:20

seth
Member
Registered: 2012-09-03
Posts: 50,957

Re: [SOLVED]Mounting devices on plug

The udisks method I would use™ is to wait for any USB change to run a script, "simple-mtpfs -l", check whether all listed devices are mounted and otherwise ("yeah, new crapphone") "simple-mtpfs /run/media/MTP/$LABEL -o allow_other --device $ID"
You'll still have to  "fusermount -u /run/media/MTP/$LABEL" before pulling the device (or better do to not brick the shit)

(In case it's not become utterly clear: I really hate MTP ;-)

Offline

#5 2018-04-06 07:55:50

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,645

Re: [SOLVED]Mounting devices on plug

Well that should™ be one of the promises of MTP that you can just unplug without an unmount, given the last transfer completed but yeah... I'm definitely with you on the MTP hate wagon.

Offline

#6 2018-04-06 08:03:40

seth
Member
Registered: 2012-09-03
Posts: 50,957

Re: [SOLVED]Mounting devices on plug

Yeah, "shouldland" - I've several times semi-bricked devices this way (ie. they required a reboot on their side in order to get MTP functional again, iirc sometimes even with file losses) - whether that's a problem of the device or the local mtp implementation, idk. I guess I also transferred files onto them, so that could be a factor.
Since I use simple-mtpfs and ensure to unmount the device, things went flaw-, albeit not painless.

Offline

#7 2018-04-06 16:31:00

CarterCox
Member
From: Argentina
Registered: 2018-02-24
Posts: 116

Re: [SOLVED]Mounting devices on plug

Actually I guess gvfs-mtp is the simples method. The mountpoint is a bit long, but it's nothing tab-completion can't solve.

About the daemon mode, that's actually not needed, or maybe it doesn't need to be enabled manually (via CLI I mean, maybe the GUI tool does it for you), because everything is mounted automatically without any configuration, other than the one the GUI provides.

Maybe this is happening because I added my user to the uucp group?


And neither the angels in Heaven above
   Nor the demons down under the sea
Can ever dissever my soul from the soul
   Of the beautiful Annabel Lee;

Offline

#8 2018-04-06 17:03:48

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,645

Re: [SOLVED]Mounting devices on plug

Huh? Didn't you say you couldn't mount it? Just because you don't control the name that gets used doesn't mean it's going to be inaccessible.

And this turns this question into an XY. If you never had an issue accessing the MTP  URL for what purpose do you seek to define a custom mount point? What is your end goal? Thunar should give you a shortcut no?

Last edited by V1del (2018-04-06 17:07:24)

Offline

#9 2018-04-07 00:04:37

CarterCox
Member
From: Argentina
Registered: 2018-02-24
Posts: 116

Re: [SOLVED]Mounting devices on plug

I didn't want to define a custom mount point. I wanted to have one. Before for some reason the device wasn't being mounted to an actual mount point, or at least that's what I though, since it didn't show up when I ran "lsblk". I guess it was mounted I opened a terminal in the location using Thunar and when running "pwd" there was actually a real directory. It just took me a while to realize. My bad.

I'll mark as solved.


And neither the angels in Heaven above
   Nor the demons down under the sea
Can ever dissever my soul from the soul
   Of the beautiful Annabel Lee;

Offline

#10 2018-04-07 01:43:33

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,645

Re: [SOLVED]Mounting devices on plug

So then it's a terminology confusion. The big deal as hinted at in my post is that you do not get access to the block device with MTP. For all intents and purposes, think of it as a network share.  lsblk will show you block devices, an MTP connected device is not a block device. You might want to read the wikipedia article on MTP or something on further interest.

Offline

#11 2018-04-07 01:57:54

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: [SOLVED]Mounting devices on plug

To get a list of all mountpoints, you can use the "mount" command or "findmnt" for a nicer listing.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#12 2018-04-07 03:36:28

CarterCox
Member
From: Argentina
Registered: 2018-02-24
Posts: 116

Re: [SOLVED]Mounting devices on plug

@V1del: I understand now. Re-reading your post I see what you mean. I was mostly just misusing lsblk. Thanks!

@progandy: findmnt seems very robust. Nice tool and thanks for the tip!


And neither the angels in Heaven above
   Nor the demons down under the sea
Can ever dissever my soul from the soul
   Of the beautiful Annabel Lee;

Offline

#13 2018-04-07 12:48:50

CarterCox
Member
From: Argentina
Registered: 2018-02-24
Posts: 116

Re: [SOLVED]Mounting devices on plug

Actually guys, a little update.

The drive I was using for testing was NTFS, so writing to it was not permitted, and I was blaming gvfs instead of the kernel. Everything is ok now.

This did turn out to be an XY problem.

One more thing though. The drive is mounted with owner and group for every file as my user, and permissions for every file are 777. Isn't that unsafe?


And neither the angels in Heaven above
   Nor the demons down under the sea
Can ever dissever my soul from the soul
   Of the beautiful Annabel Lee;

Offline

#14 2018-04-07 12:55:35

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,645

Re: [SOLVED]Mounting devices on plug

No that's the nature of NTFS these permissons are simply "created" on the fly to satisfy unix tools, they don't actually exist. You could adjust some udisks options to set certain flags specifically,  this is however out of scope for this thread, since this one did originally deal with Android and MTP

Offline

Board footer

Powered by FluxBB