Build problem with custom kernel module

Just ran into a build problem with a custom kernel module I use. On attempting to rebuild the module for kernel 5.14.0-611.13.1.el9_7.x86_64, I got:

[dave@burn kernel]$ make clean

rm -f mhvtl.ko
rm -f *.o
rm -f TAGS
rm -f config.h
[dave@burn kernel]$ make
./config.sh
make -C /lib/modules/5.14.0-611.13.1.el9_7.x86_64/build M=/home/dave/noBackup/build/mhvtl-master/kernel modules
make[1]: Entering directory ‘/usr/src/kernels/5.14.0-611.13.1.el9_7.x86_64’
CC [M] /home/dave/noBackup/build/mhvtl-master/kernel/mhvtl.o
MODPOST /home/dave/noBackup/build/mhvtl-master/kernel/Module.symvers
CC [M] /home/dave/noBackup/build/mhvtl-master/kernel/mhvtl.mod.o
LD [M] /home/dave/noBackup/build/mhvtl-master/kernel/mhvtl.ko
BTF [M] /home/dave/noBackup/build/mhvtl-master/kernel/mhvtl.ko
Skipping BTF generation for /home/dave/noBackup/build/mhvtl-master/kernel/mhvtl.ko due to unavailability of vmlinux
make[1]: Leaving directory ‘/usr/src/kernels/5.14.0-611.13.1.el9_7.x86_64’

The workaround was to just manually complete the module installation:

[root@burn kernel]# install -o root -g root -m 644 mhvtl.ko /lib/modules/5.14.0-611.13.1.el9_7.x86_64/kernel/drivers/scsi/; depmod -a
[root@burn kernel]# modprobe mhvtl
[root@burn kernel]# lsmod | grep mhvtl
mhvtl 61440 0
[root@burn kernel]# systemctl start mhvtl.target
[root@burn kernel]# systemctl status mhvtl.target
● mhvtl.target - mhvtl service allowing to start/stop all vtltape@.service and vtllibrary@.service instances at once
Loaded: loaded (/usr/lib/systemd/system/mhvtl.target; enabled; preset: disabled)
Active: active since Sat 2025-12-13 21:04:42 MST; 38min ago
Until: Sat 2025-12-13 21:04:42 MST; 38min ago
Docs: man:man:vtltape(1)
man:man:vtllibrary(1)

Dec 13 21:04:42 burn.local.davenjudy.org systemd[1]: Reached target mhvtl service allowing to start/stop all vtltape@.s>

Was this a build/packaging problem at Rocky or RHEL?

I’m failing to see what the problem is in your output. Can you make it more clearer what exactly the problem is?

Your first output you seem to suggest the solution to that was to manually install the module, and then you modprobe it and all looks fine. Then you list the systemctl output but I don’t see any problem there either.

Would be better for you to make it much clearer with a bit more detail into what exactly the problem is. Because I don’t see anything in what you posted so far.

The make is supposed to include performing the install. make detects the warning and bails out. BTF generation is adding some sort of debugging information which could be important to developers. The workaround worked for me but what I could find regarding the issue indicated that that might not always be the case. I’d rather flag something like this than ignore it because the workaround worked for me.

Hmm, usually when I’ve used make commands, you need to use make install after the make command. Maybe it’s different for kernel modules, I dunno.

But yeah you are right to flag it if the BTF message didn’t appear before. Although all it’s doing is skipping that part due to not finding vmlinuz for some reason.

In addition, the ‘make’ command in the original post is being run as standard user, so not sure how it could install a kernel module?

Normally I would do a “sudo make install” as the next step after the make. Previous experience (other projects) has been that this won’t work unless the make completed successfully. That seems not to be the case with this particular problem. I tried doing a sudo make install after this failed make and it worked.

1 Like

But earlier on, you said

Now you say you have to run ‘make install’ as root, so which is it?

Forgot. Happens when I try to remember infrequently performed tasks. Is thiis punishable by death or just life imprisonment?

Nah, just prob time for a beer and relax :slight_smile:

Nothing wrong with forgetting, it was just hard to make sense of the steps being shown.

Traditionally the ‘install’ rule in makefile copies the “products” of build to somewhere where they are used. For normal applications that somewhere – the “prefix” – tends to be /user/local, so the install copies executables to /user/local/bin/ and so forth. Since only root can write to /user/local (by default), only root can copy there. The /lib/modules is likewise read-only for non-roots. (One can usually redefine the prefix with ./configure)

Preferably none of the build is done as root (but then one has to install by other means), and running make install as root is a compromise. Anyway, the default target (invoked by plain make) does not include the ‘install’ target (for normal applications – don’t know about kernel modules – the rules are in the Makefile). (It could, but I cannot recall any example.)