![概括](https://linux22.com/image/1027731/%E6%A6%82%E6%8B%AC.png)
概括
我最近从 Ubuntu 20.04 升级到了 22.04,从那时起,我就无法安装内核头文件,并且出现错误。最初,我遇到的错误是由于缺少柔性和野牛。手动安装这些后,我遇到了下面的错误,无法解决。
错误
尝试安装linux-headers-5.15.0-47-generic
(以及几个旧版本)失败,并返回错误状态制作在 dkms 模块构建期间。
Apt 说检查 make 日志,其中有以下错误:
No rule to make target 'arch/x86/entry/syscalls/syscall_32.tbl',
needed by 'arch/x86/include/generated/uapi/asm/unistd_32.h'
完整 apt 输出
$ sudo apt install --reinstall linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 2,898 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 linux-headers-5.15.0-47-generic amd64 5.15.0-47.51 [2,898 kB]
Fetched 2,898 kB in 0s (6,016 kB/s)
(Reading database ... 191529 files and directories currently installed.)
Preparing to unpack .../linux-headers-5.15.0-47-generic_5.15.0-47.51_amd64.deb ...
Unpacking linux-headers-5.15.0-47-generic (5.15.0-47.51) over (5.15.0-47.51) ...
Setting up linux-headers-5.15.0-47-generic (5.15.0-47.51) ...
/etc/kernel/header_postinst.d/dkms:
* dkms: running auto installation service for kernel 5.15.0-47-generic
Kernel preparation unnecessary for this kernel. Skipping...
Building module:
cleaning build area...(bad exit status: 2)
make -j4 KERNELRELEASE=5.15.0-47-generic all INCLUDEDIR=/lib/modules/5.15.0-47-generic/build/include KVERSION=5.15.0-47-generic DKMS_BUILD=1....(bad exit status: 2)
Error! Bad return status for module build on kernel: 5.15.0-47-generic (x86_64)
Consult /var/lib/dkms/evdi/5.2.14/build/make.log for more information.
...done.
make 日志的完整内容
$ sudo cat /var/lib/dkms/evdi/5.2.14/build/make.log
DKMS make.log for evdi-5.2.14 for kernel 5.15.0-47-generic (x86_64)
Sat Sep 3 09:55:26 AM CDT 2022
make KBUILD_VERBOSE=1 SUBDIRS=/var/lib/dkms/evdi/5.2.14/build SRCROOT=/var/lib/dkms/evdi/5.2.14/build CONFIG_MODULE_SIG= -C /lib/modules/5.15.0-47-generic/build modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.0-47-generic'
: " SYNC include/config/auto.conf.cmd"
make -f ./Makefile syncconfig
make -f ./scripts/Makefile.build obj=scripts/basic
gcc -Wp,-MMD,scripts/basic/.fixdep.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -o scripts/basic/fixdep scripts/basic/fixdep.c
make -f ./scripts/Makefile.build obj=scripts/kconfig syncconfig
gcc -Wp,-MMD,scripts/kconfig/.conf.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -c -o scripts/kconfig/conf.o scripts/kconfig/conf.c
gcc -Wp,-MMD,scripts/kconfig/.confdata.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -c -o scripts/kconfig/confdata.o scripts/kconfig/confdata.c
gcc -Wp,-MMD,scripts/kconfig/.expr.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -c -o scripts/kconfig/expr.o scripts/kconfig/expr.c
flex -oscripts/kconfig/lexer.lex.c -L scripts/kconfig/lexer.l
bison -o scripts/kconfig/parser.tab.c --defines=scripts/kconfig/parser.tab.h -t -l scripts/kconfig/parser.y
gcc -Wp,-MMD,scripts/kconfig/.menu.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -c -o scripts/kconfig/menu.o scripts/kconfig/menu.c
gcc -Wp,-MMD,scripts/kconfig/.parser.tab.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -I ./scripts/kconfig -c -o scripts/kconfig/parser.tab.o scripts/kconfig/parser.tab.c
gcc -Wp,-MMD,scripts/kconfig/.preprocess.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -c -o scripts/kconfig/preprocess.o scripts/kconfig/preprocess.c
gcc -Wp,-MMD,scripts/kconfig/.symbol.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -c -o scripts/kconfig/symbol.o scripts/kconfig/symbol.c
gcc -Wp,-MMD,scripts/kconfig/.util.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -c -o scripts/kconfig/util.o scripts/kconfig/util.c
gcc -Wp,-MMD,scripts/kconfig/.lexer.lex.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -I ./scripts/kconfig -c -o scripts/kconfig/lexer.lex.o scripts/kconfig/lexer.lex.c
gcc -o scripts/kconfig/conf scripts/kconfig/conf.o scripts/kconfig/confdata.o scripts/kconfig/expr.o scripts/kconfig/lexer.lex.o scripts/kconfig/menu.o scripts/kconfig/parser.tab.o scripts/kconfig/preprocess.o scripts/kconfig/symbol.o scripts/kconfig/util.o
scripts/kconfig/conf --syncconfig Kconfig
make -f ./scripts/Makefile.build obj=arch/x86/entry/syscalls all
make -f ./scripts/Makefile.build obj=scripts/basic
set -e; mkdir -p include/config/; trap "rm -f include/config/.kernel.release.tmp" EXIT; { echo "5.15.46$(sh ./scripts/setlocalversion .)"; } > include/config/.kernel.release.tmp; if [ ! -r include/config/kernel.release ] || ! cmp -s include/config/kernel.release include/config/.kernel.release.tmp; then : ' UPD include/config/kernel.release'; mv -f include/config/.kernel.release.tmp include/config/kernel.release; fi
make -f ./scripts/Makefile.asm-generic obj=arch/x86/include/generated/uapi/asm \
generic=include/uapi/asm-generic
make[2]: *** No rule to make target 'arch/x86/entry/syscalls/syscall_32.tbl', needed by 'arch/x86/include/generated/uapi/asm/unistd_32.h'. Stop.
make[1]: *** [arch/x86/Makefile:217: archheaders] Error 2
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-47-generic'
make: *** [Makefile:22: all] Error 2
答案1
内核头文件不需要“构建”。它们以 deb 包的形式安装。
它们已正确安装。内核包的安装导致dkms build
安装失败。
这make.log
是关于构建dkms
您之前安装的模块。
该模块名为evdi
。我不熟悉这个模块,不知道它是做什么用的。
它似乎与正在运行的内核不兼容。
您可以通过以下方式删除模块
sudo dkms remove evdi/5.2.14 --all
错误就会消失。