Keep the running kernel's modules after a kernel upgrade
shellcheck / shellcheck (push) Successful in 48s

install.sh failed whenever its upgrade replaced the kernel (Arch installed
a few days earlier): pacman deletes the running kernel's modules, so Docker
and then the firewall couldn't load theirs. The smoketest found it.

kernel-modules-hook keeps them until the next reboot, and its cleanup
service removes them after. install.sh installs it with archlinux-keyring,
in a transaction of its own so its hooks run for the upgrade; packages.conf
lists it and the service, so update adds them to existing machines.

With the modules kept, a missing modules folder no longer means a newer
kernel was installed, so newer_kernel_installed (utils.sh) also counts a
folder no package owns, and the reboot check, version and finish-install
use it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-26 18:41:50 -07:00
co-authored by Claude Opus 5.5
parent 6dfd62610a
commit 1e2581dcc5
9 changed files with 75 additions and 12 deletions
+6 -6
View File
@@ -15,20 +15,20 @@ CONFIGURE_HINT="configure connects to your Federated Core, sets up backups and s
echo
echo -e "\e[32mCoreDesktop is installed.\e[0m"
# If the running kernel's modules are gone, a newer kernel was installed during
# this run. configure waits for the reboot: until then, modules it needs, such
# as Tailscale's tun and davfs2's fuse, can't be loaded. The reboot waits for
# the initramfs to build.
# If a newer kernel was installed during this run, configure waits for the
# reboot: until then, the modules it needs (Tailscale's tun, davfs2's fuse) are
# at best kernel-modules-hook's temporary copy. The reboot waits for the
# initramfs to build.
if initramfs_build_failed; then
# check_initramfs (install.sh) has said why; offering a reboot now could
# leave the computer unable to start
echo -e "\e[31mDon't reboot yet: the initramfs doesn't build (see above, or $PACMAN_UPDATE_LOG).\e[0m"
if [ ! -d "/usr/lib/modules/$(uname -r)" ]; then
if newer_kernel_installed; then
echo "Once it builds (sudo mkinitcpio -P), reboot, then run: configure"
echo "$CONFIGURE_HINT"
exit 0
fi
elif [ ! -d "/usr/lib/modules/$(uname -r)" ]; then
elif newer_kernel_installed; then
echo "A newer kernel has been installed. Reboot, then run: configure"
echo "$CONFIGURE_HINT"
# The same as the system menu's restart: an active desktop session needs no password