installing arch packages requires a reboot
Not always, but not infrequently. I think most long-time Arch users know this, but it can be helpful to spell it out.
Consider the following issues:
- If you need to load kernel modules, the installed kernel must match the running kernel. (the legendary FS#16702)
- If you update your kernel, you must reboot in order to match the installed and the running kernel versions.
- Whenever you update your system, that may include a kernel update.
- Whenever you update your package database, you must update your system to avoid a partial update.
- A slightly outdated package database may refer to packages that aren't available in the mirrors any more, requiring you to update your package database to install the package.
This is how it usually works for me:
- I want to install cool-new-package.
pacman -S cool-new-package
looks like it will work, but then some dependency 404s on all the mirrors. I guess my package database is out of date and the old package is no longer available.- I shouldn't do just
pacman -Sy
, so I guess I will just upgrade my system (pacman -Syu
). Oh, looks like the kernel got updated. Oh well. - Now I can install my package :) by running
pacman -S cool-new-package
. (btw, you can do these two steps together by runningpacman -Syu cool-new-package
.) - Now I go to plug in my USB drive, or my USB-C headphones, or do anything else that requires loading a kernel module, and it silently doesn't work. Guess I need to reboot! >:(
Several of these issues are fixable, but require concessions.
#1/#2 can be fixed by some of the various proposals in the linked bug. For instance, handling modules by some mechanism outside pacman, or by creating a different package for each kernel version. There are no beautiful solutions, but there are solutions. Many people use kernel-modules-hook (available in extra) to work around this issue, which works, but it feel like a hack and I think it will cause problems if you need to downgrade the linux package later for whatever reason.
#3 can be fixed by excluding the linux kernel from updates. This is technically a partial update but mostly it seems fine when specifically limited to the kernel packages. But now don't forget to actually update your kernel before you reboot!
#4 is essentially unavoidable and is a core design choice of Arch.
#5 could be avoided by keeping old packages in the mirrors for a bit of time, though this is likely to significantly blow up the size of the mirror and would require careful handling with mirror providers (and it's not obviously worth it). Alternatively, u/Gozenka pointed out that if you can't get some old packages from mirrors, you could grab them from the Arch Linux Archive to avoid needing to update your package database. I don't think there's a particularly simple way to do this, it would probably be an annoying manual process. I might look into it more though.
File this under "weird papercuts that have been around so long you forget how confusing they are" right next to the thing where old packages 404 without pacman ever telling you that you need -Sy.
Updated 2024-07-30 15:30 to include mention of kernel-modules-hook and the Arch Linux Archive.
If you post a reply on another blog or social media, or just want to chat, email me! christopher@cg505.com