linux安装vmware-workstation后启动报错找不到vmnet模块


0, 弹窗报错Before you can run vmware balabala. 主要是vmnet及其模块无法正常加载.

picture


1, 保存下面内容到脚本,然后sudo bash执行脚本即可!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
cat ~/Downloads/vmware.sh 
#!/bin/bash
vm_version=$(vmware-installer -l |tee |sed -n 3p |awk '{print $2}' |awk -F'.' '{print $1"."$2"."$3}')
VMWARE_VERSION=workstation-${vm_version}
TMP_FOLDER=/tmp/patch-vmware
rm -fdr $TMP_FOLDER
mkdir -p $TMP_FOLDER
cd $TMP_FOLDER
git clone https://github.com/mkubecek/vmware-host-modules.git
cd $TMP_FOLDER/vmware-host-modules
git checkout $VMWARE_VERSION
git fetch
make
sudo make install
sudo rm /usr/lib/vmware/lib/libz.so.1/libz.so.1
sudo ln -s /lib/x86_64-linux-gnu/libz.so.1 /usr/lib/vmware/lib/libz.so.1/libz.so.1
sudo /etc/init.d/vmware restart

2, 执行过程中出现下面报错的解决方法

1
2
3
4
5
6
7
8
9
10
In file included from ./autoconf/geninclude.c:20:
./include/compat_autoconf.h:38:13: fatal error: generated/autoconf.h: 没有那个文件或目录 38 | # include <generated/autoconf.h>
| ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: 进入目录“/tmp/patch-vmware/vmware-host-modules/vmmon-only/driver-6.1.0-21-amd64”
In file included from .././autoconf/geninclude.c:20:
.././include/compat_autoconf.h:38:13: fatal error: generated/autoconf.h: 没有那个文件或目录 38 | # include <generated/autoconf.h>
| ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Dependencies for driver.c

vmware-error

3, 安装linux-header即可解决。

1
sudo apt install linux-headers-$(uname -r) -y