This page explains how to build Debian packages for the VMware kernel modules. Of course you need to have VMware Workstation already installed; the package you'll find below will unpack and compile the kernel modules' sources shipped with VMware.
First things first: read the instructions below carefully before doing anything else!
This is not for the faint of hearth or the uninitiated. If you never tried to build a Debian package from source, learn how to do that before you come back here.
I don't mean to be offensive, but building kernels and modules correctly is difficult; pretending it isn't (or whining because it is) ain't going to help you in doing it. If at any time you don't feel confident with what you are doing, by all means stay with what you have and don't risk breaking your system.
apt-get and dpkg.
Please don't stay logged in as root any longer than necessary;
rather, I'd suggest to install sudo and use that.
Let's say you have several desktop machines that run VMware; you don't want to reconfigure VMware on all of them every time you upgrade the kernel.
These instructions will show you how to build a Debian package
containing the two VMware kernel modules, vmnet and vmmon.
Just install this package along with your new kernel
and the VMware startup will find the modules and load them,
so you won't need to run vmware-config.pl.
Please note that this package is useful only if you maintain several machines
and don't want to run around reconfiguring VMware when you upgrade the kernel.
If you have only one machine, building the modules with VMware's
vmware-config.pl script is perfectly fine.
You really need to install this package
at the same time as the corresponding kernel,
i.e. before you reboot with the new kernel,
otherwise VMware will not find its modules,
it will create a file called /etc/vmware/not_configured
and refuse to start until you run vmware-config.pl.
You need to install the kernel source code that corresponds to your running kernel and
configure it with make-kpkg.
This is obviously easy if you already compile your own kernel,
but it's going to require a bit of work if you are using a prebuilt kernel.
Alternatively, if you are using a prebuilt kernel,
install the official kernel-headers or linux-headers
package that matches the kernel you're using and skip this section entirely.
However, you still have to check that the kernel you're using has all
the correct configuration options.
You don't need to actually compile the kernel, but you do need to configure it properly. If you don't want to compile and install your own kernel, just install the sources for the same kernel version that you are using and use the configuration that came with your kernel package:
apt-get install kernel-source-2.x.y cd /usr/src tar xjvf kernel-source-2.x.y.tar.bz2 cd kernel-source-2.x.y cp /boot/config-2.x.y-flavour .config make-kpkg --append-to-version "-flavour" --revision 2.x.y-z --config old configure
"-flavour" is supposed to be a placeholder.
You need to replace it with the correct value for your kernel,
for example something like "-1-686" for prepackaged Debian kernels.
It's the text that follows the kernel version in the output from uname -r
and in the file names in the /boot directory.
"2.x.y-z" is the version of the kernel-image package you have installed. It should also be the same version as the kernel-source package.
If you already have a configured kernel source tree, you can use it, but make sure that it's exactly the same configuration you are using.
Make sure you have installed debhelper and fakeroot.
Note: most likely, you actually want just the prebuilt binary package. The source is useful only if you want to make changes.
Download the files above into a directory of your choice
(preferably /usr/src)
and unpack with
dpkg-source -x vmware-kernel-source_3.dsc
Then cd into the newly created vmware-kernel-source-3 directory and run
dpkg-buildpackage -b -rfakeroot -tc -uc -D
The build script will build the following packages in the parent directory:
Now you can install the packages and compile the kernel modules.
| Name | Size | MD5SUM |
|---|---|---|
| vmware-kernel-source_3_i386.deb | 5302 bytes | 82b8d3e1e8230bbf03b301928dbe2c84 |
| vmware-kernel-common_3_i386.deb | 2162 bytes | 7777784386155462d9cd3eababefd2a3 |
You can download these packages with apt by adding the following lines
to your /etc/apt/sources.list file:
deb http://www.stanchina.net/~flavio/debian/ / deb-src http://www.stanchina.net/~flavio/debian/ /
Note that there are other packages available here, but my repository is tagged as "experimental" so the default apt pinning policy will prevent unwanted upgrades to my versions for packages that are available from here and from official sources.
You need to install
the "vmware-kernel-source" and
the "vmware-kernel-common" packages.
cd .. dpkg -i vmware-kernel-source_3_i386.deb dpkg -i vmware-kernel-common_3_i386.deb
After you have installed the packages,
change directory to /usr/src and unpack the source:
tar xzvf vmware-kernel-source.tar.gz
You can now build the VMware kernel modules in several ways.
Choose one, preferably the module-assistant command.
make-kpkg commandcd /usr/src/kernel-source-2.x.y fakeroot make-kpkg --append-to-version "-flavour" --added-modules vmware-kernel-source modules_image
"-flavour" is supposed to be a placeholder. You need to replace it with the correct value for your kernel, for example something like "-1-686" for prepackaged Debian kernels. Refer to 2.1. Kernel source for more details.
This will build a new package, which you will have to install:
dpkg -i /usr/src/vmware-kernel-2.x.y_vmwareversion+kernelversion_i386.deb
Important:
If you build your own packages, please upgrade to debhelper 4.2.11
(see Debian bug #248624), otherwise
you will need to run update-modules yourself after installing the module.
module-assistantIf you have never built modules with module-assistant before, you should prepare the build environment by running:
module-assistant prepare
In the usual environment, module-assistant should detect all requirements. Example (assuming that you build for the running kernel):
module-assistant a-i vmware-kernel-source
module-assistant will unpack the sources for you, if necessary. Make sure to remove any old /usr/src/modules/vmware-kernel-source directory after an upgrade of the vmware-kernel-source package, because module-assistant will not do that for you.
If you prefer to build the packages with m-a from your own user account (with ~/src/linux being the kernel source):
mkdir -p ~/src/modass module-assistant -u ~/src/modass -k ~/src/linux install vmware-kernel-source
Note: A detailed explanation of module-assistant is beyond the scope of this document. Please refer to the module-assistant documentation.
The vmnet module doesn't support udev or devfs.
I patched an earlier version of vmnet to support devfs,
but I dropped that patch because it was not worth the effort to maintain it.
Instead, the vmware-kernel-common package installs an init script
that creates the vmnet device nodes during startup.
Alternatively, you can modify /etc/udev/links.conf
to have udev create the device nodes on startup:
M vmnet0 c 119 0 M vmnet1 c 119 1 ... M vmnet9 c 119 9 M vmmon c 10 165(note that in this case you'll have to change the source packages to remove the dependency on
vmware-kernel-common)