I understand, that there are a lot of topics, however this is not still clear to me.

First of all, i have systemd service, script and udev rule which are run when USB-device connected. This works as expected.

Description=Backup garmin activities when Garmin 830 is connected


ACTION=="change", SUBSYSTEM=="block",
        ENV{ID_VENDOR_ID}=="091e", ENV{ID_MODEL_ID}=="2c32", ENV{ID_SERIAL}=="Garmin_GARMIN_Flash-0:0",

But what i don't really like, that mountpoints are hardcoded, for example "after" and "requires" lines in systemd service depends on my current user name. And i can not be sure that mountpoint will always exactly same in another Desktop Environment.

One of my ideas of solving this problem, are:

  1. Disable automounting in udev rule
  2. Create systemd mount service which will always mount on same location.

But maybe there is a more simple solution. Can you help me, please?

1 Answer 1


Create an /etc/fstab entry for the USB device (referencing it through LABEL= as you currently rely on its filesystem label anyway, or referencing it through /dev/disk/by-id or similar). When UDisks2 mounts a removable device it will use the fstab configuration over the default. (It will not, however, care about systemd .mount units at all.)

The /run/media paths are not DE-specific as far as the DE uses UDisks2 to perform privileged operations. It is possible to mark a device as "shared" for UDisks2 through an udev property as documented in udisks(8) – setting ENV{UDISKS_FILESYSTEM_SHARED} to 1 on the block device will cause UDisks2 to always mount it at /media/LABEL instead of a per-user path.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .