Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 369811

Summary: sys-apps/openrc: Patch to measure time required for starting daemons (was: delay to sys-auth/consolekit init script)
Product: Gentoo Linux Reporter: Fabio Rossi <rossi.f>
Component: Current packagesAssignee: OpenRC Team <openrc>
Status: CONFIRMED ---    
Severity: normal CC: paul
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
See Also:
Package list:
Runtime testing required: ---
Attachments: consolekit-0.1.rc

Description Fabio Rossi 2011-06-02 15:06:11 UTC
I have the consolekit init script running in the defaul level. Every time I
start the system I get the following error:

 * Starting ConsoleKit daemon ...
 * Detaching to start `/usr/sbin/console-kit-daemon' ...
 *   start-stop-daemon: did not create a valid pid in `/var/run/ConsoleKit/pid' [ !! ]
 * ERROR: consolekit failed to start

but the console-kit-daemon exec is running and the pidfile is present
where indicated. The pidfile is created by console-kit-daemon and not by
start-stop-daemon and it seems it takes a lot of time during the boot. To avoid
that error and to have the init script correctly initialized, it's
necessary to pass a delay to start-stop-daemon to indicate how much time
is needed before checking for the pidfile presence.
Comment 1 Fabio Rossi 2011-06-02 15:07:30 UTC
Created attachment 275621 [details]

I have added a delay of 500ms to correct the problem. I have also removed the -q option not recognized by start-stop-daemon
Comment 2 Fabio Rossi 2011-06-03 09:18:46 UTC
Created attachment 275645 [details]

I'm sorry, it has to be 600ms
Comment 3 Wormo (RETIRED) gentoo-dev 2011-06-06 05:21:59 UTC
Thanks for submitting your init script updates, assigning to maintainers
Comment 4 Fabio Rossi 2011-06-07 08:17:51 UTC
Created attachment 276109 [details]

I have written the simple attached patch to (roughly) estimate the delay needed for the init script (using openrc). In the previous post I have put 600ms but it doesn't seem to be enough. On my system I got 840ms during last reboot. Adding some margin, I guess 1000ms should be enough. I'll keep an eye on the number after each (re)boot to have better statistics.
Comment 5 Fabio Rossi 2011-07-18 21:17:49 UTC
After more than one month of analysis, the maximum delay measured with the patch openrc-measure-delay.diff is 1320ms but I bet this number is sensible to system speed, load during init of parallel scripts, etc.

So I'm thinking to an alternative to the --wait option for start-stop-daemon. Do you think it makes sense the introduction of another option, --wait-until-timeout? In this case start-stop-daemon is given with the maximum time limit it should wait.
Comment 6 Samuli Suominen (RETIRED) gentoo-dev 2012-05-20 13:25:32 UTC
Moving to openrc@ since Comment #4 is a patch to OpenRC code. 

And since nobody else has reported anything like this against ConsoleKit, I'm reclutant in adding any delays to it's init script.
Comment 7 2014-02-10 06:43:04 UTC
It appears to me the problem is a circular dependency between dbus and consolekit.  

If a put dbus in my default run level. The dbus-daemon automatically starts console-kit-daemon. console-kit-daemon then creates the pid file at /var/run/Consolekit/pid.

Now if the consolekit script is run. Because it needs the dbus.  Dbus starts console-kit-daemon which creates the pid.  The consolekit script errors out not because it can't create the pid file but because it has already been created by dbus running console-kit-daemon. 

Hope that makes sense.
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-29 02:54:43 UTC
We discussed this on #openrc and William wants to take a look at it.