From: Tollef Fog Heen Date: Mon, 17 Oct 2011 19:00:42 +0000 (+0200) Subject: service: Drop rcN.d runlevels from SysV services that also exist in rcS.d X-Git-Tag: v38~225 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e51db373c242b7541794affb2b5e411bcce26d0f;p=systemd service: Drop rcN.d runlevels from SysV services that also exist in rcS.d Services which claim to start in both rcN.d and rcS.d generate loops which for some reason seems to usually end up with dbus not starting and the whole machine being quite unhappy. We now rather assume that if a service can be started in rcS, it should not also start in rcN.d. Fixes Debian bug #637037 --- diff --git a/src/service.c b/src/service.c index e64d289f..61843906 100644 --- a/src/service.c +++ b/src/service.c @@ -83,7 +83,7 @@ static const struct { #define RUNLEVELS_UP "12345" /* #define RUNLEVELS_DOWN "06" */ -/* #define RUNLEVELS_BOOT "bBsS" */ +#define RUNLEVELS_BOOT "bBsS" #endif static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = { @@ -811,6 +811,13 @@ static int service_load_sysv_path(Service *s, const char *path) { if ((r = sysv_exec_commands(s)) < 0) goto finish; + if (s->sysv_runlevels && + chars_intersect(RUNLEVELS_BOOT, s->sysv_runlevels) && + chars_intersect(RUNLEVELS_UP, s->sysv_runlevels)) { + /* Service has both boot and "up" runlevels + configured. Kill the "up" ones. */ + delete_chars(s->sysv_runlevels, RUNLEVELS_UP); + } if (s->sysv_runlevels && !chars_intersect(RUNLEVELS_UP, s->sysv_runlevels)) { /* If there a runlevels configured for this service