1

I'm trying to automount a USB device upon plugin but it refuses to mount. I set a rule to execute the following script :

#!/bin/bash
mkdir /media/mnt
echo AFTER MKDIR > /home/output
sleep 5
echo AFTER SLEEP >> /home/output
mount /dev/sdb1 /media/mnt
echo $? >> /home/output
echo AFTER MOUNT >> /home/output

The script gets executed nicely, lsblk shows that /dev/sdb1 is present, output contain all the echoes, yet sdb1 won't be mounted in /media/mnt. The mount command exit code is 0

When I execute the mount command in that script manually after the USB device is plugged in it mounts it without problem.

ChiseledAbs
  • 2,243

1 Answers1

2

Had to add MountFlags=shared in /usr/lib/systemd/system/systemd-udevd.service, whatever this is. See mount is not executed when called by udev

ChiseledAbs
  • 2,243