xanmod-kernel-WSL2 icon indicating copy to clipboard operation
xanmod-kernel-WSL2 copied to clipboard

Help: Installing Linux kernel headers

Open ayushbindlish opened this issue 2 years ago • 4 comments

The kernel headers are missing. How can I get the kernel headers? And how do I install them? I know how to do it on Ubuntu but not too sure about wsl.

ayushbindlish avatar Jan 27 '23 15:01 ayushbindlish

Since we're using custom kernels on WSL, there's no corresponding linux-headers-* package on Debian or Ubuntu (this is the same situation for MS's official WSL2 kernel). AFAIK we have to build kernel from source and do make headers_install to get kernel headers installed.

But I'm not sure whether enabling CONFIG_IKHEADERS=y is helpful (mentioned at microsoft/WSL#5526). I've attached a bzImage built with the option enabled, can you try it?

👉 bzImage.txt (github doesn't allow to upload files without extension, so I just add .txt)

Locietta avatar Jan 28 '23 08:01 Locietta

Let me give it a try and I'll get back to you.

ayushbindlish avatar Apr 16 '23 16:04 ayushbindlish

I am not too sure how to verify this. A lot of packages are trying to access: linux-headers-6.1.8-locietta-WSL2-xanmod1

dpkg gives the following output:

 dpkg -l | grep linux-                                                                                                                                                                                 130 ↵
ii  binutils-x86-64-linux-gnu         2.38-4ubuntu2.1                         amd64        GNU binary utilities, for x86-64-linux-gnu target
ii  linux-libc-dev:amd64              5.15.0-71.78                            amd64        Linux Kernel Headers for development
ii  linux-tools-5.15.0-71             5.15.0-71.78                            amd64        Linux kernel version specific tools for version 5.15.0-71
ii  linux-tools-5.15.0-71-generic     5.15.0-71.78                            amd64        Linux kernel version specific tools for version 5.15.0-71
ii  linux-tools-common                5.15.0-71.78                            all          Linux kernel version specific tools for version 5.15.0
ii  linux-tools-generic               5.15.0.71.69                            amd64        Generic Linux kernel tools
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:        22.04
Codename:       jammy

uname -r
6.1.8-locietta-WSL2-xanmod1

@Locietta

ayushbindlish avatar Apr 29 '23 20:04 ayushbindlish

Seems another custom Kernel project solved it this way:

https://github.com/Nevuly/WSL2-Linux-Kernel-Rolling/wiki#kernel-modules-and-kernel-headers-installation-guide

Could add build of and distribute xanmod-kernel-WSL2 headers with release?