after running

sudo pacman -Syyu


sudo pacman -S [something to install]

should I restart just to be safe?


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.

| 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
| improve this answer | |
  • 2
    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 '15 at 20:36

The only mandatory reason to reboot is a new kernel (and you can soft-reboot using kexec). See https://wiki.archlinux.org/index.php/Kexec 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
| improve this answer | |
  • 1
    would you mind to improve the answer explaining how kexec is used? – Rui F Ribeiro Nov 16 '15 at 10:28

An easy way is to compare the version of the running kernel to the latest kernel on disk. I found a script that can do that easily.

As I have several kernels installed, I modified the script to check only the one corresponding to the running kernel. For example, I currently have versions 4.9.79 and 4.14.16 installed and thus need to check /boot/vmlinuz-4.14-x86_64. Unfortunately this won't work when I start using version 5.1, so an update will be needed (replace 4 by 3) or I need to find a more robust way.

Here is my script:

for I in `file $KERNEL_PATH*`; do
  if [ ${NEXTLINE} -eq 1 ]; then
    if [ "${I}" = "version" ]; then NEXTLINE=1; fi
    if [ ! "${FIND}" = "" ]; then
      if [ ! "${CURRENT_KERNEL}" = "${FIND}" ]; then
    echo "Boot required"
  else echo "No boot required"
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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