![解决:](https://linux22.com/image/1056803/%E8%A7%A3%E5%86%B3%EF%BC%9A.png)
我最近不得不在我的 Ubuntu 16.04 中安装内核 4.6 来阻止随机的“挂起”崩溃。
安装后我运行:
sudo vmware-modconfig --console --install-all
并收到错误:
<snip>
from /tmp/modconfig-VKdGcJ/vmmon-only/linux/hostif.c:32:
/tmp/modconfig-VKdGcJ/vmmon-only/linux/hostif.c: In function ‘HostIFGetUserPages’:
./arch/x86/include/asm/current.h:17:17: warning: passing argument 1 of ‘get_user_pages’ makes integer from pointer without a cast [-Wint-conversion]
#define current get_current()
<snip>
from /tmp/modconfig-VKdGcJ/vmmon-only/linux/hostif.c:32:
./arch/x86/include/asm/current.h:17:17: warning: passing argument 2 of ‘get_user_pages’ makes integer from pointer without a cast [-Wint-conversion]
#define current get_current()
<snip>
from /tmp/modconfig-VKdGcJ/vmnet-only/userif.c:26:
/tmp/modconfig-VKdGcJ/vmnet-only/userif.c: In function ‘UserifLockPage’:
./arch/x86/include/asm/current.h:17:17: warning: passing argument 1 of ‘get_user_pages’ makes integer from pointer without a cast [-Wint-conversion]
#define current get_current()
<snip>
scripts/Makefile.build:291: recipe for target '/tmp/modconfig-VKdGcJ/vmnet-only/userif.o' failed
make[2]: *** [/tmp/modconfig-VKdGcJ/vmnet-only/userif.o] Error 1
make[2]: *** Waiting for unfinished jobs....
Makefile:1434: recipe for target '_module_/tmp/modconfig-VKdGcJ/vmnet-only' failed
make[1]: *** [_module_/tmp/modconfig-VKdGcJ/vmnet-only] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.6.0-040600-generic'
Makefile:120: recipe for target 'vmnet.ko' failed
make: *** [vmnet.ko] Error 2
make: Leaving directory '/tmp/modconfig-VKdGcJ/vmnet-only'
Unable to install all modules. See log for details.
虚拟机无法运行,并出现无法加载 vmmon 的错误
答案1
它似乎get_user_pages
被替换为get_user_pages_remote
使用此补丁:https://lkml.org/lkml/2016/2/10/555
解决:
(来自 Arch Linux wiki:)
https://wiki.archlinux.org/index.php/VMware#Kernel_modules_fail_to_build_after_Linux_4.6
cd /usr/lib/vmware/modules/source
tar xf vmmon.tar
mv vmmon.tar vmmon.old.tar
sed -i -e 's/get_user_pages/get_user_pages_remote/g' vmmon-only/linux/hostif.c
tar cf vmmon.tar vmmon-only
rm -r vmmon-only
tar xf vmnet.tar
mv vmnet.tar vmnet.old.tar
sed -i -e 's/get_user_pages/get_user_pages_remote/g' vmnet-only/userif.c
tar cf vmnet.tar vmnet-only
rm -r vmnet-only
对我来说,这似乎是一个破坏用户空间的 Linux 补丁,我错了吗?
答案2
Prayag Sangode 的回答在在运行 VMware 之前必须编译几个模块 - Unix 和 Linux解决了 Ubuntu 18(VMware 版本 15.5)上的问题。
git clone https://github.com/mkubecek/vmware-host-modules cd vmware-host-modules git checkout workstation-15.5.6 sudo make ; sudo make install