【Kali】Kali Linux更新5.2.9后 Vmware Workstation无法正常启动

说明
本脚本仅作为学习使用,请勿用于任何商业用途。
本文为原创,遵循CC 4.0 by-sa版权协议,转载请附上原文出处链接和本声明。

  最近更新了Kali后发现一个奇葩的问题,我的虚拟机不能正常使用了。启动后会提示无法正常启动,并有个弹窗提示错误日志在/tmp/vmware-root/vmware-18363.log

于是打开看了看,主要报错信息如下:

 1 2019-09-12T10:12:22.318+08:00| host-18363| I125: Log for VMware Workstation pid=18363 version=15.1.0 build=build-13591040 option=Release
 2 2019-09-12T10:12:22.318+08:00| host-18363| I125: The process is 64-bit.
 3 2019-09-12T10:12:22.318+08:00| host-18363| I125: Host codepage=UTF-8 encoding=UTF-8
 4 2019-09-12T10:12:22.318+08:00| host-18363| I125: Host is Linux 5.2.0-kali2-amd64 Kali GNU/Linux Rolling
 5 2019-09-12T10:12:22.318+08:00| host-18363| I125: DictionaryLoad: Cannot open file "/usr/lib/vmware/settings": No such file or directory.
 6 2019-09-12T10:12:22.318+08:00| host-18363| I125: [msg.dictionary.load.openFailed] Cannot open file "/usr/lib/vmware/settings": No such file or directory.
 7 2019-09-12T10:12:22.318+08:00| host-18363| I125: PREF Optional preferences file not found at /usr/lib/vmware/settings. Using default values.
 8 2019-09-12T10:12:22.318+08:00| host-18363| I125: DictionaryLoad: Cannot open file "/root/.vmware/config": No such file or directory.
 9 2019-09-12T10:12:22.318+08:00| host-18363| I125: [msg.dictionary.load.openFailed] Cannot open file "/root/.vmware/config": No such file or directory.
10 2019-09-12T10:12:22.318+08:00| host-18363| I125: PREF Optional preferences file not found at /root/.vmware/config. Using default values.
11 2019-09-12T10:12:22.351+08:00| host-18363| W115: Logging to /tmp/vmware-root/vmware-18363.log
12 2019-09-12T10:12:22.383+08:00| host-18363| I125: Obtaining info using the running kernel.
13 2019-09-12T10:12:22.383+08:00| host-18363| I125: Created new pathsHash.
14 2019-09-12T10:12:22.383+08:00| host-18363| I125: Setting header path for 5.2.0-kali2-amd64 to "/lib/modules/5.2.0-kali2-amd64/build/include".
15 2019-09-12T10:12:22.383+08:00| host-18363| I125: Validating path "/lib/modules/5.2.0-kali2-amd64/build/include" for kernel release "5.2.0-kali2-amd64".
16 2019-09-12T10:12:22.383+08:00| host-18363| I125: Failed to find /lib/modules/5.2.0-kali2-amd64/build/include/linux/version.h
17 2019-09-12T10:12:22.383+08:00| host-18363| I125: /lib/modules/5.2.0-kali2-amd64/build/include/linux/version.h not found, looking for generated/uapi/linux/version.h instead.
18 2019-09-12T10:12:22.383+08:00| host-18363| I125: using /usr/bin/gcc-8 for preprocess check
19 2019-09-12T10:12:22.387+08:00| host-18363| I125: Preprocessed UTS_RELEASE, got value "5.2.0-kali2-amd64".
20 2019-09-12T10:12:22.388+08:00| host-18363| I125: The header path "/lib/modules/5.2.0-kali2-amd64/build/include" for the kernel "5.2.0-kali2-amd64" is valid.  Whoohoo!
21 2019-09-12T10:12:22.507+08:00| host-18363| I125: found symbol version file /lib/modules/5.2.0-kali2-amd64/build/Module.symvers
22 2019-09-12T10:12:22.507+08:00| host-18363| I125: Reading symbol versions from /lib/modules/5.2.0-kali2-amd64/build/Module.symvers.
23 2019-09-12T10:12:22.521+08:00| host-18363| I125: Read 20774 symbol versions
24 2019-09-12T10:12:22.521+08:00| host-18363| I125: Reading in info for the vmmon module.
25 2019-09-12T10:12:22.521+08:00| host-18363| I125: Reading in info for the vmnet module.
26 2019-09-12T10:12:22.521+08:00| host-18363| I125: Reading in info for the vmci module.
27 2019-09-12T10:12:22.521+08:00| host-18363| I125: Reading in info for the vsock module.
28 2019-09-12T10:12:22.521+08:00| host-18363| I125: Setting vsock to depend on vmci.
29 2019-09-12T10:12:22.521+08:00| host-18363| I125: Invoking modinfo on "vmmon".
30 2019-09-12T10:12:22.524+08:00| host-18363| I125: "/sbin/modinfo" exited with status 256.
31 2019-09-12T10:12:22.524+08:00| host-18363| I125: Invoking modinfo on "vmnet".
32 2019-09-12T10:12:22.525+08:00| host-18363| I125: "/sbin/modinfo" exited with status 0.
33 2019-09-12T10:12:22.525+08:00| host-18363| I125: Invoking modinfo on "vmci".
34 2019-09-12T10:12:22.527+08:00| host-18363| I125: "/sbin/modinfo" exited with status 256.
35 2019-09-12T10:12:22.527+08:00| host-18363| I125: Invoking modinfo on "vsock".
36 2019-09-12T10:12:22.529+08:00| host-18363| I125: "/sbin/modinfo" exited with status 0.
37 2019-09-12T10:12:22.538+08:00| host-18363| I125: to be installed: vmmon status: 0
38 2019-09-12T10:12:22.546+08:00| host-18363| I125: Obtaining info using the running kernel.
39 2019-09-12T10:12:22.546+08:00| host-18363| I125: Setting header path for 5.2.0-kali2-amd64 to "/lib/modules/5.2.0-kali2-amd64/build/include".
40 2019-09-12T10:12:22.546+08:00| host-18363| I125: Validating path "/lib/modules/5.2.0-kali2-amd64/build/include" for kernel release "5.2.0-kali2-amd64".
41 2019-09-12T10:12:22.546+08:00| host-18363| I125: Failed to find /lib/modules/5.2.0-kali2-amd64/build/include/linux/version.h
42 2019-09-12T10:12:22.546+08:00| host-18363| I125: /lib/modules/5.2.0-kali2-amd64/build/include/linux/version.h not found, looking for generated/uapi/linux/version.h instead.
43 2019-09-12T10:12:22.546+08:00| host-18363| I125: using /usr/bin/gcc-8 for preprocess check
44 2019-09-12T10:12:22.551+08:00| host-18363| I125: Preprocessed UTS_RELEASE, got value "5.2.0-kali2-amd64".
45 2019-09-12T10:12:22.551+08:00| host-18363| I125: The header path "/lib/modules/5.2.0-kali2-amd64/build/include" for the kernel "5.2.0-kali2-amd64" is valid.  Whoohoo!
46 2019-09-12T10:12:22.669+08:00| host-18363| I125: found symbol version file /lib/modules/5.2.0-kali2-amd64/build/Module.symvers
47 2019-09-12T10:12:22.669+08:00| host-18363| I125: Reading symbol versions from /lib/modules/5.2.0-kali2-amd64/build/Module.symvers.
48 2019-09-12T10:12:22.683+08:00| host-18363| I125: Read 20774 symbol versions
49 2019-09-12T10:12:22.689+08:00| host-18363| I125: Kernel header path retrieved from FileEntry: /lib/modules/5.2.0-kali2-amd64/build/include
50 2019-09-12T10:12:22.689+08:00| host-18363| I125: Update kernel header path to /lib/modules/5.2.0-kali2-amd64/build/include
51 2019-09-12T10:12:22.689+08:00| host-18363| I125: Validating path "/lib/modules/5.2.0-kali2-amd64/build/include" for kernel release "5.2.0-kali2-amd64".
52 2019-09-12T10:12:22.689+08:00| host-18363| I125: Failed to find /lib/modules/5.2.0-kali2-amd64/build/include/linux/version.h
53 2019-09-12T10:12:22.689+08:00| host-18363| I125: /lib/modules/5.2.0-kali2-amd64/build/include/linux/version.h not found, looking for generated/uapi/linux/version.h instead.
54 2019-09-12T10:12:22.689+08:00| host-18363| I125: using /usr/bin/gcc-8 for preprocess check
55 2019-09-12T10:12:22.694+08:00| host-18363| I125: Preprocessed UTS_RELEASE, got value "5.2.0-kali2-amd64".
56 2019-09-12T10:12:22.694+08:00| host-18363| I125: The header path "/lib/modules/5.2.0-kali2-amd64/build/include" for the kernel "5.2.0-kali2-amd64" is valid.  Whoohoo!
57 2019-09-12T10:12:22.695+08:00| host-18363| I125: Found compiler at "/usr/bin/gcc"
58 2019-09-12T10:12:22.697+08:00| host-18363| I125: Got gcc version "9".
59 2019-09-12T10:12:22.697+08:00| host-18363| I125: GCC major version 9 does not match Kernel GCC major version 8.
60 2019-09-12T10:12:22.697+08:00| host-18363| I125: Attempting to use a compiler at location "/usr/bin/gcc-8".
61 2019-09-12T10:12:22.699+08:00| host-18363| I125: Got gcc version "8".
62 2019-09-12T10:12:22.700+08:00| host-18363| I125: The GCC version matches the kernel GCC minor version like a glove.
63 2019-09-12T10:12:22.702+08:00| host-18363| I125: Got gcc version "8".
64 2019-09-12T10:12:22.702+08:00| host-18363| I125: The GCC version matches the kernel GCC minor version like a glove.
65 2019-09-12T10:12:22.703+08:00| host-18363| I125: Trying to find a suitable PBM set for kernel "5.2.0-kali2-amd64".
66 2019-09-12T10:12:22.703+08:00| host-18363| I125: No matching PBM set was found for kernel "5.2.0-kali2-amd64".
67 2019-09-12T10:12:22.703+08:00| host-18363| I125: The GCC version matches the kernel GCC minor version like a glove.
68 2019-09-12T10:12:22.703+08:00| host-18363| I125: Validating path "/lib/modules/5.2.0-kali2-amd64/build/include" for kernel release "5.2.0-kali2-amd64".
69 2019-09-12T10:12:22.703+08:00| host-18363| I125: Failed to find /lib/modules/5.2.0-kali2-amd64/build/include/linux/version.h
70 2019-09-12T10:12:22.703+08:00| host-18363| I125: /lib/modules/5.2.0-kali2-amd64/build/include/linux/version.h not found, looking for generated/uapi/linux/version.h instead.
71 2019-09-12T10:12:22.703+08:00| host-18363| I125: using /usr/bin/gcc-8 for preprocess check
72 2019-09-12T10:12:22.708+08:00| host-18363| I125: Preprocessed UTS_RELEASE, got value "5.2.0-kali2-amd64".
73 2019-09-12T10:12:22.708+08:00| host-18363| I125: The header path "/lib/modules/5.2.0-kali2-amd64/build/include" for the kernel "5.2.0-kali2-amd64" is valid.  Whoohoo!
74 2019-09-12T10:12:22.708+08:00| host-18363| I125: The GCC version matches the kernel GCC minor version like a glove.
75 2019-09-12T10:12:22.708+08:00| host-18363| I125: Validating path "/lib/modules/5.2.0-kali2-amd64/build/include" for kernel release "5.2.0-kali2-amd64".
76 2019-09-12T10:12:22.708+08:00| host-18363| I125: Failed to find /lib/modules/5.2.0-kali2-amd64/build/include/linux/version.h
77 2019-09-12T10:12:22.708+08:00| host-18363| I125: /lib/modules/5.2.0-kali2-amd64/build/include/linux/version.h not found, looking for generated/uapi/linux/version.h instead.
78 2019-09-12T10:12:22.708+08:00| host-18363| I125: using /usr/bin/gcc-8 for preprocess check
79 2019-09-12T10:12:22.713+08:00| host-18363| I125: Preprocessed UTS_RELEASE, got value "5.2.0-kali2-amd64".
80 2019-09-12T10:12:22.713+08:00| host-18363| I125: The header path "/lib/modules/5.2.0-kali2-amd64/build/include" for the kernel "5.2.0-kali2-amd64" is valid.  Whoohoo!
81 2019-09-12T10:12:22.713+08:00| host-18363| I125: Using temp dir "/tmp".
82 2019-09-12T10:12:22.715+08:00| host-18363| I125: Obtaining info using the running kernel.
83 2019-09-12T10:12:22.715+08:00| host-18363| I125: Setting header path for 5.2.0-kali2-amd64 to "/lib/modules/5.2.0-kali2-amd64/build/include".
84 2019-09-12T10:12:22.715+08:00| host-18363| I125: Validating path "/lib/modules/5.2.0-kali2-amd64/build/include" for kernel release "5.2.0-kali2-amd64".
85 2019-09-12T10:12:22.715+08:00| host-18363| I125: Failed to find /lib/modules/5.2.0-kali2-amd64/build/include/linux/version.h
86 2019-09-12T10:12:22.715+08:00| host-18363| I125: /lib/modules/5.2.0-kali2-amd64/build/include/linux/version.h not found, looking for generated/uapi/linux/version.h instead.
87 2019-09-12T10:12:22.715+08:00| host-18363| I125: using /usr/bin/gcc-8 for preprocess check
88 2019-09-12T10:12:22.720+08:00| host-18363| I125: Preprocessed UTS_RELEASE, got value "5.2.0-kali2-amd64".
89 2019-09-12T10:12:22.720+08:00| host-18363| I125: The header path "/lib/modules/5.2.0-kali2-amd64/build/include" for the kernel "5.2.0-kali2-amd64" is valid.  Whoohoo!
90 2019-09-12T10:12:22.840+08:00| host-18363| I125: found symbol version file /lib/modules/5.2.0-kali2-amd64/build/Module.symvers
91 2019-09-12T10:12:22.840+08:00| host-18363| I125: Reading symbol versions from /lib/modules/5.2.0-kali2-amd64/build/Module.symvers.
92 2019-09-12T10:12:22.854+08:00| host-18363| I125: Read 20774 symbol versions
93 2019-09-12T10:12:22.854+08:00| host-18363| I125: Invoking modinfo on "vmmon".
94 2019-09-12T10:12:22.856+08:00| host-18363| I125: "/sbin/modinfo" exited with status 256.
95 2019-09-12T10:12:23.707+08:00| host-18363| I125: Setting destination path for vmmon to "/lib/modules/5.2.0-kali2-amd64/misc/vmmon.ko".
96 2019-09-12T10:12:23.707+08:00| host-18363| I125: Extracting the vmmon source from "/usr/lib/vmware/modules/source/vmmon.tar".
97 2019-09-12T10:12:23.720+08:00| host-18363| I125: Successfully extracted the vmmon source.
98 2019-09-12T10:12:23.720+08:00| host-18363| I125: Building module with command "/usr/bin/make -j8 -C /tmp/modconfig-1sA2Ln/vmmon-only auto-build HEADER_DIR=/lib/modules/5.2.0-kali2-amd64/build/include CC=/usr/bin/gcc-8 IS_GCC_3=no"
99 2019-09-12T10:12:25.199+08:00| host-18363| W115: Failed to build vmmon.  Failed to execute the build command.

  从上面Failed的信息看出,大概问题是vmmon和vmnet这两个模块出问题了。刚开始还以为是头文件出问题了,于是通过apt-get install linux-headers-$(uname -r)进行安装,但是安装后依然爆同样的错误!于是乎一顿google发现原来这是Linux Kernel V4以来,vmware一直没有解决的一个bug!这么大个厂商既然支持linux为何不去更新呢,着实想不通!好在开源社区解决了这个问题,开源社区提供的方法貌似解决了Vmware在所有Linux上比v4更新的所有内核的问题。主要方法是替换vmware-source中相应的vmmon和vmnet文件使其重新构建并正常工作。在这里也希望将该方法分享出来,方便踏进这个坑的伙伴快速爬出来~

  具体方法如下:

  1. 查看自己的vmware版本
    vmware -v
    ⚡ root@F0rGeEk  ~  vmware -v
    VMware Workstation 15.1.0 build-13591040
     ⚡ root@F0rGeEk  ~  uname -a
    Linux F0rGeEk 5.2.0-kali2-amd64 #1 SMP Debian 5.2.9-2kali1 (2019-08-22) x86_64 GNU/Linux
     ⚡ root@F0rGeEk  ~  

     

  2. clone社区的补丁文件
    git clone -b workstation-15.1.0 https://github.com/mkubecek/vmware-host-modules.git
    ⚡ root@F0rGeEk  ~  git clone -b workstation-15.1.0 https://github.com/mkubecek/vmware-host-modules.git
    Cloning into 'vmware-host-modules'...
    remote: Enumerating objects: 71, done.
    remote: Counting objects: 100% (71/71), done.
    remote: Compressing objects: 100% (49/49), done.
    remote: Total 1417 (delta 50), reused 33 (delta 22), pack-reused 1346
    Receiving objects: 100% (1417/1417), 839.58 KiB | 8.00 KiB/s, done.
    Resolving deltas: 100% (1128/1128), done.

     

  3. 替换现有的vmmon和vmnet文件
    tar -cf vmmon.tar vmmon-only
    tar -cf vmnet.tar vmnet-only
    cp -v vmmon.tar vmnet.tar /usr/lib/vmware/modules/source/
    ⚡ root@F0rGeEk  ~/vmware-host-modules   workstation-15.1.0  tar -cf vmmon.tar vmmon-only
    ⚡ root@F0rGeEk  ~/vmware-host-modules   workstation-15.1.0  ls
    INSTALL  LICENSE  Makefile  README  vmmon-only  vmmon.tar  vmnet-only
    ⚡ root@F0rGeEk  ~/vmware-host-modules   workstation-15.1.0  tar -cf vmnet.tar vmnet-only
    ⚡ root@F0rGeEk  ~/vmware-host-modules   workstation-15.1.0  cp -v vmmon.tar vmnet.tar /usr/lib/vmware/modules/source/
    'vmmon.tar' -> '/usr/lib/vmware/modules/source/vmmon.tar'
    'vmnet.tar' -> '/usr/lib/vmware/modules/source/vmnet.tar'

     

  4. 重构
    vmware-modconfig --console --install-all
    ⚡ root@F0rGeEk  ~/vmware-host-modules   workstation-15.1.0  vmware-modconfig --console --install-all
    [AppLoader] GLib does not have GSettings support.
    Stopping VMware services:
       VMware Authentication Daemon                                        done
       VM communication interface socket family                            done
       Virtual machine communication interface                             done
       Virtual machine monitor                                             done
       Blocking file system                                                done
    make: Entering directory '/tmp/modconfig-kADivb/vmmon-only'
    Using kernel build system.
    /usr/bin/make -C /lib/modules/5.2.0-kali2-amd64/build/include/.. M=$PWD SRCROOT=$PWD/. \
      MODULEBUILDDIR= modules
    make[1]: Entering directory '/usr/src/linux-headers-5.2.0-kali2-amd64'
      CC [M]  /tmp/modconfig-kADivb/vmmon-only/linux/driverLog.o
      CC [M]  /tmp/modconfig-kADivb/vmmon-only/linux/driver.o
      CC [M]  /tmp/modconfig-kADivb/vmmon-only/linux/hostif.o
      CC [M]  /tmp/modconfig-kADivb/vmmon-only/common/memtrack.o
      CC [M]  /tmp/modconfig-kADivb/vmmon-only/common/apic.o
      CC [M]  /tmp/modconfig-kADivb/vmmon-only/common/vmx86.o
      CC [M]  /tmp/modconfig-kADivb/vmmon-only/common/cpuid.o
      CC [M]  /tmp/modconfig-kADivb/vmmon-only/common/task.o
      CC [M]  /tmp/modconfig-kADivb/vmmon-only/common/phystrack.o
      CC [M]  /tmp/modconfig-kADivb/vmmon-only/common/comport.o
      CC [M]  /tmp/modconfig-kADivb/vmmon-only/vmcore/moduleloop.o
      CC [M]  /tmp/modconfig-kADivb/vmmon-only/bootstrap/monLoaderVmmon.o
      CC [M]  /tmp/modconfig-kADivb/vmmon-only/bootstrap/monLoader.o
      CC [M]  /tmp/modconfig-kADivb/vmmon-only/bootstrap/vmmblob.o
      CC [M]  /tmp/modconfig-kADivb/vmmon-only/bootstrap/bootstrap.o
      LD [M]  /tmp/modconfig-kADivb/vmmon-only/vmmon.o
      Building modules, stage 2.
      MODPOST 1 modules
      CC      /tmp/modconfig-kADivb/vmmon-only/vmmon.mod.o
      LD [M]  /tmp/modconfig-kADivb/vmmon-only/vmmon.ko
    make[1]: Leaving directory '/usr/src/linux-headers-5.2.0-kali2-amd64'
    /usr/bin/make -C $PWD SRCROOT=$PWD/. \
      MODULEBUILDDIR= postbuild
    make[1]: Entering directory '/tmp/modconfig-kADivb/vmmon-only'
    make[1]: 'postbuild' is up to date.
    make[1]: Leaving directory '/tmp/modconfig-kADivb/vmmon-only'
    cp -f vmmon.ko ./../vmmon.o
    make: Leaving directory '/tmp/modconfig-kADivb/vmmon-only'
    make: Entering directory '/tmp/modconfig-kADivb/vmnet-only'
    Using kernel build system.
    /usr/bin/make -C /lib/modules/5.2.0-kali2-amd64/build/include/.. M=$PWD SRCROOT=$PWD/. \
      MODULEBUILDDIR= modules
    make[1]: Entering directory '/usr/src/linux-headers-5.2.0-kali2-amd64'
      CC [M]  /tmp/modconfig-kADivb/vmnet-only/driver.o
      CC [M]  /tmp/modconfig-kADivb/vmnet-only/hub.o
      CC [M]  /tmp/modconfig-kADivb/vmnet-only/userif.o
      CC [M]  /tmp/modconfig-kADivb/vmnet-only/netif.o
      CC [M]  /tmp/modconfig-kADivb/vmnet-only/bridge.o
      CC [M]  /tmp/modconfig-kADivb/vmnet-only/procfs.o
      CC [M]  /tmp/modconfig-kADivb/vmnet-only/smac_compat.o
      CC [M]  /tmp/modconfig-kADivb/vmnet-only/smac.o
      CC [M]  /tmp/modconfig-kADivb/vmnet-only/vnetEvent.o
      CC [M]  /tmp/modconfig-kADivb/vmnet-only/vnetUserListener.o
      LD [M]  /tmp/modconfig-kADivb/vmnet-only/vmnet.o
      Building modules, stage 2.
      MODPOST 1 modules
      CC      /tmp/modconfig-kADivb/vmnet-only/vmnet.mod.o
      LD [M]  /tmp/modconfig-kADivb/vmnet-only/vmnet.ko
    make[1]: Leaving directory '/usr/src/linux-headers-5.2.0-kali2-amd64'
    /usr/bin/make -C $PWD SRCROOT=$PWD/. \
      MODULEBUILDDIR= postbuild
    make[1]: Entering directory '/tmp/modconfig-kADivb/vmnet-only'
    make[1]: 'postbuild' is up to date.
    make[1]: Leaving directory '/tmp/modconfig-kADivb/vmnet-only'
    cp -f vmnet.ko ./../vmnet.o
    make: Leaving directory '/tmp/modconfig-kADivb/vmnet-only'
    Starting VMware services:
       Virtual machine monitor                                             done
       Virtual machine communication interface                             done
       VM communication interface socket family                            done
       Blocking file system                                                done
       Virtual ethernet                                                    done
       VMware Authentication Daemon                                        done
       Shared Memory Available                                             done

    ok,到这里就大功告成了!单击你的vmware图标见证奇迹吧!

  5.                                                                                                                                                                                                                   2019-09-12 14:09:13        By:F0rGeEk 

    最近又升级了kali,发现vmware又打不开了!!!原因和本文类似,为了方便,写了个脚本应对以后内核的更新后vmware无法打开。过程及结果可以移步这篇文章:永久解决Linux更新后Vmware无法打开提示“kernel module updater” 】

 

posted @ 2019-09-12 14:06  为极客而生  阅读(3569)  评论(2编辑  收藏  举报