I recently went through Unpacking kernel-source rpm off-system (OpenSuse)?; and as it took > 10 h on my machine, imagine my surprise that after doing the process described there, I find no Module.symvers anywhere!

When I search for "generate Module.symvers", I get this:

NOTE: "modules_prepare" will not build Module.symvers even if
CONFIG_MODVERSIONS is set; therefore, a full kernel build needs to be
executed to make module versioning work.
(Linux Kernel Documentation :: kbuild : modules.txt)

... but I don't really get it - didn't the kernel get built in the previous step (described in the link given above? I sure know it took > 10 h for CC to generate a whole bunch of *.o files, and LD to link them, so something must have been built. But if so, where is then Module.symvers?

In more explicit terms, exactly what command should I call to generate Module.symvers? I know that make prepare will not work - but what is the command that will?

  • FYI, on opensuse, you may get Module.symvers by zypper install kernel-source, and similar on other linux distro. The file is located in lib/modules/xxx/build. – Syrtis Major Mar 31 '16 at 16:22

The Module.symvers is (re)generated when you (re)compile modules. Run make modules, and you should get a Module.symvers file at the root of the kernel tree.

Note that if you only ran make and not make modules, you haven't built any modules yet. The symbols from the kernel itself (vmlinux or one of the architecture-dependent image formats) are in System.map.

  • Many thanks for that, @Gilles - I had since also found Answer : Module.symvers file; and can confirm that make modules does indeed create Module.symvers. Thanks also for clarifying the difference between make and make modules, and relationship to System.map. Cheers! – sdaau Nov 17 '11 at 21:51
  • What if "make" is unavailable on the machine? – bzupnick Oct 25 '15 at 12:37
  • 3
    @bzupnick Install it. It's one of the necessary tools to build Linux kernel modules. A lot of software requires make to build. – Gilles 'SO- stop being evil' Oct 25 '15 at 12:47
  • I'm trying to cross-compile a LKM from another machine. Installing things on the first box isn't possible. – bzupnick Oct 25 '15 at 12:50
  • @bzupnick You need to have make to build the module anyway. It's all happening on the build machine, there's nothing to do on the target machine except for insmod. – Gilles 'SO- stop being evil' Oct 25 '15 at 12:56

for people who found this question by googling the warning you get when compiling one of Derek Molloy's sample LKMs: you can simply make an empty one with touch Modules.symvers. if your kernel doesn't use modversions (CRCs used by the operating system to help assure the modules match the kernel) and your module doesn't have any dependencies on other modules, this will be good enough to suppress the warning.

WARNING: Symbol version dump ./Module.symvers
         is missing; modules will have no dependencies and modversions.

the empty file is just as good as the one generated by gcc, which just has the symbols all with the same 0x00000000 CRC value, on a system without modversions.


On CentOS, and maybe other RedHat variants, just extract the corresponding file for your running kernel:

zcat /boot/symvers-$(uname -r).gz > ./Module.symvers

On Ubuntu and maybe other Debian variants, the file seams to be found automatically. However, if you need it, the file is here:

/usr/src/linux-headers-$(uname -r)/Module.symvers
  • I cannot find linux-headers-$(uname -r) folder – King Stone Jul 3 '19 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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