How to prevent automatic mounting of USB device

5 replies [Last post]
Avron

I am a translator!

Offline
Joined: 08/18/2020

With dconf-editor, I tried setting the following to false:

org.mate.desktop.media-handling.automount
org.mate.desktop.media-handling.automount-open
org.gnome.desktop.media-handling.automount
org.gnome.desktop.media-handling.automount-open

Still, any USB drive is automatically mounted.

How to prevent that?

This is a huge problem because I want to clean a filesystem from a micro SD card. After it automounts, "umount" returns "Error finding object for block device 0:110" so I cannot unmount it. I am guessing this filesystem has a problem but automount prevents me from doing anything and may even be making the problem worse.

Magic Banana

I am a member!

I am a translator!

Offline
Joined: 07/24/2010

After it automounts, "umount" returns "Error finding object for block device 0:110" so I cannot unmount it.

And with the following command, where /dev/sdb1 is to be replaced by the actual partition?
$ udisksctl unmount --block-device /dev/sdb1

amenex
Offline
Joined: 01/03/2015

Magic Banana comes up with the most interesting & useful commands, such as udisksctl
for which I can find a brief man page, but which apt-get install cannot find, whether I request
udisksctl or just udisks. There's a disks package that I use frequently to capture
UUIDs. Are these mystery packages bundled with a larger package ? After looking at info udisks
I'm cautioning myself to be careful !
Several years ago I found a 5-1/4 inch floppy drive controller that connects through a USB port,
but its use requires setting up loop devices over & over as I progress through a pile of didks
written with an IBM PC/XT (which I still have ...). Hence, my interest in udisksctl.

jxself
Offline
Joined: 09/13/2010

Try: apt-file search udisksctl

amenex
Offline
Joined: 01/03/2015

Jxself set me off with his suggestion to tryapt-file search udisksctlbut I shortened that toapt-file search udiskswhich brought me a list of over 500 possibilities, which I cut down a little with
awk '{print $2}' apt-file-search-udisks-family-commands.txt | grep "\.html" | sed 's/\//\t/g'| awk '{print $6}' | sed 's/\.html//g' > apt-file-search-udisks-family-commands.html.txt(attached) which is a list of html files from which I picked the one pertaining to udisksctl which led full circle to this discussion:https://forum.artixlinux.org/index.php/topic,2811.15.html.

AttachmentSize
apt-file-search-udisks-family-commands.html_.txt 2.66 KB
Avron

I am a translator!

Offline
Joined: 08/18/2020

Thanks for the suggestion.

As I needed the system with the SD card to run, I did not wait for answers to physically remove it even though it was mounted and I used my laptop on which there is no automount (perhaps because I use fvwm only without mate) to check the SD card.

From the manual on udisksctl, I see there is this udisksd and it is running when I have a mate session. Automount is probably a useful feature but it would be nice to at least have an easy way to turn it off. I'll check it a bit more.

EDIT: When I log in via the usual greeter and I have selected fvwm instead of mate, udisksd is running and so is gvfsd (I looked at that because of the link indicated by amenex). So I don't know what programme does the automount after opening a mate session. Perhaps I could monitor dbus messages to find out but I need to understand dbus details first (unfortunately).