Kernel module compiling error
Jacob Martin
jacob.martin at canonical.com
Mon Dec 11 15:17:08 UTC 2023
Hi Ratheesh,
The module appears to build correctly, but the kernel refuses to load it
because it is unsigned and you have Secure Boot enabled. You can either
sign the module with your own Secure Boot key [1], or disable Secure
Boot in your system's UEFI firmware settings (not recommended).
DKMS can be configured [2] to automatically build and sign out-of-tree
kernel modules when the kernel updates.
Jacob
[1] https://ubuntu.com/blog/how-to-sign-things-for-secure-boot
[2] https://help.ubuntu.com/community/DKMS
On 12/11/23 2:00 AM, ratheesh kannoth wrote:
> Hi Lists,
>
> I face below issue while compiling a simple kernel module (which i
> could not load). And NOT able to install the compiler
> x86_64-linux-gnu-gcc-12. Please find the ubuntu and linux versions
> below.
> -Ratheesh
>
>
>
> test at hyd1lab5test:~/work/hello$ make
> make -C /lib/modules/6.1.0-1006-oem/build/ M=/home/test/work/hello modules
> make[1]: Entering directory '/usr/src/linux-headers-6.1.0-1006-oem'
> warning: the compiler differs from the one used to build the kernel
> The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu
> 12.1.0-2ubuntu1~22.04) 12.1.0
> You are using: gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
> CC [M] /home/test/work/hello/hello.o
> MODPOST /home/test/work/hello/Module.symvers
> CC [M] /home/test/work/hello/hello.mod.o
> LD [M] /home/test/work/hello/hello.ko
> BTF [M] /home/test/work/hello/hello.ko
> Skipping BTF generation for /home/test/work/hello/hello.ko due to
> unavailability of vmlinux
> make[1]: Leaving directory '/usr/src/linux-headers-6.1.0-1006-oem'
> test at hyd1lab5test:~/work/hello$ sudo insmod ./hello.ko
> insmod: ERROR: could not insert module ./hello.ko: Key was rejected by service
>
> test at hyd1lab5test:~/work/hello$ sudo apt-get install x86_64-linux-gnu-gcc-12
> Reading package lists... Done
> Building dependency tree... Done
> Reading state information... Done
> E: Unable to locate package x86_64-linux-gnu-gcc-12
>
>
>
>
> test at hyd1lab5test:~/work/hello$ cat /etc/lsb-release
> DISTRIB_ID=Ubuntu
> DISTRIB_RELEASE=22.04
> DISTRIB_CODENAME=jammy
> DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"
>
> test at hyd1lab5test:~/work/hello$ uname -a
> Linux hyd1lab5test 6.1.0-1006-oem #6-Ubuntu SMP PREEMPT_DYNAMIC Tue
> Jan 24 18:24:09 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
>
>
> test at hyd1lab5test:~/work/hello$ gcc-12 --version
> gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
> Copyright (C) 2022 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
More information about the kernel-team
mailing list