#arch #linux #kernel #i-use-arch-btw

app reboot-arch-btw

Check if you need to reboot due to an updated kernel. (I use Arch btw!)

16 unstable releases (4 breaking)

0.5.4 Jan 14, 2023
0.5.3 Dec 10, 2022
0.5.1 Nov 11, 2022
0.3.4 May 17, 2022
0.1.2 Nov 19, 2019

#127 in Command line utilities

37 downloads per month

GPL-3.0-only

23KB
473 lines

Reboot Arch BTW

GitHub Workflow Status Crates.io Version Crates.io Downloads AUR version

This is a small utility which shows the installed and running Linux kernel on ArchLinux. It is useful if one didn't notice that the kernel got updated and suddenly your USB drive won't mount because the needed kernel module can't get loaded.

It can also detect if critical packages like systemd got updated which may also make a reboot necessary.

To get the version of the installed kernel it uses libalpm (shipped with pacman) to query the local pacman database. To get the version of the running kernel it uses uname -r.

Install

You may just install it from the AUR:

Alternatively one can install it with cargo:

cargo install reboot-arch-btw

Build

This project requires Rust 1.65.0 or newer. Also you need to have dbus installed.

sudo pacman -S dbus
cargo build

Usage

$ reboot-arch-btw
Kernel
 installed: 5.19.13.arch1.1 (since 4 minutes ago)
 running:   5.19.12.arch1.1
systemd updated 4 minutes ago
Reboot arch btw

It will also show a desktop notification indicating that you probably want to reboot your system.

One can use --reboot-packages or --reboot-packages to set the list of packages which should also trigger a notification if they are updated.

$ reboot-arch-btw --help
Check if a reboot is needed due to an updated kernel or other system packages.

Usage: reboot-arch-btw [OPTIONS]

Options:
      --disable-notification
          Disable desktop notification

      --notification-timeout <NOTIFICATION_TIMEOUT>
          Timeout for the desktop notification in milliseconds.

          * "default" will leave the timeout to be set by the server.

          * "never" or "0" will cause the notification never to expire.

          * Any other number will be interpreted as the timeout in milliseconds.

          [default: default]

      --reboot-packages <REBOOT_PACKAGES>
          Comma separated list of packages were we should reboot after an upgrade

          [default: systemd,linux-firmware,amd-ucode,intel-ucode]

      --session-restart-packages <SESSION_RESTART_PACKAGES>
          Comma separated list of packages were we should restart our session after an upgrade

          [default: xorg-server,xorg-xwayland]

  -h, --help
          Print help information (use `-h` for a summary)

  -V, --version
          Print version information

Pacman Hook

You can configure pacman to run reboot-arch-btw after every upgrade to check immediatly if you should reboot. For that create /etc/pacman.d/hooks/99-reboot-arch-btw.hook with the following content:

[Trigger]
Operation = Upgrade
Type = Package
Target = *

[Action]
Description = Check whether a reboot is required
Depends = reboot-arch-btw
When = PostTransaction
Exec = /usr/bin/sudo -u $USER DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$UID/bus /usr/bin/reboot-arch-btw

Note: You need to replace $USER and $UID with your actual username and user ID.

Dependencies

~4–31MB
~537K SLoC