One potential issue when upgrading the Arch Linux kernel is that the modules of the currently running kernel may be deleted. This can lead to a number of problems, including unexpected behavior, system crashes, or the inability to mount certain file systems (e.g. the kernel fails to mount a vfat file system due to the unavailability of the vfat kernel module).
The Arch Linux package linux-keep-modules (also available on AUR: linux-keep-modules @AUR), written by James Cherti, provides a solution to ensure that the modules of the currently running Linux kernel remain available until the operating system is restarted. Additionally, after a system restart, the script automatically removes any unnecessary kernel modules that might have been left behind by previous upgrades (e.g. the kernel modules that are not owned by any Arch Linux package and are not required by the currently running kernel).
The linux-keep-modules package keeps your system running smoothly and maintains stability even during major Linux kernel upgrades.
Make and install the linux-keep-modules package
Clone the repository and change the current directory to ‘archlinux-linux-keep-modules/’:
$ git clone https://github.com/jamescherti/archlinux-linux-keep-modules.git
$ cd archlinux-linux-keep-modules/
Code language: plaintext (plaintext)
Use makepkg to make linux-keep-modules package:
$ makepkg -f
Code language: plaintext (plaintext)
Install the linux-keep-modules
package:
$ sudo pacman -U linux-keep-modules-*-any.pkg.tar.*
Code language: plaintext (plaintext)
Finally, enable the cleanup-linux-modules service:
$ sudo systemctl enable cleanup-linux-modules
Code language: plaintext (plaintext)
(The cleanup-linux-modules service will delete the Linux kernel modules that are not owned by any a package at boot time)
The linux-keep-modules Arch Linux package offers a solution to preserve kernel modules during and after upgrades, ensuring that the necessary modules for the currently running kernel remain present in the system even after the kernel is upgraded. This solution keeps your system running smoothly and maintains stability even during major upgrades.