I am experiencing strange behavior with LSB Init Scripts in Debian Wheezy. I can demonstrate the problem on following example:
The script /etc/init.d/resolvconf
starts in S
and stops in runlevels 0
and 6
.
# Default-Start: S
# Default-Stop: 0 6
And indeed, when I use chkconfig resolvconf on
to turn the script on, I see that symlinks have been created in respective runlevel directories:
$ ls /etc/rc?.d/*resolvconf
/etc/rc0.d/K02resolvconf
/etc/rc6.d/K02resolvconf
/etc/rcS.d/S13resolvconf
When I turn the script off with chkconfig resolvconf off
, the symlinks disappear. So far so good.
Now, I have decided I don't want the script to start in S
(I am going to start it manually), but I still want it to stop in runlevels 0
and 6
. I change default start accordingly:
# Default-Start:
# Default-Stop: 0 6
and turn the script on chkconfig resolvconf on
. And nothing happens.
$ ls /etc/rc?.d/*resolvconf
ls: cannot access /etc/rc?.d/*resolvconf: No such file or directory
no symlinks have been created, and the script does not stop in runlevels 0
and 6
.
What is happening here?
How can I have a script only run (stop) in runlevels 0
and 6
, without starting in S
?
UPDATE
as suggested by @Rui F Ribeiro, I have completely removed the # Default-Start:
line. Now when I run chkconfig resolvconf on
, I get following errors:
insserv: Script resolvconf is broken: incomplete LSB comment.
insserv: missing `Default-Start:' entry: please add even if empty.
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `resolvconf'
the symlinks are created, though.
$ ls /etc/rc?.d/*resolvconf
/etc/rc0.d/K02resolvconf
/etc/rc6.d/K02resolvconf
But why do I get the errors?
ln -s /etc/init.d/resolvconf /etc/rc6.d/K02resolvconf && ln -s /etc/init.d/resolvconf /etc/rc0.d/K02resolvconf
insserv
; in Debian,chkconfig
is just a front-end to that. In LSB, "Default-Start" is required, so the messages are correct; what isn't is the behaviour with an empty "Default-Start" (your first test). Could you runinsserv -v resolvconf
(with the empty "Default-Start" line in the script)? That should give you more information about what's going on...insserv -v resolvconf
works without any problems.