Celeb Glow
news | March 27, 2026

Compile LKM Raspberry Pi - Permission denied

I'm following the first example of a Hello World LKM and now I need to compile it.

According to the book, the Makefile needs to be like this:

obj-m+=hello_world.o
all: make -C /lib/modules/$(shell uname -r)/build/ M=$(pwd) modules
clean: make -C /lib/modules/$(shell uname -r)/build/ M=$(pwd) clean

And then you need to run make (and it says that you souldn't run sudo make or you'll recompile all Linux kernel headers).

By running this it outputs:

make -C /lib/modules/5.10.63+/build/ M= modules
make[1]: Entering directory '/usr/src/rpi-5.10.y'
/bin/sh: 1: cannot create include/generated/uapi/linux/.version.h.tmp: Permission denied UPD include/generated/uapi/linux/version.h
mv: cannot stat 'include/generated/uapi/linux/.version.h.tmp': No such file or directory
make[1]: *** [Makefile:1277: include/generated/uapi/linux/version.h] Error 1
make[1]: Leaving directory '/usr/src/rpi-5.10.y'
make: *** [Makefile:4: all] Error 2

And if I run sudo make or change the Makefile commands by sudo make -C ... it never ends (>2h and still waiting).

I couldn't run sudo apt install linux-headers-'uname -r' (ignore the ', they are ` but I can't place it here) because the kernel it's the last one (5.10.63+), but I have followed all the steps on the book that tells how to manually compile all Linux kernel headers, so I should have them.

Any idea? If you need some extra information just tell me what command I need to run and I'll attach the output.

Thanks!

3 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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