VM报错Before you can run VMware several modules must be compiled and loaded into the running kernel

question

When starting the virtual machine under Ubuntu 20.04 VMware, an error is reported: Before you can run VMware several modules must be compiled and loaded into the running kernel. Clicking as prompted installcannot solve the problem.

Solution

1 Download vmware-host-modulesand switch to the corresponding branch

git clone https://github.com/mkubecek/vmware-host-modules
cd vmware-host-modules
git checkout workstation-16.1.2 #这里16.1.2替换为你的VM版本

If executed directly here, sudo make & sudo make installthe following error will be reported:

   67 |    ASSERT_ON_COMPILE(sizeof(Selector) == 2 &&                                \
      |                      ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   68 |                      ((__builtin_constant_p(expr) && ((expr) >> 16) == 0) || \
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   69 |                       sizeof(expr) <= 2))
      |                       ~~~~~~~~~~~~~~~~~~    

2. editvm_asm_x86.h

EDIT vmware-host-modules/vmmon-only/include/vm_asm_x86.h
Change the following around line 65:

#ifndef USE_UBSAN
#define ASSERT_ON_COMPILE_SELECTOR_SIZE(expr)                                \
   ASSERT_ON_COMPILE(sizeof(Selector) == 2 &&                                \
                     ((__builtin_constant_p(expr) && ((expr) >> 16) == 0) || \
                      sizeof(expr) <= 2))
#else
#define ASSERT_ON_COMPILE_SELECTOR_SIZE(expr)
#endif

Change to (comment others, keep only #define ASSERT_ON_COMPILE_SELECTOR_SIZE(expr)this line):

// #ifndef USE_UBSAN
// #define ASSERT_ON_COMPILE_SELECTOR_SIZE(expr)                                \
//    ASSERT_ON_COMPILE(sizeof(Selector) == 2 &&                                \
//                      ((__builtin_constant_p(expr) && ((expr) >> 16) == 0) || \
//                       sizeof(expr) <= 2))
// #else
#define ASSERT_ON_COMPILE_SELECTOR_SIZE(expr)
// #endif

3. make & make install

Then execute:

sudo make
sudo make install

Finally, the VM can be started successfully.

Reference link:

Guess you like

Origin blog.csdn.net/lyh458/article/details/125919668