zfs – arch pacman insists on wrong kernel version

Output from uname -a

Linux janus 5.15.85-1-lts #1 SMP Thu, 22 Dec 2022 06:22:00 +0000 x86_64 GNU/Linux

When I build zfs-liunx I get:

checking kernel source and build directories... done
checking kernel source directory... /usr/lib/modules/6.1.1-arch1-1/build
checking kernel build directory... /usr/lib/modules/6.1.1-arch1-1/build

I don’t understand why it is checking module folders that are no longer on the system. But if they were (I moved the newer /lib/modules/) I get this when modprobing:

FATAL: Module zfs not found in directory /lib/modules/5.15.85-1-lts

How do I tell pacman to ignore kernels that are no longer in use?

Read more here: Source link