Operation

Ubuntu 20.04 安装 Vmware 16.1.2 Pro 启动报错 Before you can run VMware,several modules must be compiled and loaded into the running kernel

Ubuntu 20.04 安装 Vmware 16.1.2 Pro 启动报错 Before you can run VMware,several modules must be compiled and loaded into the running kernel

1. 尝试解决方案 1

参考: https://www.cnblogs.com/zhiweiXiaomu/p/14301885.html

1.1 操作过程

git clone https://github.com/mkubecek/vmware-host-modules.git
cd vmware-host-modules
git checkout workstation-16.1.2
sudo make
sudo make install

进入后如果虚拟机无法启动,则用下面的方法解决:

wget https://github.com/mkubecek/vmware-host-modules/archive/workstation-16.1.0.tar.gz
tar zvxf workstation-16.1.0.tar.gz
cd vmware-host-modules-workstation-16.1.0
sudo make
sudo make install
cd vmmon-only
# ${kernel-version} 是你的内核版本
cp vmmon.ko /lib/modules/${kernel-version}/misc/vmmon.ko
sudo modprobe vmmon

1.2 操作结果

未知,在编译过程中报错:

make -C vmmon-only 
make[1]: Entering directory '/home/wangsir/Documents/c_cpp-workspace/vmware-host-modules/vmmon-only'
Using standalone build system.
In file included from ./autoconf/geninclude.c:20:
./include/compat_autoconf.h:38:13: fatal error: generated/autoconf.h: No such file or directory
   38 | #   include <generated/autoconf.h>
      |             ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: Entering directory '/home/wangsir/Documents/c_cpp-workspace/vmware-host-modules/vmmon-only/driver-5.4.0-77-generic'
In file included from .././autoconf/geninclude.c:20:
.././include/compat_autoconf.h:38:13: fatal error: generated/autoconf.h: No such file or directory
   38 | #   include <generated/autoconf.h>
      |             ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Dependencies for vmx86.c
cc1: error: code model kernel does not support PIC mode
make[2]: *** [.././Makefile.normal:128: vmx86.d] Error 1
make[2]: Leaving directory '/home/wangsir/Documents/c_cpp-workspace/vmware-host-modules/vmmon-only/driver-5.4.0-77-generic'
make[1]: *** [Makefile.normal:143: deps] Error 2
make[1]: Leaving directory '/home/wangsir/Documents/c_cpp-workspace/vmware-host-modules/vmmon-only'
make: *** [Makefile:21: vmmon-only] Error 2

2. 尝试解决方案 2

经咨询过 kernel 的同学后...

2.1 操作过程

sudo apt install linux-headers-5.4.0-77-generic

2.2 操作结果

再次启动 VMware Workstation 竟然成功了;事后尝试编译上述模块也成功了。

3. 总结

从错误来看就是 kernel 缺少个东西但不知道是啥,最后咨询尝试安装 linux-headers-5.4.0-77-generic 就成功了,分析可能是之前 ubuntu 多次 kernel 升级存在多个版本,清理的时候将此模块清除了。

留言

您的电子邮箱地址不会被公开。