问题描述
我的Ubuntu服务器自动更新了,发现VM无法使用,报错如下:
Before you can run VMware, several modules must be complied and loaded into the running kernel.
点击安装,报如下错误:
Unable to install all modules. See log /tmp/vmware-haypin/vmware…
根据提示去查看日志,发现某些文件,编译出现问题了。
解决办法
1、安装vmware-host-modules
写一个shell脚本:start.sh, 内容如下:
#!/bin/bash
VMWARE_VERSION=workstation-15.5.1
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
执行该脚本(sh ./start.sh),即可解决上述问题。
温馨提示:VMWARE_VERSION是一个版本号,需要根据实际修改哦。
2、禁止Ubuntu自动更新
vim /etc/apt/apt.conf.d/10periodic
cat /etc/apt/apt.conf.d/10periodic
如图,可通过vim修改如图配置,此时就关闭了自动更新。