To restart the daemon, run
systemctl daemon-reexec
This is documented in the systemctl
manpage:
Reexecute the systemd manager. This will serialize the manager state, reexecute the process
and deserialize the state again. This command is of little use except for debugging and
package upgrades. Sometimes, it might be helpful as a heavy-weight daemon-reload
. While the
daemon is being reexecuted, all sockets systemd listening on behalf of user configuration will
stay accessible.
Unfortunately needs-restarting
can’t determine that systemd
has actually restarted. systemd
execs
itself to restart, which doesn’t reset the process’s start time; but needs-restarting
compares the executable’s modification time with the process’s start time to determine whether a process needs to be restarted (among other things), and as a result it always considers that systemd
needs to be restarted... To determine whether systemd
really needs to be restarted, you can check the output of lsof -p1 | grep deleted
: systemd
uses a library, libsystemd-shared
, which is shipped in the same package and is thus upgraded along with the daemon, so if systemd
needs to be restarted you’ll see it using a deleted version of the library. If lsof
shows no deleted files, systemd
doesn’t need to be restarted. (Thanks to Jeff Schaller for the hint!)