I'm trying to restart services after a yum update on RHEL 7.4. I could restart every service using systemctl, but needs-restarting from yum utils tells me that I should also restart systemd itself:

# needs-restarting
1 : /usr/lib/systemd/systemd --system --deserialize 21

Can I restart systemd without rebooting the server, and how?

I found a few mentions of systemctl daemon-reload, but this doesn't make it disappear from the needs-restarting list.

2 Answers 2


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!)

  • 1
    @Raman, daemon-reexec is supposed to work even with systemd as pid 1. Commented Jan 24, 2018 at 15:03
  • 3
    The crux of needs-restarting boils down to github.com/rpm-software-management/yum/blob/master/… where it queries the PID's "start_time"; if the daemon-reexec doesn't update that, needs-restarting will remain "confused".
    – Jeff Schaller
    Commented Jan 24, 2018 at 15:21
  • 1
    Do not assume that any codepath involved is well-tested, especially on non-RedHat systems. It's technically possible to run daemon-reexec, but it's safer to reboot.
    – Harald
    Commented Jan 29, 2018 at 19:28
  • 2
    @Harald it’s used any time anyone upgrades systemd on Debian and derivatives, so it is well-tested. It’s also reasonably straightforward (look for do_reexecute). Commented Jan 29, 2018 at 19:49
  • 1
    @StephenKitt - When i attempt to run lsof -p1 | grep deleted the following output is generated lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs Output information may be incomplete. In reading (unix.stackexchange.com/questions/171519/…), it appears that even root is unable to access it. What would the alternative be to lsof -p1 | grep deleted?
    – Motivated
    Commented Feb 1, 2019 at 16:52

In my case, I had just upgraded systemd and any systemctl command was failing:

# systemctl daemon-reexec
Failed to reload daemon: Access denied
# systemctl status
Failed to read server status: Access denied

However according to the init manpage, you can do the same thing by sending SIGTERM to the daemon running as PID 1, which worked:

kill -TERM 1

This reloaded the daemon, after which all the systemctl commands started working again.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .