【Kali】永久解决Linux更新后Vmware无法打开提示“kernel module updater”
说明
本脚本仅作为学习使用,请勿用于任何商业用途。
本文为原创,遵循CC 4.0 by-sa版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/4geek/p/12187463.html
今天更新操作系统,更新完又出现了VMware-workstation无法启动的情况!启动后和上次一样提示kernel module updater,然后点击install提示在安装vmnet和vmmon 然而一会就有个失败的日志提示,打开看和上次的差不多。内容和具体原因可参见上一篇博文:https://www.cnblogs.com/4geek/p/11511592.html
这次不想再像上次那样一步一步的去重新编译再替换,所以在想有没有什么办法可以在每次更新系统后出现同样问题时一键就能顺利打开VMware workstation呢?于是乎又是一顿google操作最终找见了方法。在这里记录下来,依然是为了方便踩入坑的你!
[Toc]
A【参考文献】
翻了很多“文献”,很多社区都有被墙,这里就拿vmware官方的为列吧:https://communities.vmware.com/thread/609330
B【创建脚本】
1 ⚡ root@F0rGeEk ~ touch vmware-update.sh
2 ⚡ root@F0rGeEk ~ vi vmware-update.sh
3 #!/bin/bash
4 VMWARE_VERSION=workstation-15.5.1
5 TMP_FOLDER=/tmp/patch-vmware
6 rm -fdr $TMP_FOLDER
7 mkdir -p $TMP_FOLDER
8 cd $TMP_FOLDER
9 git clone https://github.com/mkubecek/vmware-host-modules.git
10 cd $TMP_FOLDER/vmware-host-modules
11 git checkout $VMWARE_VERSION
12 git fetch
13 make
14 sudo make install
15 sudo rm /usr/lib/vmware/lib/libz.so.1/libz.so.1
16 sudo ln -s /lib/x86_64-linux-gnu/libz.so.1 /usr/lib/vmware/lib/libz.so.1/libz.so.1
17 sudo /etc/init.d/vmware restart
18 :wq
脚本可以直接前往Gitee下载:为极客而生(https://gitee.com/forgeek/VMware_update.git)
其中“VMWARE_VERSION=workstation-15.5.1”,这里的版本号可以通过vmware-installer -l来查看。如果您的版本和我的不一样,是必须要修改以下脚本中的版本号。
1 ⚡ root@F0rGeEk ~ vmware-installer -l
2 Product Name Product Version
3 ==================== ====================
4 vmware-workstation 15.5.1.15018445
5 ⚡ root@F0rGeEk ~
C【执行脚本】
1 ⚡ root@F0rGeEk ~ bash vmware-update.sh 2 Cloning into 'vmware-host-modules'... 3 remote: Enumerating objects: 23, done. 4 remote: Counting objects: 100% (23/23), done. 5 remote: Compressing objects: 100% (23/23), done. 6 remote: Total 1701 (delta 19), reused 1 (delta 0), pack-reused 1678 7 Receiving objects: 100% (1701/1701), 887.90 KiB | 17.00 KiB/s, done. 8 Resolving deltas: 100% (1401/1401), done. 9 Branch 'workstation-15.5.1' set up to track remote branch 'workstation-15.5.1' from 'origin'. 10 Switched to a new branch 'workstation-15.5.1' 11 fatal: unable to access 'https://github.com/mkubecek/vmware-host-modules.git/': GnuTLS recv error (-54): Error in the pull function. 12 make -C vmmon-only 13 make[1]: Entering directory '/tmp/patch-vmware/vmware-host-modules/vmmon-only' 14 Using kernel build system. 15 make -C /lib/modules/5.4.0-kali2-amd64/build/include/.. M=$PWD SRCROOT=$PWD/. \ 16 MODULEBUILDDIR= modules 17 make[2]: Entering directory '/usr/src/linux-headers-5.4.0-kali2-amd64' 18 CC [M] /tmp/patch-vmware/vmware-host-modules/vmmon-only/linux/driverLog.o 19 CC [M] /tmp/patch-vmware/vmware-host-modules/vmmon-only/linux/driver.o 20 CC [M] /tmp/patch-vmware/vmware-host-modules/vmmon-only/linux/hostif.o 21 CC [M] /tmp/patch-vmware/vmware-host-modules/vmmon-only/common/memtrack.o 22 CC [M] /tmp/patch-vmware/vmware-host-modules/vmmon-only/common/apic.o 23 CC [M] /tmp/patch-vmware/vmware-host-modules/vmmon-only/common/statVarsVmmon.o 24 CC [M] /tmp/patch-vmware/vmware-host-modules/vmmon-only/common/vmx86.o 25 CC [M] /tmp/patch-vmware/vmware-host-modules/vmmon-only/common/sharedAreaVmmon.o 26 CC [M] /tmp/patch-vmware/vmware-host-modules/vmmon-only/common/cpuid.o 27 CC [M] /tmp/patch-vmware/vmware-host-modules/vmmon-only/common/task.o 28 CC [M] /tmp/patch-vmware/vmware-host-modules/vmmon-only/common/comport.o 29 CC [M] /tmp/patch-vmware/vmware-host-modules/vmmon-only/common/phystrack.o 30 CC [M] /tmp/patch-vmware/vmware-host-modules/vmmon-only/vmcore/moduleloop.o 31 CC [M] /tmp/patch-vmware/vmware-host-modules/vmmon-only/bootstrap/monLoaderVmmon.o 32 CC [M] /tmp/patch-vmware/vmware-host-modules/vmmon-only/bootstrap/monLoader.o 33 CC [M] /tmp/patch-vmware/vmware-host-modules/vmmon-only/bootstrap/vmmblob.o 34 CC [M] /tmp/patch-vmware/vmware-host-modules/vmmon-only/bootstrap/bootstrap.o 35 LD [M] /tmp/patch-vmware/vmware-host-modules/vmmon-only/vmmon.o 36 Building modules, stage 2. 37 MODPOST 1 modules 38 CC [M] /tmp/patch-vmware/vmware-host-modules/vmmon-only/vmmon.mod.o 39 LD [M] /tmp/patch-vmware/vmware-host-modules/vmmon-only/vmmon.ko 40 make[2]: Leaving directory '/usr/src/linux-headers-5.4.0-kali2-amd64' 41 make -C $PWD SRCROOT=$PWD/. \ 42 MODULEBUILDDIR= postbuild 43 make[2]: Entering directory '/tmp/patch-vmware/vmware-host-modules/vmmon-only' 44 make[2]: 'postbuild' is up to date. 45 make[2]: Leaving directory '/tmp/patch-vmware/vmware-host-modules/vmmon-only' 46 cp -f vmmon.ko ./../vmmon.o 47 make[1]: Leaving directory '/tmp/patch-vmware/vmware-host-modules/vmmon-only' 48 make -C vmnet-only 49 make[1]: Entering directory '/tmp/patch-vmware/vmware-host-modules/vmnet-only' 50 Using kernel build system. 51 make -C /lib/modules/5.4.0-kali2-amd64/build/include/.. M=$PWD SRCROOT=$PWD/. \ 52 MODULEBUILDDIR= modules 53 make[2]: Entering directory '/usr/src/linux-headers-5.4.0-kali2-amd64' 54 CC [M] /tmp/patch-vmware/vmware-host-modules/vmnet-only/driver.o 55 CC [M] /tmp/patch-vmware/vmware-host-modules/vmnet-only/hub.o 56 CC [M] /tmp/patch-vmware/vmware-host-modules/vmnet-only/userif.o 57 CC [M] /tmp/patch-vmware/vmware-host-modules/vmnet-only/netif.o 58 CC [M] /tmp/patch-vmware/vmware-host-modules/vmnet-only/bridge.o 59 CC [M] /tmp/patch-vmware/vmware-host-modules/vmnet-only/procfs.o 60 CC [M] /tmp/patch-vmware/vmware-host-modules/vmnet-only/smac_compat.o 61 CC [M] /tmp/patch-vmware/vmware-host-modules/vmnet-only/smac.o 62 CC [M] /tmp/patch-vmware/vmware-host-modules/vmnet-only/vnetEvent.o 63 CC [M] /tmp/patch-vmware/vmware-host-modules/vmnet-only/vnetUserListener.o 64 LD [M] /tmp/patch-vmware/vmware-host-modules/vmnet-only/vmnet.o 65 Building modules, stage 2. 66 MODPOST 1 modules 67 CC [M] /tmp/patch-vmware/vmware-host-modules/vmnet-only/vmnet.mod.o 68 LD [M] /tmp/patch-vmware/vmware-host-modules/vmnet-only/vmnet.ko 69 make[2]: Leaving directory '/usr/src/linux-headers-5.4.0-kali2-amd64' 70 make -C $PWD SRCROOT=$PWD/. \ 71 MODULEBUILDDIR= postbuild 72 make[2]: Entering directory '/tmp/patch-vmware/vmware-host-modules/vmnet-only' 73 make[2]: 'postbuild' is up to date. 74 make[2]: Leaving directory '/tmp/patch-vmware/vmware-host-modules/vmnet-only' 75 cp -f vmnet.ko ./../vmnet.o 76 make[1]: Leaving directory '/tmp/patch-vmware/vmware-host-modules/vmnet-only' 77 install -D -t /lib/modules/5.4.0-kali2-amd64/misc vmmon-only/vmmon.ko vmnet-only/vmnet.ko 78 strip --strip-debug /lib/modules/5.4.0-kali2-amd64/misc/vmmon.ko /lib/modules/5.4.0-kali2-amd64/misc/vmnet.ko 79 if test -z ""; then /sbin/depmod -a 5.4.0-kali2-amd64; fi 80 rm: cannot remove '/usr/lib/vmware/lib/libz.so.1/libz.so.1': No such file or directory 81 vmware-update.sh: line 15: /usr/lib/vmware/lib/libz.so.1/libz.so.1: No such file or directory 82 Stopping VMware services: 83 VMware Authentication Daemon done 84 VM communication interface socket family done 85 Virtual machine communication interface done 86 Virtual machine monitor done 87 Blocking file system done 88 Starting VMware services: 89 Virtual machine monitor done 90 Virtual machine communication interface done 91 VM communication interface socket family done 92 Blocking file system done 93 Virtual ethernet done 94 VMware Authentication Daemon done 95 Shared Memory Available done
D【验证】
最后就是见证奇迹了!以后只要更新系统出现类似问题,只需要重新运行一下这个脚本就可以很方便的解决这个问题了!
本文为原创,遵循BY-NC-ND版权协议,转载请附上原文出处链接和本声明。By:【F0rGeEk】