invoke-rc.d mishandles runlevels 0 and 6

Bug #886333 reported by Phillip Susi on 2011-11-04
This bug affects 1 person
Affects Status Importance Assigned to Milestone
sysvinit (Ubuntu)

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
    printerror "-----------------------------------------------------"
    printerror "WARNING: 'invoke-rc.d ${INITSCRIPTID} ${ACTION}' called"
    printerror "during shutdown sequence."
    printerror "enabling safe mode: initscript policy layer disabled"
    printerror "-----------------------------------------------------"

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers