0

Given the following mount unit, which by itself is started via the SYSTEMD_WANTS in /etc/udev/rules.d/...:

[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]

That 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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.