Given the following mount unit, which by itself is started via the
[Unit] Description=A mount [Mount] What=/dev/disk/by-uuid/BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB Where=/mnt/path Type=ext4 Options=defaults,ro,noauto,noatime,x-gvfs-hide [Install]
BBBBBB... device is a decrypted map.
Need to close it after the mount is stopped, yet the following yields no effect:
ExecStopPost=/usr/sbin/cryptsetup close /dev/disk/by-uuid/BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB
Which is understandable, as the directive is for a systemd's service, not mount units.
With that, what is the right way to run something (close a map in this case) upon a mount unit stop?