Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

after running

sudo pacman -Syyu


sudo pacman -S [something to install]

should I restart just to be safe?

share|improve this question

3 Answers 3

up vote 7 down vote accepted

If there are updates to the kernel, glibc or systemd, you may want to restart so the updated versions are in use. If you have, say, updates to your desktop environment, a simple logout/login is enough.

share|improve this answer

The best way is to find what programs/services use the old libraries and restart them. And you can achieve it by listing all used files using 'lsof' and find those that have 'DEL' type. DEL means filename was removed from the filesystem but it is still stuck in memory because someone uses it.

Here is the full command line:

 sudo lsof +c 0 | grep 'DEL.*lib' | awk '1 { print $1 ": " $NF }' | sort -u
share|improve this answer
After generating that list of services and libraries, it still is not clear which systemd services need to be restarted. Hence, even though I know which processes and libs need a restart, it is typically non-trivial to determine which services to restart based on that list. – bwv549 Jan 29 at 20:36

The only mandatory reason to reboot is a new kernel (and you can soft-reboot using kexec). See for details, in short:

  • load the new kernel, initramfs and specify the boot cmdline

    kexec -l /boot/new-kernel --initrd=/boot/new-initramfs --reuse-cmdline
  • invoke kexec (use systemctl for proper shutdown, kexec -e would execute directly)

    systemctl kexec
  • Note that if you create a kexec-load@.service as explained in the wiki, if you reboot, systemd will automatically soft-reboot using kexec instead of doing a bios reboot

Little bit improved version that gives systemd service names:

PIDS="(lsof +c0 -n 2> /dev/null | grep 'DEL.*lib' | awk '{print $2}' | sort -u)"
for PID in $PIDS; do
    systemctl status $i
done | grep '●' | awk '{print $2}' | sort -u

or one-line:

for i in $(lsof +c0 -n 2> /dev/null | grep 'DEL.*lib' | awk '{print $2}' | sort -u); do systemctl status $i; done | grep '●' | awk '{print $2}' | sort -u

Note that there are some issues:

  • systemctl daemon-reload should be executed prior to restarting anything else
  • if PID 1 (systemd itself) needs to be restarted, it can be done using systemctl daemon-reexec
  • systemctl restart dbus.service breaks some other services, they need to be restarted after dbus restart:
    • systemd itself: systemctl daemon-reexec
    • systemd-logind
    • systemd-machined
    • probably other systemd-*/other services that (heavily) use dbus
  • If you're connected via SSH and SSH needs to be restarted, but systemctl restart sshd won't restart it as long you are connected, I see 2 options:
    • schedule systemctl restart sshd using at/cron/systemd timers
    • restart SSH using another remote (secure) shell such as mosh
  • running screen/tmux may also block services like SSH from restarting, the easiest way is to close these sessions before restarting services
  • as told in a previous answer, logout/login may be needed, especially for graphical sessions
share|improve this answer
would you mind to improve the answer explaining how kexec is used? – Rui F Ribeiro Nov 16 at 10:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.