Antw: Re: Re: Antw: Re: Re: [EXT] Re: Q: Querying units for "what provides" a target

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

 



>>> Michael Biebl <mbiebl@xxxxxxxxx> schrieb am 09.09.2022 um 14:15 in Nachricht
<CAGWsdOgRf7UFw9h8wFu4+TZjQQ_UA8EWf4OUjXEfiSgOTCpbcg@xxxxxxxxxxxxxx>:
> Am Fr., 9. Sept. 2022 um 14:12 Uhr schrieb Michael Biebl <mbiebl@xxxxxxxxx>:
>>
>> Am Fr., 9. Sept. 2022 um 14:01 Uhr schrieb Ulrich Windl
>> <Ulrich.Windl@xxxxxxxxxxxxxxxxxxxx>:
>> >
>> > >>> Andrei Borzenkov <arvidjaar@xxxxxxxxx> schrieb am 09.09.2022 um 13:41 in
>> > Nachricht
>> > <CAA91j0VQADw8g5mmoFUOvy=YLF666Z_Y9uqYDgTfnmhSBne3rw@xxxxxxxxxxxxxx>:
>> > > On Fri, Sep 9, 2022 at 2:13 PM Ulrich Windl
>> > > <Ulrich.Windl@xxxxxxxxxxxxxxxxxxxx> wrote:
>> > > ...
>> > >> >
>> > >> > If you are interested in services that pull in e.g. time-sync.target
>> > >> > via Wants (or Requires) and order themselves before the target, you
>> > >> > can use something like
>> > >> > $ systemctl show time-sync.target -p WantedBy -p RequiredBy -p After
>> > >> > RequiredBy=
>> > >> > WantedBy=chrony.service
>> > >> > After=chrony.service time-set.target
>> > >>
>> > >> It seems what I wanted to know is output by
>> > >> # systemctl show -p After time-set.target
>> > >> After=systemd-timesyncd.service
>> > >> # systemctl show -p After time-sync.target
>> > >> After=time-set.target ntp-wait.service
>> > >>
>> > >> However the "After=" is somewhat unexpected.
>> > >
>> > > This is exactly what targets are about. The only usage for targets is
>> > > to wait until something else becomes active and to do it they must
>> > > come After something.
>> > >
>> > >> And "-p WantedBy" is definitely
>> > >> wrong (it will output units that "require the target", not the units
>> > > "providing
>> > >> the target").
>> > >>
>> > >
>> > > There is no such thing as "units providing the target". Systemd
>> > > documentation makes distinction between targets that Want other units
>> > > ("active") and targets that are WantedBy other units ("passive"). It
>> > > is expected that services "providing" passive targets have
>> > > WantedBy=this-passive.target, otherwise passive targets will not be
>> > > activated at all. So WantedBy is exactly correct in this case.
>> >
>> > Hi!
>> >
>> > But when I include it (as suggested) I get:
>> > # systemctl show  -p WantedBy -p RequiredBy -p After time-sync.target
>> > RequiredBy=
>> > WantedBy=iotwatch@ROOT.service iotwatch@VPM.service 
> iotwatch-generator.service ntp-wait.service systemd-timesyncd.service
>> > After=time-set.target ntp-wait.service
>> > ---
>> >
>> > Those iotwatch* units use "Before="; so is the WantedBy= incorrect for 
> those?
>> >
>> > Those units use:
>> > Wants=nss-user-lookup.target time-sync.target paths.target
>> > After=nss-user-lookup.target time-sync.target paths.target
>>
>>
>> See man systemd.special, passive and active targets (as Andrei already
>> hinted at).
>> Quoting the relevant parts
>> "   Special Passive System Units
>>        A number of special system targets are defined that can be used
>> to properly order boot-up of optional services. These targets are
>> generally not part of the initial boot transaction, unless they are
>> explicitly pulled in by one of the implementing
>>        services. Note specifically that these passive target units are
>> generally not pulled in by the consumer of a service, but by the
>> provider of the service.
>> "
>>  iotwatch* does appear to be a consumer of the time-sync.target, so it
>> should merely have an ordering but not pull in the target.
> 
> Quoting the rest of the man page section:
> "
> This means: a consuming service should order itself after these
> targets (as appropriate), but not
>  pull it in. A providing service should order itself before these
> targets (as appropriate) and pull it in (via a Wants= type
> dependency).
> "

Thanks for the explanation! For me part of the problem is: Where is "pull in" defined? ;-)
The phrase is used for Wants, but also for Requires. So is "pull in " a synonym for "wants or requires"?
(IMHO the first part is an "action", while the last part is a "desire", hard to treat them as synonyms ;-))

Regards,
Ulrich





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

  Powered by Linux