Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
v239.1: PID file not removed when elogind is terminated #94
I got an e-mail from Stefan about elogind not removing its PID file if it is shutdown using signal 15 (SIGTERM).
As /run is on tmpfs nowadays, this is of no real concern if elogind crashes on reboot or if the whole machine comes down. However, not all systems are like that and some have not put /run into RAM.
On these systems elogind fails to start on next reboot if a stale PID file exists.
There are two reasons for this:
Stefan has already provided fixes for the 1st point, which I am currently testing.
Checking the PID in the PID file doesn't sound safe - what if it's coincidentially the same as it was in the previous boot (f.e. a deterministic boot process could easily make that happen every time).
Better would be not to use a pid file but something else. Doesn't elogind provide a dbus service? How come it's not enough to try to register the dbus service and if that doesn't work (because it's already there), fail?
Well, elogind checks the presence of a PID file, before it would create its own.
Unfortunately service managers like OpenRC need such a PID file to know where to send SIGTERM when shuting down the device.