Re: Q: handling generator-like dependency: target won't start on boot

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

 



On 28.09.2022 09:25, Ulrich Windl wrote:
> Hi!
> 
> I'm trying to establish a mechanism that uses a generator-like mechanism as described below. Unfortunately it starts when triggering the target manually, but it never starts on system boot. I could need some advice how to make it work.
> 
> Basically I have a generator-like unit, say "g.servive", that creates other instance-like services like i@.service.
> Finally I have a target, say "t.target", that wants (among others) those instance-like services and is wanted by default.target.
> 
> As said in the beginning: When booting the target does not start (and I don't see any errors logged), but when I "systemctl start t.target", everything starts up fine.
> 
> More details:
> 
> generator-like services:
> WantedBy default.target and t.target, and it "Wants=nss-user-lookup.target time-sync.target  paths.target" (the Before= list is identical). In addition it has "Before=default.target t.target".
> It starts a "oneshot" script that creates the instance-like services with RemainAfterExit=true.
> 
> instance-like services:
> PartOf=t.target, Requires generator-like.service (also After that service). In addition it "Wants=nss-user-lookup.target time-sync.target paths.target" (After= uses the same list). The service is Type=forking, and the unit is WantedBy=t.target
> 
> The script used in the generator-like service creates the unit files in /run/systemd/system, and it runs "/usr/bin/systemctl daemon-reload" whenever a unit file had been created or changed.
> 

daemon-reload does not re-evaluate initial "transaction" and your new
units are not used because they did not exist when this transaction was
computed.

So the only way to squeeze it into your scheme is to manually start
newly created units.

> Could be problem be a race-condition, caused by daemon-reload being run asynchronously, i.e.: The generator-like service unit ends while the actual daemon-reload is still in progress?
> 
> systemd version is from SLES12 SP5 (systemd-228-157.40.1.x86_64).
> 
> Regards,
> Ulrich
> 
> 
> 




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

  Powered by Linux