Check if a reboot is neccessary

That looks nice. I am not sure pacman uses same algo because sometimes after an systemd upgrade it does not tell me reboot is needed and sometimes it does. But it is a much better approach than anyone I have before!

Concrete example: there is more than network card and a special usb device present at the server. After a kernel upgrade both is lost. At my desktop PCs autodetection of inserted pluggable devices is lost sometimes after an upgrade. So I cannot confirm that you can wait a long time using a system where pacman told “reboot is needed”.

See above :slight_smile:

Try at the end something like that instead:

Exec = /usr/bin/bash -c 'echo -e "\e[1mREBOOT required!\e[";'

This will just output to terminal. All that gibberish around will make output bold, if i’m not mistaken.

Maybe best idea would be to just copy eos-reboot-required.hook under other name to hooks dir, after each update and change Exec line (to make sure the file is up to date and you don’t have to think about it, again for that simple operation you can use post-install hook with simple bash cp operation).

That’s however for post-install, not sure about pre-install cheker still

It needs small work because of I must use packages information from checkupdates but of pacman log but that is quite simple at all. I will go this way and possibly add packages to the list if I observe differences between notifying and pacman run.

ask @manuel if he is willing and has time he could help for sure

So it’s basically just a list of packages that need reboot after an update? Well, that’s a bit disappointing. But it makes it easy to check in a script.

This script will tell you whether reboot is necessary, with approximately the same accuracy as eos-update-notifier:

# Check whether reboot is necessary after an update.
# dependency: checkupdates
# assume packages containing these strings in name need reboot after updating

if [[ $UPDATES =~ $REBOOT ]]; then
  echo "Needs reboot"
  exit 0;
echo "No reboot needed"
exit 1

EDIT: here is a much shorter script that does (almost) the same thing (just in case someone complains about inefficiency):

checkupdates | awk '/ucode/ || /cryptsetup/ || /linux/ || /nvidia/ || /mesa/ || /systemd/ || /wayland/ || /xf86-video/ || /xorg/ { print "Needs reboot."; exit }'

EDIT 2: simplified the code in the first example.


Thanks for that - I would have coded it in a similar way. Last question is “does pacman detect that in the same way?” I have looked at the installed files with pacman -Ql pacman and can’t find any hook for alpm that contains “reboot” and any file that contains such a package list…

It seems the answer to that is: no. It seems that pacman has no idea whether updating a package requires reboot or not.

It seems - but it is not. after pacman -Syu runs I see the message “Inform user to reboot”. Where does this message come from?

It seems to be a hook.

No, it’s some libalpm magic actually
Which is beyond my knowledge :upside_down_face:

I just have overviewed all libalpm hooks and scripts. I can confirm ist is “some magic”. Not to see immediately… And I agree it must be a hook.

Anyway: I take this you all have worked out as a solution. Many thanks for your help!

1 Like

I see I can give only one post the attribute “solution”. In this case I would give it to more contributors :wink:

Glad that I have choosen Endeavour as my Arch-based distro (coming from Antergos) and that the community is more alive than ever and to be a part of it!

Stay healthy


and hydrated! :frog:



Amen! :rocket:
Love the sound of bouncing ideas! :partying_face:


I was about to write: “HOW DARE YOU?!?!?” :rofl:
awk is cool! :slight_smile: :frog:

1 Like

that`s a hook…

1 Like

Generally if it’s not the kernel, systemd or graphics relates a reboot is needed. For services, they can be restarted without a reboot. I generally just look at the list of packages being upgraded and make a decision if I have to reboot, restart a service or my session. If in doubt I reboot.

I only update every week or two depending on my work schedule. I haven’t seemed to have any issues with it so far. I always reboot after.

Here’s a script that looks for reboot-requiring packages from /etc/pacman.d/hooks/eos-reboot-required.hook.
Otherwise it is quite similar to what @Kresimir showed.


# Check if a reboot would be necessary after system update.

DIE() {
    echo "Error: $1" >&2
    exit 1

    local updates
    local hookpkgs
    local up hook

    pacman -Q eos-update-notifier >&/dev/null || DIE "sorry, package eos-update-notifier is required."

    readarray -t updates  <<< $(checkupdates | awk '{print $1}')
    readarray -t hookpkgs <<< $(cat /etc/pacman.d/hooks/eos-reboot-required.hook | grep "^Target = " | awk '{print $3}')

    for up in "${updates[@]}" ; do
        for hook in "${hookpkgs[@]}" ; do
            case "$up" in
                    echo "Reboot will be required after system update." >&2
                    return 0
    echo "Reboot will not be required after updating." >&2
    return 1

Main "$@"