I have a problem with DKMS building bad modules (insmod reports "Invalid module format"). If i run DKMS manually to build and install the modules it works fine, but when done automatically in conjunction with the Software Updater the modules don't build correctly.

I'm assuming DKMS builds with incorrect headers when the kernel is being updated? Any idea how I can investigate this further?


Not sure why but there seems to be multiple dkms.conf for each module:

find / -name dkms.conf


cat /etc/modprobe.d/dkms.conf

# modprobe information used for DKMS modules
# This is a stub file, should be edited when needed,
# used by default by DKMS.

cat /usr/src/8812au-4.2.2/dkms.conf


There's no difference between the two 8812au dkms.conf files:

diff /usr/src/8812au-4.2.2/dkms.conf /var/lib/dkms/8812au/4.2.2/build/dkms.conf


cat /etc/issue

elementary OS Freya \n \l


New kernel update, same thing happened.

I recorded my interactions so you can see everything seems fine. Video is a bit slow so i suggest using the links in description to jump to the interesting bits.

Before update: https://asciinema.org/a/7huqhlw0kp1iv10n4741y8rq6?t=6

After update: https://asciinema.org/a/2h2zf8j8fbgvup7rkc531sgxx?t=5

As you can see above DKMS compiles and installs the kernel module correctly, but it fails to load on the new kernel version. Simply running dkms uninstall/remove/build/install manually fixes the problem.

I'm not sure why when run automatically it doesnt work. Could it be that I need to run make clean beforehand or something silly like that?

Any help greatly appreciated.

  • Please edit the question to add the contents of the dkms.conf
    – Jeremy31
    Commented Mar 19, 2016 at 16:27

1 Answer 1


I'm now fairly confident I found the issue. Judging by cat /var/lib/dkms/8812au/kernel-3.19.0-58-generic-x86_64/log/make.log the module is always build against $(uname -r) headers.

I tried using DKMS to manually building the module against an older kernel version and that did not work either. I got this working after editing the Makefile for the module and set it to build against $kernelver instead. THis variable is set up by DKMS with the name of the target kernel.

This should also fix the issue with the module not building after kernel updates.

Hope this might help someone else in the future.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.