[systemd-devel] [HEADSUP] Removal of shutdownd
Daniel Mack
daniel at zonque.org
Fri Apr 24 08:48:47 PDT 2015
The only purpose of the little helper daemon called shutdownd is to keep
track and execute a scheduled shutdown. It prints utmp wall
notifications to TTYs in periodic intervals, makes sure to create the
/run/nologin and /run/systemd/shutdown/scheduled files, and eventually,
once the timeout is reached, it executes systemctl again to really shut
down / reboot / halt the machine. It is socket activated and
communicates with systemctl via a proprietary protocol.
The current procedure for a scheduled shutdown looks like this:
* shutdown (aka systemctl) is executed with a time argument
(for instance, 'shutdown -h 18:00').
* As an execution time for the command was given, systemctl
communicates with shutdownd via its private socket,
possibly activating it that way.
* shutdownd waits for the timer to elapse
* shutdownd executes 'shutdown' (aka systemctl)
* This time, the action is immediate, hence systemctl
directly communicates with PID1 in order to start the
appropriate shutdown unit.
I have now reworked all this and moved the code from shutdownd into
logind, which already has the logic for inhibitors and other timers.
For this, logind learned two new methods on its DBus-interface:
.ScheduleShutdown()
.CancelScheduledShutdown()
and three more properties:
.ScheduledShutdown() [r]
.EnableWallMessages() [rw]
.WallMessage [rw]
systemctl now talks to logind instead to shutdownd, and the procedure
looks like this:
* shutdown (aka systemctl) is executed with a time argument
(for instance, 'shutdown -h 18:00').
* As an execution time for the command was given, systemctl
communicates with logind via DBus in order to schedule the
shutdown.
* logind waits for the timer to elapse and, given that there
are no inhibitors preventing it, directly communicates with
PID1 in order to start the appropriate shutdown unit.
shutdownd was killed entirely. As a result, we have one less daemon
lurking around, a nice DBus-API for something that used to be
proprietary, and even less code:
20 files changed, 727 insertions(+), 905 deletions(-)
However, this means that direct users of the shutdownd socket have to
migrate to the DBus interface. We are only aware of one such user, which
is Cockpit, and Stef Walter (Cc) already signaled his agreement on this
change.
The patches are now pushed. They have been reviewed by Lennart before
and I tested it for a while, but as always, we appreciate more testers
for such a rework :)
Thanks,
Daniel
More information about the systemd-devel
mailing list