On EndeavourOS and possibly Arch based distros, I have observed that when the kernel is updated /lib/modules/<previous-kernel-directory> is removed. So any attempt to load modules after that fails.
I hit this when I migrated on my work box from Ubuntu to EndeavourOS. FTR this doesn’t happen on Ubuntu, I guess they tidy-up on the next boot cycle.
I guess the lesson is reboot after the kernel is updated, and for me in particular - update the work box at the end of the work day.
What was surprising to me was that this happened after a reboot. I saw in htop that the swap was not there. That was the strange thing about it. Upon loading the module manually and rebooting again, it did work.
@pebcak oooh, that is surprising. As I said I have fallen foul of this before, and it appears that the problem went away after rebooting which is weird (at least to me). I don’t think manually loading the module in a prior iteration should have an effect. For that one should add the module to a file under /etc/modules.d for example I created /etc/modules.d/terraform with
Arch has one kernel package whereas Ubuntu has a package for every kernel version. When the Arch kernel package is upgraded the files are removed from disk so it’s not possible to load modules for the old but running kernel (because they’re not on disk any more). When an Ubuntu kernel package is installed the old and running version still has files on disk.