少女祈祷中...

问题报错

在升级Linux内核后被要求重新编译安装VM的相关模块。但安装失败。报错UNable to install all modules. See log Path/vmware-xxx.log for details. (Exit code 1)

内核版本:6.5.0-27
VM版本:17.0.2(使用vmware-installer -l查询版本,只需要大版本号)

log报错内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2024-04-12T08:47:25.949Z In(05) host-110651 ./include/linux/once.h:46: note: this is the location of the previous definition
2024-04-12T08:47:25.949Z In(05) host-110651 46 | #define DO_ONCE(func, ...) \
2024-04-12T08:47:25.949Z In(05) host-110651 |
2024-04-12T08:47:25.949Z In(05) host-110651 /tmp/modconfig-vA8Pno/vmmon-only/common/task.o: warning: objtool: .text: unexpected end of section
2024-04-12T08:47:25.949Z In(05) host-110651 ERROR: modpost: "__pte_offset_map" [/tmp/modconfig-vA8Pno/vmmon-only/vmmon.ko] undefined!
2024-04-12T08:47:25.949Z In(05) host-110651 make[3]: *** [scripts/Makefile.modpost:144:/tmp/modconfig-vA8Pno/vmmon-only/Module.symvers] 错误 1
2024-04-12T08:47:25.949Z In(05) host-110651 make[2]: *** [/usr/src/linux-headers-6.5.0-27-generic/Makefile:1991:modpost] 错误 2
2024-04-12T08:47:25.949Z In(05) host-110651 make[1]: *** [Makefile:234:__sub-make] 错误 2
2024-04-12T08:47:25.949Z In(05) host-110651 make: *** [Makefile:117:vmmon.ko] 错误 2
2024-04-12T08:47:25.949Z In(05) host-110651 Using kernel build system.
2024-04-12T08:47:25.949Z In(05) host-110651 warning: the compiler differs from the one used to build the kernel
2024-04-12T08:47:25.949Z In(05) host-110651 The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
2024-04-12T08:47:25.949Z In(05) host-110651 You are using: gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
2024-04-12T08:47:25.949Z In(05) host-110651 /tmp/modconfig-vA8Pno/vmnet-only/userif.o: warning: objtool: VNetCsumAndCopyToUser+0x2d: call to csum_partial_copy_nocheck() with UACCESS enabled
2024-04-12T08:47:25.949Z In(05) host-110651 /tmp/modconfig-vA8Pno/vmnet-only/bridge.c: In function ‘VNetBridgeSendLargePacket’:
2024-04-12T08:47:25.949Z In(05) host-110651 /tmp/modconfig-vA8Pno/vmnet-only/bridge.c:1413:11: error: implicit declaration of function ‘skb_gso_segment’; did you mean ‘tcp_gso_segment’? [-Werror=implicit-function-declaration]
2024-04-12T08:47:25.949Z In(05) host-110651 1413 | segs = skb_gso_segment(skb, 0);
2024-04-12T08:47:25.949Z In(05) host-110651 | ^~~~~~~~~~~~~~~
2024-04-12T08:47:25.949Z In(05) host-110651 | tcp_gso_segment
2024-04-12T08:47:25.949Z In(05) host-110651 /tmp/modconfig-vA8Pno/vmnet-only/bridge.c:1413:9: warning: assignment to ‘struct sk_buff *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
2024-04-12T08:47:25.949Z In(05) host-110651 1413 | segs = skb_gso_segment(skb, 0);
2024-04-12T08:47:25.949Z In(05) host-110651 | ^
2024-04-12T08:47:25.949Z In(05) host-110651 cc1: some warnings being treated as errors
2024-04-12T08:47:25.949Z In(05) host-110651 make[3]: *** [scripts/Makefile.build:251:/tmp/modconfig-vA8Pno/vmnet-only/bridge.o] 错误 1
2024-04-12T08:47:25.949Z In(05) host-110651 make[2]: *** [/usr/src/linux-headers-6.5.0-27-generic/Makefile:2039:/tmp/modconfig-vA8Pno/vmnet-only] 错误 2
2024-04-12T08:47:25.949Z In(05) host-110651 make[1]: *** [Makefile:234:__sub-make] 错误 2
2024-04-12T08:47:25.949Z In(05) host-110651 make: *** [Makefile:117:vmnet.ko] 错误 2
2024-04-12T08:47:25.949Z In(05) host-110651 Unable to install all modules. See log for details.
2024-04-12T08:47:25.949Z In(05) host-110651

问题解决

重新安装相关模块

下载响应的文件(版本号要对应,或者直接去仓库使用浏览器直接下载)

1
wget https://github.com/mkubecek/vmware-host-modules/archive/workstation-17.0.2.tar.gz

解压并移动到目录

1
2
3
tar -xzf vmware-host-modules-workstation-17.0.2.tar.gz 

cd vmware-host-modules-workstation-17.0.2

在目录打开终端,编译并安装

1
2
sudo make
sudo make install

未完全解决

  • 在更新到6.8内核后,无法编译成功,最后的解决方法是把vm更新到17.5.1然后再下载新的模块编译。

参考文章

解决Ubuntu宿主机下面安装Vmware时候vmmon和vmnet模块缺失导致的报错
[20.04] VMware Workstation/Player fails to build kernel modules VMMON & VMNET

文章所涉及的资源