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.
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
Created attachment 275645 [details]
I'm sorry, it has to be 600ms
Thanks for submitting your init script updates, assigning to maintainers
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.
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.
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.
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.
We discussed this on #openrc and William wants to take a look at it.