如何获取WSL2内核头?

问题描述 投票:0回答:1

如何获取 WSL2 Ubuntu24.04 的内核头文件?

使用运行 Ubuntu24.04 的 WSL2 运行 Windows 10,当我尝试构建 DKMS Linux 内核模块时,出现错误

$ sudo dkms 构建 eatmydata/0.1

错误!无法在 /lib/modules/5.15.133.1-microsoft-standard-WSL2/build 或 /lib/modules/5.15.133.1-microsoft-standard-WSL2/ 中找到内核 5.15.133.1-microsoft-standard-WSL2 的内核标头来源。

请安装 linux-headers-5.15.133.1-microsoft-standard-WSL2 软件包或使用 --kernelsourcedir 选项告诉 DKMS 它的位置。

通常这可以用

sudo apt install linux-headers-$(uname -r)
来解决,但是
linux-headers-5.15.133.1-microsoft-standard-WSL2
在 apt 中不可用,我的选择是:

$ uname -r
5.15.133.1-microsoft-standard-WSL2
$ sudo apt install linux-headers-
Display all 203 possibilities? (y or n)
linux-headers-6.11.0-1002-nvidia            linux-headers-6.8.0-1009-oem                linux-headers-6.8.0-1014-nvidia-lowlatency  linux-headers-6.8.0-1020-nvidia             linux-headers-6.8.0-50-lowlatency
linux-headers-6.11.0-1007-oem               linux-headers-6.8.0-1010-aws                linux-headers-6.8.0-1014-oem                linux-headers-6.8.0-1020-nvidia-lowlatency  linux-headers-6.8.0-51
linux-headers-6.11.0-1008-oem               linux-headers-6.8.0-1010-azure              linux-headers-6.8.0-1014-oracle             linux-headers-6.8.0-1021-aws                linux-headers-6.8.0-51-generic
linux-headers-6.11.0-1009-oem               linux-headers-6.8.0-1010-gcp                linux-headers-6.8.0-1015-aws                linux-headers-6.8.0-31                      linux-headers-aws
linux-headers-6.11.0-1010-oem               linux-headers-6.8.0-1010-gke                linux-headers-6.8.0-1015-azure              linux-headers-6.8.0-31-generic              linux-headers-azure
linux-headers-6.8.0-1001-gkeop              linux-headers-6.8.0-1010-ibm                linux-headers-6.8.0-1015-gcp                linux-headers-6.8.0-31-lowlatency           linux-headers-gcp
linux-headers-6.8.0-1002-gkeop              linux-headers-6.8.0-1010-nvidia             linux-headers-6.8.0-1015-gke                linux-headers-6.8.0-35                      linux-headers-generic
linux-headers-6.8.0-1003-gke                linux-headers-6.8.0-1010-oem                linux-headers-6.8.0-1015-ibm                linux-headers-6.8.0-35-generic              linux-headers-generic-hwe-24.04
linux-headers-6.8.0-1003-gkeop              linux-headers-6.8.0-1010-oracle             linux-headers-6.8.0-1015-nvidia             linux-headers-6.8.0-35-lowlatency           linux-headers-generic-hwe-24.04-edge
linux-headers-6.8.0-1004-gke                linux-headers-6.8.0-1011-aws                linux-headers-6.8.0-1015-nvidia-lowlatency  linux-headers-6.8.0-36                      linux-headers-gke
linux-headers-6.8.0-1005-gke                linux-headers-6.8.0-1011-gcp                linux-headers-6.8.0-1015-oracle             linux-headers-6.8.0-36-generic              linux-headers-gkeop
linux-headers-6.8.0-1005-ibm                linux-headers-6.8.0-1011-gke                linux-headers-6.8.0-1016-aws                linux-headers-6.8.0-36-lowlatency           linux-headers-gkeop-6.8
linux-headers-6.8.0-1005-intel              linux-headers-6.8.0-1011-ibm                linux-headers-6.8.0-1016-azure              linux-headers-6.8.0-38                      linux-headers-ibm
linux-headers-6.8.0-1005-oem                linux-headers-6.8.0-1011-nvidia             linux-headers-6.8.0-1016-gcp                linux-headers-6.8.0-38-generic              linux-headers-ibm-classic
linux-headers-6.8.0-1005-oracle             linux-headers-6.8.0-1011-nvidia-lowlatency  linux-headers-6.8.0-1016-gke                linux-headers-6.8.0-38-lowlatency           linux-headers-ibm-lts-24.04
linux-headers-6.8.0-1006-gke                linux-headers-6.8.0-1011-oem                linux-headers-6.8.0-1016-ibm                linux-headers-6.8.0-39                      linux-headers-kvm
linux-headers-6.8.0-1006-ibm                linux-headers-6.8.0-1011-oracle             linux-headers-6.8.0-1016-oem                linux-headers-6.8.0-39-generic              linux-headers-lowlatency
linux-headers-6.8.0-1006-intel              linux-headers-6.8.0-1012-aws                linux-headers-6.8.0-1016-oracle             linux-headers-6.8.0-39-lowlatency           linux-headers-lowlatency-hwe-20.04
linux-headers-6.8.0-1006-oem                linux-headers-6.8.0-1012-azure              linux-headers-6.8.0-1017-aws                linux-headers-6.8.0-40                      linux-headers-lowlatency-hwe-20.04-edge
linux-headers-6.8.0-1006-oracle             linux-headers-6.8.0-1012-gcp                linux-headers-6.8.0-1017-azure              linux-headers-6.8.0-40-generic              linux-headers-lowlatency-hwe-22.04
linux-headers-6.8.0-1007-azure              linux-headers-6.8.0-1012-gke                linux-headers-6.8.0-1017-gcp                linux-headers-6.8.0-40-lowlatency           linux-headers-lowlatency-hwe-22.04-edge
linux-headers-6.8.0-1007-gcp                linux-headers-6.8.0-1012-ibm                linux-headers-6.8.0-1017-ibm                linux-headers-6.8.0-41                      linux-headers-lowlatency-hwe-24.04
linux-headers-6.8.0-1007-gke                linux-headers-6.8.0-1012-nvidia             linux-headers-6.8.0-1017-nvidia             linux-headers-6.8.0-41-generic              linux-headers-lowlatency-hwe-24.04-edge
linux-headers-6.8.0-1007-ibm                linux-headers-6.8.0-1012-nvidia-lowlatency  linux-headers-6.8.0-1017-nvidia-lowlatency  linux-headers-6.8.0-41-lowlatency           linux-headers-nvidia
linux-headers-6.8.0-1007-nvidia             linux-headers-6.8.0-1012-oem                linux-headers-6.8.0-1017-oem                linux-headers-6.8.0-44                      linux-headers-nvidia-6.11
linux-headers-6.8.0-1007-oem                linux-headers-6.8.0-1012-oracle             linux-headers-6.8.0-1017-oracle             linux-headers-6.8.0-44-generic              linux-headers-nvidia-hwe-24.04-edge
linux-headers-6.8.0-1008-aws                linux-headers-6.8.0-1013-aws                linux-headers-6.8.0-1018-aws                linux-headers-6.8.0-44-lowlatency           linux-headers-nvidia-lowlatency
linux-headers-6.8.0-1008-azure              linux-headers-6.8.0-1013-azure              linux-headers-6.8.0-1018-azure              linux-headers-6.8.0-45                      linux-headers-oem-20.04
linux-headers-6.8.0-1008-gcp                linux-headers-6.8.0-1013-gcp                linux-headers-6.8.0-1018-gcp                linux-headers-6.8.0-45-generic              linux-headers-oem-20.04b
linux-headers-6.8.0-1008-gke                linux-headers-6.8.0-1013-gke                linux-headers-6.8.0-1018-ibm                linux-headers-6.8.0-45-lowlatency           linux-headers-oem-20.04c
linux-headers-6.8.0-1008-ibm                linux-headers-6.8.0-1013-ibm                linux-headers-6.8.0-1018-nvidia             linux-headers-6.8.0-47                      linux-headers-oem-20.04d
linux-headers-6.8.0-1008-nvidia             linux-headers-6.8.0-1013-nvidia             linux-headers-6.8.0-1018-nvidia-lowlatency  linux-headers-6.8.0-47-generic              linux-headers-oem-22.04
linux-headers-6.8.0-1008-oem                linux-headers-6.8.0-1013-nvidia-lowlatency  linux-headers-6.8.0-1018-oem                linux-headers-6.8.0-47-lowlatency           linux-headers-oem-24.04
linux-headers-6.8.0-1008-oracle             linux-headers-6.8.0-1013-oem                linux-headers-6.8.0-1018-oracle             linux-headers-6.8.0-48                      linux-headers-oem-24.04a
linux-headers-6.8.0-1009-aws                linux-headers-6.8.0-1013-oracle             linux-headers-6.8.0-1019-aws                linux-headers-6.8.0-48-generic              linux-headers-oem-24.04b
linux-headers-6.8.0-1009-azure              linux-headers-6.8.0-1014-aws                linux-headers-6.8.0-1019-gcp                linux-headers-6.8.0-48-lowlatency           linux-headers-oracle
linux-headers-6.8.0-1009-gcp                linux-headers-6.8.0-1014-azure              linux-headers-6.8.0-1019-nvidia             linux-headers-6.8.0-49                      linux-headers-virtual
linux-headers-6.8.0-1009-gke                linux-headers-6.8.0-1014-gcp                linux-headers-6.8.0-1019-nvidia-lowlatency  linux-headers-6.8.0-49-generic              linux-headers-virtual-hwe-24.04
linux-headers-6.8.0-1009-ibm                linux-headers-6.8.0-1014-gke                linux-headers-6.8.0-1019-oem                linux-headers-6.8.0-49-lowlatency           linux-headers-virtual-hwe-24.04-edge
linux-headers-6.8.0-1009-nvidia             linux-headers-6.8.0-1014-ibm                linux-headers-6.8.0-1020-aws                linux-headers-6.8.0-50                      
linux-headers-6.8.0-1009-nvidia-lowlatency  linux-headers-6.8.0-1014-nvidia             linux-headers-6.8.0-1020-gcp                linux-headers-6.8.0-50-generic

因此我被困住了。如何获取内核头文件?

linux-kernel windows-subsystem-for-linux dkms linux-kernel-headers
1个回答
0
投票

您可以在这里下载:

https://kernel.ubuntu.com/mainline/v5.15.133/

并重命名/链接到

5.15.133.1-microsoft-standard-WSL2

© www.soinside.com 2019 - 2024. All rights reserved.