RHEL 8.4 上 vmmon 错误导致无法启动VMware® Workstation

1 环境

  • 如果在尝试 VMware Workstation 15 的 evaluation 版本
  • xorg-x11-drv-vmware-13.2.1-8.el8.x86_64
  • Red Hat Enterprise Linux release 8.4 (Ootpa)
  • 4.18.0-305.el8.x86_64

2 启动的时候,出现错误。可以看到 machine monitor 出错了

1
2
3
4
5
6
7
May 29 22:03:02 ok vmware[185145]:   Virtual machine monitor[FAILED]
May 29 22:03:02 ok vmware[185145]: Virtual machine communication interface[ OK ]
May 29 22:03:02 ok vmware[185145]: VM communication interface socket family[ OK ]
May 29 22:03:02 ok vmware[185145]: Blocking file system[ OK ]
May 29 22:03:02 ok vmware[185145]: VMware Authentication Daemon[ OK ]
May 29 22:03:02 ok systemd[1]: vmware.service: Control process exited, code=exited status=1
May 29 22:03:02 ok systemd[1]: vmware.service: Failed with result 'exit-code'.

3 通过这个错误. 可以知道,肯定是 vmmon 无法正常加载了。

3.1 检查RHEL 8.4 的源码 (开源就是好呀,随时可以看源码 :D)

  • 通过源码可以知道,RHEL8.4 有一个 commint (过程不说了,就看重点)
    1
    2
    3
    4
    5
    mm: memcg: convert vmstat slab counters to bytes
    In order to prepare for per-object slab memory accounting, convert
    NR_SLAB_RECLAIMABLE and NR_SLAB_UNRECLAIMABLE vmstat items to bytes.
    To make it obvious, rename them to NR_SLAB_RECLAIMABLE_B and
    NR_SLAB_UNRECLAIMABLE_B (similar to NR_KERNEL_STACK_KB).
  • 具体 commit 的部分
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    --- a/include/linux/mmzone.h
    +++ b/include/linux/mmzone.h
    @@ -173,8 +173,8 @@ enum node_stat_item {
    NR_INACTIVE_FILE, /* " " " " " */
    NR_ACTIVE_FILE, /* " " " " " */
    NR_UNEVICTABLE, /* " " " " " */
    - NR_SLAB_RECLAIMABLE,
    - NR_SLAB_UNRECLAIMABLE,
    + NR_SLAB_RECLAIMABLE_B,
    + NR_SLAB_UNRECLAIMABLE_B,
    NR_ISOLATED_ANON, /* Temporary isolated pages from anon lru */
    NR_ISOLATED_FILE, /* Temporary isolated pages from file lru */
    RH_KABI_BROKEN_INSERT_ENUM(WORKINGSET_NODES)

    3.2 检查 vmmon 的源码 hostif.c, 可以看到里面用的还是旧名字; ok 问题找到,那就好办了,直接修改。这个应该是vmware 的bug了,没有及时修正来适配新的内核。

  • 原始文件
    1
    2
    3
    1741    /* NR_SLAB_* moved from zone to node in 4.13. */
    1742 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0)
    1743 lockedPages += global_node_page_state(NR_SLAB_UNRECLAIMABLE);
  • 修改后的文件
    1
    2
    3
    1741    /* NR_SLAB_* moved from zone to node in 4.13. */
    1742 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0)
    1743 lockedPages += global_node_page_state(NR_SLAB_UNRECLAIMABLE_B);

    3.3 修改完毕,重新编译这个模块就好了

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    filename:       /lib/modules/4.18.0-305.el8.x86_64/misc/vmmon.ko
    supported: external
    license: GPL v2
    description: VMware Virtual Machine Monitor.
    author: VMware, Inc.
    rhelversion: 8.4
    srcversion: 5300503E15044358103C5CF
    depends:
    name: vmmon
    vermagic: 4.18.0-305.el8.x86_64 SMP mod_unload modversions

    3.4 编译完毕,重新加载后,就可以正常使用了。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    # systemctl status vmware
    ● vmware.service - SYSV: This service starts and stops VMware services
    Loaded: loaded (/etc/rc.d/init.d/vmware; generated)
    Active: active (running) since Sat 2021-05-29 23:30:06 CST; 6min ago
    Docs: man:systemd-sysv-generator(8)
    Process: 568840 ExecStart=/etc/rc.d/init.d/vmware start (code=exited, status=0/SUCCESS)
    Tasks: 12 (limit: 253555)
    Memory: 14.0M
    ......