On Tue, 15 Dec 2020 00:58:19 +0100 Robert Luberda <rob...@debian.org> wrote:
> >> insserv: Script ssh has overlapping Default-Start and Default-Stop > >> runlevels (2 3 4 5) and (2 3 4 5). This should be fixed. > > What is surprising the ssh warning is shown even if I run insserv from > the command line without giving any other arguments: > [...] > While the sysstat warning is shown only on upgrades. it is because insserv scan all the init.d files on each invocation, but it scans the rc.d links only for the ones specified by commandline > Removing the links removes the warning as well: > [...] > But when I re-add the K01ssh links, 'apt install --reinstall sysstat' > warns about ssh, and no longer about sysstat service... this is the culprit: if the user tweaks the rc.d links, then the overlapping warning appears, but it should not > Oh, wait, I've just read my email from Sunday, and it looks like the > warning on my system was always about ssh: > [...] > Sorry about not noticing it before, I must have been too strongly > suggested by the Julian's original bug report :( > > So it looks like the warning says that run-level links were customized > by a user. IMHO it would be nice if the warning message stated this > simple fact in a more explicit way. well, thanks to your report we found a bug in insserv :) > I looked into insserv(8) man page before changing the script, and was > under impression that Default-Start and Default-Stop must contain at > least one run level, as the example given at the top of the man page > says: > > # Default-Start: run_level_1 [ run_level_2 ...] > # Default-Stop: run_level_1 [ run_level_2 ...] the actual syntax may be misleading, because insserv works happily if any of those fields are empty (or even missing) > But if you're sure they can be empty, I will revert the change in > sysstat's init.d script. yes, you can safely revert it, as far i understand @Jesse Smith: I attached a possible fix, but it slightly changes the behavior, as now it prints the overlapping warning when loading all the init.d scripts and not only for the ones in the commandline this because if script_inf.default_start and stop are empty, they are overwritten by the levels gathered from rc.d links and I do not fully understand the implications of removing those overwrites, so I just moved the code before this part the second patch is for the manpage about empty fields, that are allowed by insserv, but probably it could be explained better please to tell me if you need some more info or work to be done :) ciao!
>From d6704148edd51cbb972a9e61e9d165a9e266be45 Mon Sep 17 00:00:00 2001 From: Trek <tre...@inbox.ru> Date: Tue, 15 Dec 2020 16:17:54 +0100 Subject: [PATCH 1/2] Check only LSB header for overlapping runlevels to fix Debian bug #971713 --- insserv.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/insserv.c b/insserv.c index 1e43bf0..dbd3202 100644 --- a/insserv.c +++ b/insserv.c @@ -3573,6 +3573,14 @@ int main (int argc, char *argv[]) if (script_inf.stop_after && script_inf.stop_after != empty) { reversereq(service, REQ_SHLD|REQ_KILL, script_inf.stop_after); } + + overlap = Start_Stop_Overlap(script_inf.default_start, script_inf.default_stop); + if (overlap) + { + warn("Script `%s' has overlapping Default-Start and Default-Stop runlevels (%s) and (%s). This should be fixed.\n", + d->d_name, script_inf.default_start, script_inf.default_stop); + } + /* * Use information from symbolic link structure to * check if all services are around for this script. @@ -3739,13 +3747,6 @@ int main (int argc, char *argv[]) } #endif /* not SUSE */ - overlap = Start_Stop_Overlap(script_inf.default_start, script_inf.default_stop); - if (overlap) - { - warn("Script %s has overlapping Default-Start and Default-Stop runlevels (%s) and (%s). This should be fixed.\n", - d->d_name, script_inf.default_start, script_inf.default_stop); - } - if (isarg && !defaults && !del) { if (argr[curr_argc]) { char * ptr = argr[curr_argc]; -- 2.20.1
>From fa303693753e774adc3ad1d34679d346b4beddaa Mon Sep 17 00:00:00 2001 From: Trek <tre...@inbox.ru> Date: Tue, 15 Dec 2020 16:16:12 +0100 Subject: [PATCH 2/2] Added Default-Start and Stop definitions to insserv.8 --- insserv.8.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/insserv.8.in b/insserv.8.in index b79385a..5faa46e 100644 --- a/insserv.8.in +++ b/insserv.8.in @@ -97,6 +97,11 @@ execute insserv directly unless you know exactly what you're doing, doing so may render your boot system inoperable. .B update\-rc.d is the recommended interface for managing init scripts. +.PP +The +.B Default\-Start +keyword declares on which runlevels the script must be started. An empty +value means the script will never be started. @@BEGIN_SUSE@@ Please note, that the .B Default\-Stop @@ -104,6 +109,10 @@ are ignored in SuSE Linux, because the SuSE boot script concept uses a differential link scheme (see .IR init.d (7)). @@ELSE_SUSE@@ +The same applies for its counterpart +.B Default\-Stop +with the only difference that the script is stopped. +.PP Please be aware that the line .sp 1 .in +1l -- 2.20.1