vmware 支持 linux kernel >= 4.2

最近升级了内核到 4.2 , 导致以前的 vmware 10 不能用了.

before you can run vmware, several modules must be compiled and loaded into the running kernel.

如上, 启动时要求重新编译和加载某些模块, 但是编译错误不成功, 查看提示的日志:

$ sudo tail /tmp/vmware-root/vmware-modconfig-9613.log

2016-12-28T22:28:57.500+08:00| vthread-3| I120: Extracting the vmnet source from "/usr/lib/vmware/modules/source/vmnet.tar".
2016-12-28T22:28:57.505+08:00| vthread-3| I120: Successfully extracted the vmnet source.
2016-12-28T22:28:57.505+08:00| vthread-3| I120: Building module with command "/usr/bin/make -j8 -C /tmp/modconfig-WP5c0z/vmnet-only auto-build HEADER_DIR=/lib/modules/4.2.0-040200rc8-generic/build/include CC=/usr/bin/gcc IS_GCC_3=no"
2016-12-28T22:28:58.535+08:00| vthread-3| W110: Failed to build vmnet. Failed to execute the build command.

可知, kernel 的变更影响了 vmnet 模块.

方法 1: fail...


重新编译 vmnet 模块.

cd /usr/lib/vmware/modules/source
unpack vmnet.tar
cd vmnet-only
make
cd ..
unpack vmmon.tar
cd vmmon-only
make
cd ..
cp vmmon.o /lib/modules/`uname -r`/misc/vmmon.ko
cp vmnet.o /lib/modules/`uname -r`/misc/vmnet.ko
depmod -a
/etc/init.d/vmware restart

但是, 在编译 vmnet 时, 提示编译错误:

$ sudo make
Using 2.6.x kernel build system.
make -C /lib/modules/4.2.0-040200rc8-generic/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \
MODULEBUILDDIR= modules
make[1]: Entering directory `/usr/src/linux-headers-4.2.0-040200rc8-generic'
CC [M] /usr/lib/vmware/modules/source/vmnet-only/driver.o
/usr/lib/vmware/modules/source/vmnet-only/driver.c: In function ‘VNetFileOpUnlockedIoctl’:
/usr/lib/vmware/modules/source/vmnet-only/driver.c:1194:20: error: ‘struct file’ has no member named ‘f_dentry’
if (filp && filp->f_dentry) {
^
/usr/lib/vmware/modules/source/vmnet-only/driver.c:1195:19: error: ‘struct file’ has no member named ‘f_dentry’
inode = filp->f_dentry->d_inode;
^
make[2]: *** [/usr/lib/vmware/modules/source/vmnet-only/driver.o] Error 1
make[1]: *** [_module_/usr/lib/vmware/modules/source/vmnet-only] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-4.2.0-040200rc8-generic'
make: *** [vmnet.ko] Error 2

还是放弃这种做法, 不够优雅, 修改底层的东西以后会花很多时间处理手尾.

方法2: 使用新版的支持 kernel > 4 的 vmware 12


推荐这个方法, 首先先卸载 vmware 10.

查看已安装的 vmware 产品:

$ sudo vmware-installer -l

(vmware-installer.py:6178): Gtk-WARNING **: Unable to locate theme engine in module_path: "adwaita",

(vmware-installer.py:6178): Gtk-WARNING **: Unable to locate theme engine in module_path: "adwaita",
/usr/share/themes/Adwaita/gtk-2.0/gtkrc:1137: error: unexpected identifier `direction', expected character `}'
Gtk-Message: Failed to load module "canberra-gtk-module": libcanberra-gtk-module.so: cannot open shared object file: No such file or directory
Product Name Product Version
==================== ====================
vmware-workstation 10.0.6.2700073

卸载 vmware-workstation :

sudo vmware-installer --uninstall-product vmware-workstation

下载 vmware workstation 12.5 并安装:

sudo bash ./VMware-Workstation-Full-12.5.2-4638234.x86_64.bundle

搞定.

参考


http://askubuntu.com/questions/131045/how-do-i-uninstall-vmware-workstation
http://askubuntu.com/questions/724883/vmware-player-not-working-with-linux-kernel-4-2-5