Re: Antw: [EXT] Re: successful mount starts a service - how?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 19/01/2021 07:50, Ulrich Windl wrote:
Andrei Borzenkov <arvidjaar@xxxxxxxxx> schrieb am 19.01.2021 um 06:30 in
Nachricht <3a365c71-004e-031e-4153-80c376d80838@xxxxxxxxx>:
19.01.2021 04:00, lejeczek пишет:
hi guys.

I'm fiddling with it but have run out of options/ideas.
What I would like to have is systemd starts a service when a device, in
my case a crypt-luks device, gets mounted which mount would happen by
manual 'cryptsetup open'
I am not aware that "cryptsetup open" mounts anything. I do not even see
any option to specify mount point in its invocation. Please show exact
command you are using that "mounts" encrypted container.
But it will make some device (/dev/mapper) to appear.
I'm on centos Stream with systemd 239 (239-43.el8)
OS after boot:
1)
-> $ systemctl status -l devs.mount
● devs.mount - /devs
   Loaded: loaded (/etc/fstab; generated)
   Active: inactive (dead)
    Where: /devs
     What: /dev/mapper/luks-devs
     Docs: man:fstab(5)
           man:systemd-fstab-generator(8)

Jan 19 10:24:45 swir.private.pawel systemd[1]: Dependency failed for /devs. Jan 19 10:24:45 swir.private.pawel systemd[1]: devs.mount: Job devs.mount/start failed with result 'dependency'.
2)
-> $ cryptsetup open /dev/mapper/cl_swir-devs luks-devs
3)
-> $ systemctl status -l devs.mount
● devs.mount - /devs
   Loaded: loaded (/etc/fstab; generated)
   Active: active (mounted) since Tue 2021-01-19 10:27:09 GMT; 48s ago
    Where: /devs
     What: /dev/mapper/luks-devs
...
In fstab:
/dev/mapper/luks-devs     /devs                   ext4 context="system_u:object_r:root_t:s0",nofail,noatime,nobarrier,noatime,x-systemd.device-timeout=3s 0 2

Crypt-luks device got mounted without me doing only no. 2. and which is fantastic. Here systemd wisdom does something which us users would do but as a result do not have to.

Now, how to "bind" a sevice to "that" so such a service would wait for and then auto start(but also stop when device is umounted)?
I've tried in such a service' unit a variations of these:

After=devs.mount
BindsTo=devs.mount
PartOf=devs.mount
RequiresMountsFor=/devs

But now I've run out of ideas.

many thanks, L

I see when that manual action takes place then systemd changes status of
a home.mount (which is in fstab) to "active" - and it's here where I
hope systemd would auto-start a service.
Is such a "simple" thing possible?
many thanks, L
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux