baselayout/openrc is screwing up restart, not running the real restart() block, but instead deciding to run stop/start on it's own. This is specifically a problem when start()/stop()/restart() are part of a more complex init where another function does the actual stop/start. Will attach testcase next. Actual results: # /etc/init.d/testcase start : Begin start : SPECIAL start : start_testcase : End start # /etc/init.d/testcase restart : Begin stop : SPECIAL stop : stop_testcase : End stop : Begin start : SPECIAL start : start_testcase : End start # /etc/init.d/testcase stop : Begin stop : SPECIAL stop : stop_testcase : End stop Expected results: # /etc/init.d/testcase start : Begin start : SPECIAL start : start_testcase : End start # /etc/init.d/testcase restart : Begin restart : SPECIAL restart : stop_testcase : start_testcase : End restart # /etc/init.d/testcase stop : Begin stop : SPECIAL stop : stop_testcase : End stop
Created attachment 168364 [details] testcase for problem
This is non trivial to "fix". OpenRC (and baselayout-2 before OpenRC) has never run the restart function because of this. Nearly every init script "restart" is really a "reload" - ie, reload the configuration file without stopping and starting the daemon. The easiest solution, by a very long margin, is to rename the init script functions accordingly and document it. This approach works fine with baselayout-1
auditd in this case isn't a reload in the sense of reload config. reload is actually the one thing that it isn't in fact. start is: 1. start daemon 2. load active ruleset for running if successful. stop is: 1. load pre-stop ruleset 2. stop daemon 3. load post-stop ruleset restart is: 1. stop daemon 2. start daemon (audit logging continues in the kernel buffers during this time)
In the stop function you could avoid running the pre/post rules by testing RC_CMD=restart or RC_CMD=stop.
This bug has been idle for over a year... What is the consensus, Robin? Add the workaround for auditd as outlined in Comment #4? Is that route is taken, then this bug shouldn't block the openrc stable tracker
work-around used for now. Maybe we should have something to QA for init.d scripts containing a restart block that isn't being called?
Some init scripts' QA wouldn't be bad, given it would also have to look for stuff like, say, init scripts that run complex scripts during dependencies regeneration (the tinderbox gets quite a bit of load when it has to regenerate the rc dependency cache :().