VM报错Before you can run VMware several modules must be compiled and loaded into the running kernel
VMware报错Before you can run VMware several modules must be compiled and loaded into the running kernel的解决办法
·
问题
Ubuntu 20.04下启动虚拟机VMware
时,报错:Before you can run VMware several modules must be compiled and loaded into the running kernel
. 按提示点击install
无法解决。
解决办法
1 下载vmware-host-modules
并切换到对应分支
git clone https://github.com/mkubecek/vmware-host-modules
cd vmware-host-modules
git checkout workstation-16.1.2 #这里16.1.2替换为你的VM版本
这里如果直接执行sudo make & sudo make install
会报以下错误:
67 | ASSERT_ON_COMPILE(sizeof(Selector) == 2 && \
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 | ((__builtin_constant_p(expr) && ((expr) >> 16) == 0) || \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69 | sizeof(expr) <= 2))
| ~~~~~~~~~~~~~~~~~~
2. 编辑vm_asm_x86.h
编辑vmware-host-modules/vmmon-only/include/vm_asm_x86.h
将第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
修改为(注释其它,只保留#define ASSERT_ON_COMPILE_SELECTOR_SIZE(expr)
这一行):
// #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
然后再执行:
sudo make
sudo make install
最后,便可成功启动VM.
参考链接:
更多推荐
已为社区贡献2条内容
所有评论(0)