Build host vmware kernel modules

From VI-Toolkit
Jump to navigation Jump to search

Integrated modules build script sometimes fails

The kernel modules script on linux hosts VMware Player version 2.5 and VMware Workstation 6.5.x has received a graphical user interface. Because of this it provides a much smoother end user experience when the user upgrades to a newer version of the kernel. Unless there's a dependency on which it breaks. In that case you might get the error

VMware Player is installed, but it has not been (correctly) configured for your running kernel. To (re-)configure it, your system administrator must find and run "vmware-config.pl"...

Unfortunately there is no vmware-config.pl script anymore, that's a left over from the previous version.

Lucky enough Noel on the vmware forums has created a script to resolve this which can be found here 6.5 Segfault in 6.5 beta

The solution

You must run the following script with root privileges

#!/bin/bash

cd ~
rm -rf vmware-modules
mkdir vmware-modules
cd vmware-modules
find /usr/lib/vmware/modules/source -name "*.tar" -exec tar xf '{}' \;
mkdir -p /lib/modules/`uname -r`/misc
rm -f /lib/modules/`uname -r`/misc/{vmblock.ko,vmci.ko,vmmon.ko,vmnet.ko,vsock.ko}
cd vmblock-only; make; cd ..; cp -p vmblock.o /lib/modules/`uname -r`/misc/vmblock.ko
cd vmci-only; make; cd ..; cp -p vmci.o /lib/modules/`uname -r`/misc/vmci.ko
cd vmmon-only; make; cd ..; cp -p vmmon.o /lib/modules/`uname -r`/misc/vmmon.ko
cd vmnet-only; make; cd ..; cp -p vmnet.o /lib/modules/`uname -r`/misc/vmnet.ko
#cd vmppuser-only; make; cd ..; cp -p vmppuser.o /lib/modules/`uname -r`/misc/vmppuser.ko
cd vsock-only; make; cd ..; cp -p vsock.o /lib/modules/`uname -r`/misc/vsock.ko
depmod -a
service vmware restart
#If a new install, remove the not_configured tag or the error will keep coming back
rm -f /etc/vmware/not_configured 

Preconditions for the script to work

You will have to get your kernel-headers before hand. On Ubuntu or debian based systems execute this:

sudo apt-get install linux-headers-$(uname -r)

On fedora / Red Hat based systems:

su -c "yum install kernel-devel"

On SUSE / openSUSE use YaST to fetch the latest linux-kernel-headers

Troubleshooting

After the manual compile, your folder with kernel modules should look like this:

$ ls -l /lib/modules/`uname -r`/misc
total 376
-rw-r--r-- 1 root root 36509 2008-12-07 01:07 vmblock.ko
-rw-r--r-- 1 root root 95745 2008-12-07 01:07 vmci.ko
-rw-r--r-- 1 root root 118128 2008-12-07 01:07 vmmon.ko
-rw-r--r-- 1 root root 79897 2008-12-07 01:07 vmnet.ko
-rw-r--r-- 1 root root 34834 2008-12-07 01:07 vsock.ko


If you get error "Icon name must be set." then you can fix that by adding the parameter for that to vmware-modconfig:

vmware-modconfig --icon="vmware-workstation"

If you get error "Application name must be set" then you can fix that by adding the parameter to set that:

vmware-modconfig --appname="VMware Workstation"

Alternative solution

Of course there is still a vmware application available that you can use for this as well. Birdie came up with a smart alternative so you can keep things like they used to be by creating an alias for the modconfig with the correct parameters to run it in the console.

alias vmware-config.pl='vmware-modconfig --console --install-all'