Kernel module compiling error

ratheesh kannoth ratheesh.ksz at gmail.com
Mon Dec 11 08:00:52 UTC 2023


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