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 MODULE_LICENSE("GPL"); and recompile driver and try insmod again, it will definately work and you will not get such errors.

Command line execution

Terminalbash
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 MODULE_LICENSE("GPL");  and recompile driver and try insmod again, it will definately work and you will not get such errors. Reference –  https://stackoverflow.com/questions/29578931/unknown-symbol-class-create-err-0

Implementation details

Reference – https://stackoverflow.com/questions/29578931/unknown-symbol-class-create-err-0

Gotchas and common issues

  • Permission checks - verify user access rights and sudo privileges before executing system-level operations.

  • Environment configuration - double-check path variables and dependency versions to prevent runtime failures.

  • Backup safeguards - maintain configuration backups before applying system or database modifications.

Following these steps ensures clean configuration and reliable execution for insmod: error: could not insert module hello.ko.