invoke-rc.d mishandles runlevels 0 and 6
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
sysvinit (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
invoke-rc.d checks the current runlevel to make sure not to start a daemon that is not supposed to run in this runlevel. If you set the runlevel to 0 or 6 ( by setting the RUNLEVEL environment variable ), it has a special clause that bypasses all checks and starts/stops the daemon as told anyhow. This clause should only apply to stopping the daemon, not starting it.
To reproduce the error, run RUNLEVEL=0 invoke-rc.d somedaemon start
The relevant section in the script is:
## Handles shutdown sequences VERY safely
## i.e.: forget about policy, and do all we can to run the script.
## BTW, why the heck are we being run in a shutdown runlevel?!
if test x${RL} = x0 || test x${RL} = x6 ; then
FORCE=yes
RETRY=yes
POLICYHELPER=
BEQUIET=
printerror "------
printerror "WARNING: 'invoke-rc.d ${INITSCRIPTID} ${ACTION}' called"
printerror "during shutdown sequence."
printerror "enabling safe mode: initscript policy layer disabled"
printerror "------
fi