Mantas Mikulėnas wrote on 18/09/2021 09:41:
On Fri, Sep 17, 2021 at 2:40 PM lejeczek <peljasz@xxxxxxxxxxx
<mailto:peljasz@xxxxxxxxxxx>> wrote:
Hi guys.
I'm trying to have unit to start...
well,
I have a luks device which waits for manual passphrase
input, when that happens 'systemd' mounts, without user
intervention(which is great), that luks device.
fstab:
/dev/mapper/luks.devs /devs ext4
noatime,nobarrier,noatime,x-systemd.device-timeout=2,nofail 1 2
and now I'll have many units/services which depend on that
mount, because they need to get to paths to get their
configs & other bits.
Question - how do I make such a unit to re/start when
'systemd' does the mount? Naturally, ideally without any
ways external to 'systemd'.
If units need this mount, then *actually* make them depend on this mount
– as in, "Requires=devs.mount" and "After=devs.mount" in each service's
[Unit].
I agree this is correct, but I don't think it does what the user wants.
i.e. when the mount eventually happens (e.g. after all the jobs have
timed out and the user manually mounts it), the rest of the transaction
continues where it left off rather than just sitting their failed/unstarted.
I think there is possibly something you could do with a udev rule, a
custom target unit and PartOf= in the dependant services?
Or perhaps a path unit based on a file inside the mounted filesystem
which again triggers a target (again coupled with PartOf in the
dependant services).
HTHs
--
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/
Day Job:
Tribalogic Limited http://www.tribalogic.net/
Open Source:
Mageia Contributor http://www.mageia.org/
PulseAudio Hacker http://www.pulseaudio.org/
Trac Hacker http://trac.edgewall.org/