Re: [systemd-devel] sysv-generator weirdness for shutdown runlevels

2016-05-26 Thread Lennart Poettering
On Thu, 26.05.16 08:13, Francis Moreau (francis.m...@gmail.com) wrote:

> On Wed, May 25, 2016 at 11:10 PM, Michael Biebl  wrote:
> > And if a service does not have an explicit stop on shutdown/reboot,
> > the processes are killed in a final killing spree where there are not
> > ordering guarantees.
> >
> 
> I don't think so.
> 
> /etc/init.d/rc5.d/Sxxfoo with or without a counter symlink "Kxxfoo"
> installed will be stop at shutdown like any regular other service
> because AFAIK it uses the default  dependencies.

Correct (see other mail).

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] sysv-generator weirdness for shutdown runlevels

2016-05-26 Thread Michael Biebl
2016-05-26 8:25 GMT+02:00 Francis Moreau :

> Well yes that's not usefull, so I'm wondering why systemd has code to
> deal with this weid case specially since by default all stubs will
> have a Conflicts/Before=shutdown.target.

The generator code is generic, there is no special code for this.



-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] sysv-generator weirdness for shutdown runlevels

2016-05-26 Thread Francis Moreau
On Thu, May 26, 2016 at 8:15 AM, Andrei Borzenkov  wrote:
> On Thu, May 26, 2016 at 8:49 AM, Francis Moreau  
> wrote:
>>
>> So let's take an example. Please note that I'm really not sure what's
>> the expected behavior of sysvinit itself, and finding some
>> documentation/specifications about that is pretty hard.
>>
>> I want my "foo" sysv service to be executed at shutdown. So I install
>> the following symlink:
>>
>>   /etc/init.d/rc0.d/S50foo
>>
>> The sysv-generator will add a "WantedBy/Before=poweroff.target" to the foo 
>> stub.
>>
>> The chunk of code in my initial post adds support of the following symlink:
>>
>>  /etc/init.d/rc0.d/K50foo
>>
>> It adds "Conflicts/Before=shutdown.target" to foo stub.
>>
>> So if both symlinks are installed (I don't see why this is useful and
>> hence why the generator has some code to handle that), foo stub has
>> the following constraints:
>>
>> WantedBy/Before=poweroff.target
>> Conflicts/Before=shutdown.target
>>
>> and to me that's not useful since in my understand it's equivalent to a nop.
>>
>
> This is classical garbage in - garbage out, unless you can demonstrate
> valid use case for something that has to be both started *and* stopped
> at the same time.

Well yes that's not usefull, so I'm wondering why systemd has code to
deal with this weid case specially since by default all stubs will
have a Conflicts/Before=shutdown.target.

So even if /etc/init.d/rc0.d/K50foo is not installed,
/etc/init.d/rc0.d/S50foo will have no effect.

-- 
Francis
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] sysv-generator weirdness for shutdown runlevels

2016-05-26 Thread Michael Biebl
2016-05-26 7:49 GMT+02:00 Francis Moreau :
> Hello Michael,
>
> On Wed, May 25, 2016 at 11:08 PM, Michael Biebl  wrote:
>> Hm, I've already given you the answer on IRC, so I'm not sure why you
>> ask them again.
>>
>
> Indee and thank you for that.
>
> But you also told me that /etc/init.d/rc0.d isn't supported by Debian,
> and my question is about this runlevel in particular.

No, what I said is that this directory doesn't exist in Debian. It's
called /etc/rc0.d (or /etc/rc6.d)




-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] sysv-generator weirdness for shutdown runlevels

2016-05-25 Thread Francis Moreau
Hello Michael,

On Wed, May 25, 2016 at 11:08 PM, Michael Biebl  wrote:
> Hm, I've already given you the answer on IRC, so I'm not sure why you
> ask them again.
>

Indee and thank you for that.

But you also told me that /etc/init.d/rc0.d isn't supported by Debian,
and my question is about this runlevel in particular.

> The K symlinks determine whether a service needs an explicit stop
> request on shutdown (i.e. Conflicts/Before: shutdown.target).
>
> That's exactly how sysvinit also worked. If there was a K symlink in
> rc0 and rc6, the service is stopped via /etc/init.d/foo stop.
>
> Not sure what's unclear about that.
>

So let's take an example. Please note that I'm really not sure what's
the expected behavior of sysvinit itself, and finding some
documentation/specifications about that is pretty hard.

I want my "foo" sysv service to be executed at shutdown. So I install
the following symlink:

  /etc/init.d/rc0.d/S50foo

The sysv-generator will add a "WantedBy/Before=poweroff.target" to the foo stub.

The chunk of code in my initial post adds support of the following symlink:

 /etc/init.d/rc0.d/K50foo

It adds "Conflicts/Before=shutdown.target" to foo stub.

So if both symlinks are installed (I don't see why this is useful and
hence why the generator has some code to handle that), foo stub has
the following constraints:

WantedBy/Before=poweroff.target
Conflicts/Before=shutdown.target

and to me that's not useful since in my understand it's equivalent to a nop.

Thanks.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] sysv-generator weirdness for shutdown runlevels

2016-05-25 Thread Michael Biebl
And if a service does not have an explicit stop on shutdown/reboot,
the processes are killed in a final killing spree where there are not
ordering guarantees.


2016-05-25 23:08 GMT+02:00 Michael Biebl :
> Hm, I've already given you the answer on IRC, so I'm not sure why you
> ask them again.
>
> The K symlinks determine whether a service needs an explicit stop
> request on shutdown (i.e. Conflicts/Before: shutdown.target).
>
> That's exactly how sysvinit also worked. If there was a K symlink in
> rc0 and rc6, the service is stopped via /etc/init.d/foo stop.
>
> Not sure what's unclear about that.
>
> 2016-05-25 22:12 GMT+02:00 Francis Moreau :
>> Hello,
>>
>> I'm starring at a chunk of code of the sysv-generator (shown below)
>> for some while now and I still can't see its purpose.
>>
>> Here's the code taken from src/sysv-generator/sysv-generator.c:
>>
>> static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap
>> *all_services) {
>>
>> [...]
>>
>> } else if (de->d_name[0] == 'K' &&
>>(rcnd_table[i].type ==
>> RUNLEVEL_DOWN)) {
>>
>>
>> set_ensure_allocated(_services, NULL);
>> set_put(shutdown_services, service);
>> }
>> [...]
>>
>> For simplicity sake, I removed the sanity checkings.
>>
>> If I parsed it correctly, it handles symlinks in rc[06].d/ such as:
>> /etc/init.d/rc0.d/K50foo.
>>
>> In this case this adds a "Conflicts=shutdown.target" and
>> "Before=shutdown.target" to the foo stub service.
>>
>> What exactly the point to do that specially ? which sysvinit behavior
>> systemd is try to mimic ?
>>
>> Thanks.
>> --
>> Francis
>> ___
>> systemd-devel mailing list
>> systemd-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
>
>
> --
> Why is it that all of the instruments seeking intelligent life in the
> universe are pointed away from Earth?



-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] sysv-generator weirdness for shutdown runlevels

2016-05-25 Thread Michael Biebl
Hm, I've already given you the answer on IRC, so I'm not sure why you
ask them again.

The K symlinks determine whether a service needs an explicit stop
request on shutdown (i.e. Conflicts/Before: shutdown.target).

That's exactly how sysvinit also worked. If there was a K symlink in
rc0 and rc6, the service is stopped via /etc/init.d/foo stop.

Not sure what's unclear about that.

2016-05-25 22:12 GMT+02:00 Francis Moreau :
> Hello,
>
> I'm starring at a chunk of code of the sysv-generator (shown below)
> for some while now and I still can't see its purpose.
>
> Here's the code taken from src/sysv-generator/sysv-generator.c:
>
> static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap
> *all_services) {
>
> [...]
>
> } else if (de->d_name[0] == 'K' &&
>(rcnd_table[i].type ==
> RUNLEVEL_DOWN)) {
>
>
> set_ensure_allocated(_services, NULL);
> set_put(shutdown_services, service);
> }
> [...]
>
> For simplicity sake, I removed the sanity checkings.
>
> If I parsed it correctly, it handles symlinks in rc[06].d/ such as:
> /etc/init.d/rc0.d/K50foo.
>
> In this case this adds a "Conflicts=shutdown.target" and
> "Before=shutdown.target" to the foo stub service.
>
> What exactly the point to do that specially ? which sysvinit behavior
> systemd is try to mimic ?
>
> Thanks.
> --
> Francis
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel



-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] sysv-generator weirdness for shutdown runlevels

2016-05-25 Thread Francis Moreau
Hello,

I'm starring at a chunk of code of the sysv-generator (shown below)
for some while now and I still can't see its purpose.

Here's the code taken from src/sysv-generator/sysv-generator.c:

static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap
*all_services) {

[...]

} else if (de->d_name[0] == 'K' &&
   (rcnd_table[i].type ==
RUNLEVEL_DOWN)) {


set_ensure_allocated(_services, NULL);
set_put(shutdown_services, service);
}
[...]

For simplicity sake, I removed the sanity checkings.

If I parsed it correctly, it handles symlinks in rc[06].d/ such as:
/etc/init.d/rc0.d/K50foo.

In this case this adds a "Conflicts=shutdown.target" and
"Before=shutdown.target" to the foo stub service.

What exactly the point to do that specially ? which sysvinit behavior
systemd is try to mimic ?

Thanks.
-- 
Francis
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel