Is there an equivalent to Debian/Ubuntu's /var/run/reboot-required for Arch Linux to determine if a system restart is required?

I'm looking for a comprehensive solution that also accounts for when critical libraries and the kernel are updated and a reboot is required to complete the upgrade. This is my current workaround which only accounts for the kernel:

if [[ $(pacman -Q linux | cut -d " " -f 2) > $(uname -r) ]]; then
  # reboot...
  • 1
    Not an answer because I don’t know if it works on Arch, but I use the package “needrestart” - github.com/liske/needrestart
    – Darren
    Commented Jan 24, 2021 at 6:46
  • Arch Linux users know by heart when they need to reboot. :) After experiencing a few breaking dependencies after system upgrade, I always restart whatever running process that got upgraded. Basically reboot every time you upgrade your system.
    – Qian
    Commented Jan 24, 2021 at 9:42
  • @muru Tough call, the question is different, but some of the answers are relevant. Commented Jan 24, 2021 at 20:17
  • Have you looked to see how Debian does it? Commented Jan 25, 2021 at 2:18

3 Answers 3


I use this script to check if the boot kernel matches the current kernel and if a process is using any old libraries.


get_boot_kernel() {
    local get_version=0
    for field in $(file /boot/vmlinuz*); do
        if [[ $get_version -eq 1 ]]; then
            echo $field
        elif [[ $field == version ]]; then
            # the next field contains the version


libs=$(lsof -n +c 0 2> /dev/null | grep 'DEL.*lib' | awk '1 { print $1 ": " $NF }' | sort -u)
if [[ -n $libs ]]; then
    cat <<< $libs
    echo "# LIBS: reboot required"

active_kernel=$(uname -r)
if [[ $active_kernel != $current_kernel ]]; then
    echo "$active_kernel < $current_kernel"
    echo "# KERNEL: reboot required"
exit $rc

Sample output:

Xorg: /usr/lib/libedit.so.0.0.63
Xorg: /usr/lib/libgssapi_krb5.so.2.2
Xorg: /usr/lib/libk5crypto.so.3.1
Xorg: /usr/lib/libkrb5.so.3.3
Xorg: /usr/lib/libkrb5support.so.0.1
Xorg: /usr/lib/libzstd.so.1.4.5
# LIBS: reboot required
5.10.8-arch1-1 < 5.10.10-arch1-1
# KERNEL: reboot required

If you only have processes using old libraries you can restart the processes instead of rebooting.

  • I really like this script. I just wish the kernel portion worked with Arch Linux running on ARM processors (Raspberry pi's don't have /boot/vm*, or anything with kernel version when file'd). .. EDIT - looks like @Santiago Echevarria's solution suits my Kernel update needs.
    – JayRugMan
    Commented Apr 8, 2022 at 5:04
  • This is a really clever script! Kudos to you for writing it. If you are not the author could you give a reference to the original please? Thanks. Commented Jul 11, 2022 at 16:38
  • @oᴉɹǝɥɔ this is the original.
    – laktak
    Commented Apr 22 at 21:11

s1=$(pacman -Q linux | sed 's/linux //')
s2=$(uname -r | sed 's/-ARCH//')

if [ "$s1" == "$s2" ]; then
  echo OK
  echo REBOOT

Seems to work. Source: bbs.archlinux.org/viewtopic.php?id=173508

  • 4
    This gives me a false positive (running inside a VM, updated a couple of days ago and rebooted right after the update). I think this happens because you check the latest kernel version available from upstream but do not check whether the update actually happened (run by the user).
    – ddnomad
    Commented Jan 23, 2021 at 23:45
  • 1
    Thanks for sharing your answer. The thread you've cited is already linked in my question and it's essentially the same as my current workaround. I'm wondering, are there other scenarios or packages that aren't considered by this solution? Is it comprehensive when determining whether upgrades are pending a reboot? Commented Jan 24, 2021 at 0:32
  • Didn't realize it was the same link. My bad. Apart from pacman or yay I don't think any other tool could determine when an upgrade is required. Reboot is required when configuration from files where "used" on boot, or programs loaded into RAM. I guess only pacman knows when these files changed.
    – esantix
    Commented Jan 24, 2021 at 0:41

I've been using arch for years and am not aware of an equivalent. I don't use it on any production systems, so I usually wait until I get an error about a missing library to reboot. Then I also run into situations such as when KDE/QT updates, which makes all my graphical applications start to have weird errors, but the OS itself doesnt need a reboot, I just need to restart my WM/DE.

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