Score:1

How to install kernel headers for custom kernel?

bd flag

I am using Ubuntu 22.04. The default kernel is 5.15.0-56. However, because I have issue with my laptop keyboard (bug id #216158, I should patch the kernel. There are steps how I patch the kernel.

uname -r (to check current kernel version: 5.15.0-56)

apt source linux-image-unsigned-5.15.0-56
cd ./linux-5.15.0
patch -p1 < ../path/to/patchfile
make oldconfig
make -j 16
make modules_install
make install

The bug has been fixed, but I don't know why my kernel change to 5.15.64. Though I use 5.15.0 as source file and use old kernel config.

And when I tried to install VMWare Workstation. I prompted to the following window:

Install VMware Workstation

It caused by directory /usr/src/linux-headers-5.15.64 not found.

My question is:

  1. Why the kernel version changed from 5.15.0-56 to 5.15.64 even I use version 5.15.0 as source kernel file?
  2. How to generate directory /usr/src/linux-headers-5.15.64 ?

These are kernel installed on my machine.

$ dpkg --list | grep "linux-image" | grep "^ii"
ii  linux-image-5.15.0-25-generic              5.15.0-25.25                               amd64        Signed kernel image generic
ii  linux-image-5.15.0-56-generic              5.15.0-56.62                               amd64        Signed kernel image generic
ii  linux-image-generic-hwe-22.04              5.15.0.56.54                               amd64        Generic Linux kernel image

Solved The Problem

After @Terrance give me some explanation, I tried to rebuild the kernel using similar steps I mention earlier. However the different is on the kernel's source file. I use the following command.

apt source linux-source-5.15.0

However, There is no kernel header located on /usr/src, however I can run VMWare Workstation 17 properly.

Terrance avatar
id flag
Can you add the output of `dpkg --list | grep "linux-image" | grep "^ii"` to your question as this will show your currently installed Kernels? Thank you!
xdnroot avatar
bd flag
@Terrance I already update the post, please take a look.
Terrance avatar
id flag
So, the Kernel in question from VMWare is not installed. Sounds like it might be a bug in VMWare. Maybe you need to redownload it or purge it completely from the system and try installing it again.
xdnroot avatar
bd flag
@Terrance I don't think so, vmware needs kernel header version 5.15.64. However it's not available on /usr/src. I tried vmware 16 and 17, both has similar issue.
Terrance avatar
id flag
Something is really messed up there. The only place I can find that reference to that kernel version is in the unsigned kernel version you used that points to a Debian and not Ubuntu kernel. `debian.master/upstream-stable: linux-5.15.y = v5.15.64` That kernel version would be a mainline kernel, but it is not available in the mainline site: https://kernel.ubuntu.com/~kernel-ppa/mainline/ +1 to help you on your way, but I am out as I can't see anything other than that file that might have carried into the patch of the kernel and that is what VMWare is finding.
xdnroot avatar
bd flag
@Terrance Thank you for your explanation. I changed linux-source-5.15.0 instead of linux-image-unsigned-5.15.0-56 and it solved my problem.
Score:0
mw flag

I was able to fix the problem in a different way.

https://youtu.be/xOnrdMQd1vU

sudo apt-get update && sudo apt-get upgrade -y

sudo apt-get install gcc build-essentials -y

Download VMware Workstation 17 https://www.vmware.com/go/getworkstation-linux

cd Downloads && chmod u+x VMware* && sudo ./VMware*

Run these commands in your terminal

openssl req -new -x509 -newkey rsa:2048 -keyout VMWARE17.priv -outform DER -out VMWARE17.der -nodes -days 36500 -subj "/CN=VMWARE/"

sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./VMWARE17.priv ./VMWARE17.der $(modinfo -n vmmon)

sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./VMWARE17.priv ./VMWARE17.der $(modinfo -n vmnet)

tail $(modinfo -n vmmon) | grep "Module signature appended"

sudo mokutil --import VMWARE17.der

After you have finished all of the commands above, you need to reboot your machine and then Enroll MOK (your key) and then reboot again. When you log back in, you will be good to go!

mokutil --test-key VMWARE17.der

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.