How to Resolve – insmod: ERROR: could not insert module hello.ko: Unknown symbol in module – unknown symbol class_unregister

We tried to write a simple class driver framework which will create a directory in /sys/class, we were able to compile the code but got the following error while trying to install the driver as,

 $ sudo insmod hello.ko 
insmod: ERROR: could not insert module hello.ko: Unknown symbol in module 
$ dmesg

[ 7514.340407] hello: Unknown symbol __class_register (err 0)
[ 7514.340436] hello: Unknown symbol class_unregister (err 0) 

Solution :

The function __class_create is exported only for GPL modules (exported with EXPORT_SYMBOL_GPL). So, you need to use a GPL license with MODULE_LICENSE macro to make use of that function.

Hence if you append your driver code with


and recompile driver and try insmod again, it will definately work and you will not get such errors.

Reference –

Android Android Commands Android Java Applications Application Libraries Bash / Shell Scripts Bluetooth driver Build Frameworks Commands and Packages Content Management System - CMS Core Kernel C Programs Development Environment Setup Errors & Failures File Systems git Go Language Programs Hardware Platforms Home HTML JAVA Programs Kernel & Device Drivers Kernel Booting and Porting Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL NDK / Middleware / HAL Network Driver OS Concepts PHP Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Userspace Utilities Web design and development Wordpress Yocto / Bitbake / Openembedded

Leave a Reply