Unknown symbols in Linux kernel modules
Tagged:  •    •  

For an assignment we have to write a module to read a file from the filesystem and make a virtual filesystem for it. Good, with this sentence we continue for the people who still care, since all kernel developers have clicked away this page. Screaming.

OK, basically I copied the code from Greg Kroah-Hartman's article. So it shouldn't be a big deal to compile and run the module. Compiling went flawlessly, however loading it gave the following error.

ubuntu@ubuntu:~/filesystem$ sudo insmod passwdfs.ko
insmod: error inserting 'passwdfs.ko': -1 Unknown symbol in module

dmesg was fortunately a bit more descriptive:

[17181225.008000] passwdfs: Unknown symbol sys_read
[17181225.008000] passwdfs: Unknown symbol sys_open

Recompiling the kernel didn't work (I was left with a big mess actually on Ubuntu).

And this is the solution, I was just lucky to hear it from someone. I couldn't have solved this myself. While copypasting the code from the article, I removed the line

MODULE_LICENSE("GPL");

from the code. Because I don't care about the license for a little university project. Who could have known it would break the module so badly? So re-adding the line solved this quite annoying problem.

I won't touch that line of code again... ever.