SOLVED: Building VMware Workstation modules on Linux 2.6.32

Monday, January 18th, 2010 at 12:02 am | 75,220 views | trackback url
Tags: ,

VMware logoI use a lot of VMware Workstation here to manage my development and testing, as well as virtualizing my work environment. Since my daughter crashed my laptop (quite literally, by accidentally dropping it on the floor), I had to rebuild it. The new build is running Ubuntu 10 (“Lucid”), and with it comes the 2.6.32-10-generic kernel.

Since VMware Workstation was released before 2.6.32, it doesn’t build clean. If you see errors building the initial modules, you’ll need to patch it. The errors you’ll see will look like this (scroll down for the simple fix):

$ sudo vmware-modconfig --console --install-all
Stopping VMware services:
VMware USB Arbitrator done
VM communication interface socket family done
Virtual machine communication interface done
Virtual machine monitor done
Blocking file system done
Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-root/modules/vmmon-only'
make -C /lib/modules/2.6.32-10-generic/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \
MODULEBUILDDIR= modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-10-generic'
CC [M] /tmp/vmware-root/modules/vmmon-only/linux/driver.o
CC [M] /tmp/vmware-root/modules/vmmon-only/linux/driverLog.o
CC [M] /tmp/vmware-root/modules/vmmon-only/linux/hostif.o
CC [M] /tmp/vmware-root/modules/vmmon-only/linux/iommu.o
CC [M] /tmp/vmware-root/modules/vmmon-only/common/comport.o
CC [M] /tmp/vmware-root/modules/vmmon-only/common/cpuid.o
CC [M] /tmp/vmware-root/modules/vmmon-only/common/hashFunc.o
CC [M] /tmp/vmware-root/modules/vmmon-only/common/memtrack.o
CC [M] /tmp/vmware-root/modules/vmmon-only/common/phystrack.o
CC [M] /tmp/vmware-root/modules/vmmon-only/common/task.o
CC [M] /tmp/vmware-root/modules/vmmon-only/common/vmx86.o
CC [M] /tmp/vmware-root/modules/vmmon-only/vmcore/moduleloop.o
LD [M] /tmp/vmware-root/modules/vmmon-only/vmmon.o
Building modules, stage 2.
MODPOST 1 modules
CC /tmp/vmware-root/modules/vmmon-only/vmmon.mod.o
LD [M] /tmp/vmware-root/modules/vmmon-only/vmmon.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-10-generic'
make -C $PWD SRCROOT=$PWD/. \
MODULEBUILDDIR= postbuild
make[1]: Entering directory `/tmp/vmware-root/modules/vmmon-only'
make[1]: `postbuild' is up to date.
make[1]: Leaving directory `/tmp/vmware-root/modules/vmmon-only'
cp -f vmmon.ko ./../vmmon.o
make: Leaving directory `/tmp/vmware-root/modules/vmmon-only'
Built vmmon module
Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-root/modules/vmnet-only'
make -C /lib/modules/2.6.32-10-generic/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \
MODULEBUILDDIR= modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-10-generic'
CC [M] /tmp/vmware-root/modules/vmnet-only/driver.o
CC [M] /tmp/vmware-root/modules/vmnet-only/hub.o
CC [M] /tmp/vmware-root/modules/vmnet-only/userif.o
CC [M] /tmp/vmware-root/modules/vmnet-only/netif.o
CC [M] /tmp/vmware-root/modules/vmnet-only/bridge.o
CC [M] /tmp/vmware-root/modules/vmnet-only/filter.o
CC [M] /tmp/vmware-root/modules/vmnet-only/procfs.o
CC [M] /tmp/vmware-root/modules/vmnet-only/smac_compat.o
CC [M] /tmp/vmware-root/modules/vmnet-only/smac.o
CC [M] /tmp/vmware-root/modules/vmnet-only/vnetEvent.o
CC [M] /tmp/vmware-root/modules/vmnet-only/vnetUserListener.o
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c: In function ‘VNetUserListenerEventHandler’:
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c:240: error: ‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c:240: error: (Each undeclared identifier is reported only once
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c:240: error: for each function it appears in.)
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c: In function ‘VNetUserListenerRead’:
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c:282: error: ‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c:282: error: implicit declaration of function ‘signal_pending’
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c:282: error: implicit declaration of function ‘schedule’
make[2]: *** [/tmp/vmware-root/modules/vmnet-only/vnetUserListener.o] Error 1
make[1]: *** [_module_/tmp/vmware-root/modules/vmnet-only] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-10-generic'
make: *** [vmnet.ko] Error 2
make: Leaving directory `/tmp/vmware-root/modules/vmnet-only'
Unable to install vmnet

To get a clean compile, we have to patch vmnet and vmci. The quickest way is to run the following few one-liners to unpack, patch and recompress the modules:

tar xvf /usr/lib/vmware/modules/source/vmnet.tar -C /tmp
tar xvf /usr/lib/vmware/modules/source/vmci.tar -C /tmp

cd /tmp

perl -pi -e 's,("vnetInt.h"),\1\n#include "compat_sched.h",' vmnet-only/vnetUserListener.c
perl -pi -e 's,("compat_page.h"),\1\n#include "compat_sched.h",' vmci-only/include/pgtbl.h

tar cvf /usr/lib/vmware/modules/source/vmnet.tar /tmp/vmnet-only
tar cvf /usr/lib/vmware/modules/source/vmci.tar /tmp/vmci-only

If you want a unified diff, here it is:

diff -ru /tmp/vmci-only/include/pgtbl.h tmp/vmci-only/include/pgtbl.h
--- /tmp/vmci-only/include/pgtbl.h 2009-10-22 06:54:15.000000000 -0400
+++ tmp/vmci-only/include/pgtbl.h       2010-01-17 22:52:44.127684350 -0500
@@ -24,6 +24,7 @@
 #include "compat_pgtable.h"
 #include "compat_spinlock.h"
 #include "compat_page.h"
+#include "compat_sched.h"
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 11)
 # define compat_active_mm  mm
diff -ru /tmp/vmnet-only/vnetUserListener.c tmp/vmnet-only/vnetUserListener.c
--- /tmp/vmnet-only/vnetUserListener.c     2009-10-22 06:54:13.000000000 -0400
+++ tmp/vmnet-only/vnetUserListener.c   2010-01-17 22:52:39.708362200 -0500
@@ -34,6 +34,7 @@
 #include "compat_skbuff.h"
 #include "compat_wait.h"
 #include "vnetInt.h"
+#include "compat_sched.h"
 
 typedef struct VNetUserListener_EventNode VNetUserListener_EventNode;

Problem solved! :)

# /etc/init.d/vmware start
Starting VMware services:
   VMware USB Arbitrator                                               done
   Virtual machine monitor                                             done
   Virtual machine communication interface                             done
   VM communication interface socket family                            done
   Blocking file system                                                done
   Virtual ethernet                                                    done
   Shared Memory Available                                             done

Last Modified: Sunday, March 6th, 2016 @ 02:39

18 Responses to “SOLVED: Building VMware Workstation modules on Linux 2.6.32”

  1. Thanks for the fix. But there’s an error in your re-tarring, since you’re already in /tmp, you should omit the /tmp/.. in the lines

    tar cvf /usr/lib/vmware/modules/source/vmnet.tar /tmp/vmnet-only
    tar cvf /usr/lib/vmware/modules/source/vmci.tar /tmp/vmci-only

    otherwise the archive gets an extra tmp in its extraction path and can’t be found.

    Either that or I made another stupid mistake ;)

  2. @wintamute, no, you’re absolutely right… there’s a typo in there. I’ve just updated the post to fix that, and now it should work. Thanks for catching it!

  3. make: *** /tmp/vmware-config0/vmci-only: No such file or directory.

    i still get this error on compile. Is just me?

  4. @Adi: Yes, that looks like your system is still trying to use an older config directory to build.

    Make sure you wipe out all /tmp/vmware-config* directories before attempting to build, so a previously-failed build directory isn’t caching bad objects.

    I’ve followed this exact procedure above about 100 times, and I know it works flawlessly.

  5. John D. Rowell said on

    Worked, tks. As wintamute mentioned, the final tar instructions are incorrect. Here are the correct ones:

    tar cvf /usr/lib/vmware/modules/source/vmnet.tar vmnet-only
    tar cvf /usr/lib/vmware/modules/source/vmci.tar vmci-only

    Also this apparently is all done as root. You can use your ~/tmp dir instead and just sudo the last 2 commands.

  6. Excellent! This is just what I need. The only trouble I had was that I needed stop the vmware service before recompiling by starting the vmware process.

  7. Thank you very much! I just upgraded to Ubuntu 10.04 and this fixed my VmWare problem. I also had a network problem, don’t get me started there….

  8. Hey Dave thanks for the help! Upgraded to 10.04 and Workstation 6.5.4, and got stuck on the initial install, but found the answer here:
    http://linux.aldeby.org/vmware-workstation-6-5-3-on-ubuntu-karmic-9-10.html
    After that I applied your fix and everything (so far) is working fine.

  9. You can turn the code above into patch by writing the following in a file called “patch.sh” and making it executable with chmod u+x patch.sh (Note that I do “cd tmp”).

    #!/bin/bash
    tar xvf /usr/lib/vmware/modules/source/vmnet.tar -C /tmp
    tar xvf /usr/lib/vmware/modules/source/vmci.tar -C /tmp

    cd /tmp

    perl -pi -e ‘s,(“vnetInt.h”),\1\n#include “compat_sched.h”,’ vmnet-only/vnetUserListener.c
    perl -pi -e ‘s,(“compat_page.h”),\1\n#include “compat_sched.h”,’ vmci-only/include/pgtbl.h

    cd /tmp
    tar cvf /usr/lib/vmware/modules/source/vmnet.tar vmnet-only
    tar cvf /usr/lib/vmware/modules/source/vmci.tar vmci-only

  10. Why thank you very much :))) !

    The story behind those modules not compiling for every next kernel release is quite long. So I’m keeping all those diffs in a separate patch file. So today I added your fixes for those two files, with which there’d been no problems before 2.6.31.
    It works now — till the next drastic changes in the kernel?

  11. […] Then I found the next tip on https://blog.gnu-designs.com/solved-building-vmware-workstation-modules-on-linux-2-6-32 […]

  12. This isn’t working for me. I’ve tried it many times.

    VMware workstation 6.54.

    After I run these commands, when I try to start VMware, the Virtual machine monitor and the Virtual ethernet both fail.

    Any ideas? I’m running these commands as root, and I corrected for the tmp typo in the original posting.

  13. Never mind. I got it working, basically by starting the entire install form scratch. Thank you. This was a huge help.

  14. Having similar issue – just vmnet doesn’t compile:
    $ uname -a
    Linux Khedron 2.6.38-2-amd64 #1 SMP Thu Apr 7 04:28:07 UTC 2011 x86_64 GNU/Linux

    $ cat /etc/debian_version
    wheezy/sid

    $ vmplayer –version
    VMware Player 3.1.4 build-385536

    Your GCC version: 4.4
    Building module vmnet.
    Extracting the sources of the vmnet module.
    Building module with command: /usr/bin/make -C /tmp/vmware-root/modules/vmnet-only auto-build SUPPORT_SMP=1 HEADER_DIR=/lib/modules/2.6.38-2-amd64/build/include CC=/usr/bin/gcc GREP=/usr/bin/make IS_GCC_3=no VMCCVER=4.4.5
    Failed to compile module vmnet!
    Trying to find a suitable PBM set for kernel 2.6.38-2-amd64.

    Using 2.6.x kernel build system.
    make: Entering directory `/tmp/vmware-root/modules/vmnet-only’
    make -C /lib/modules/2.6.38-2-amd64/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \
    MODULEBUILDDIR= modules
    make[1]: Entering directory `/usr/src/linux-headers-2.6.38-2-amd64′
    CC [M] /tmp/vmware-root/modules/vmnet-only/driver.o
    /tmp/vmware-root/modules/vmnet-only/driver.c: In function ‘VNetFileOpUnlockedIoctl’:
    /tmp/vmware-root/modules/vmnet-only/driver.c:1137: error: implicit declaration of function ‘lock_kernel’
    /tmp/vmware-root/modules/vmnet-only/driver.c:1139: error: implicit declaration of function ‘unlock_kernel’
    make[4]: *** [/tmp/vmware-root/modules/vmnet-only/driver.o] Error 1
    make[3]: *** [_module_/tmp/vmware-root/modules/vmnet-only] Error 2
    make[2]: *** [sub-make] Error 2
    make[1]: *** [all] Error 2
    make[1]: Leaving directory `/usr/src/linux-headers-2.6.38-2-amd64′
    make: *** [vmnet.ko] Error 2
    make: Leaving directory `/tmp/vmware-root/modules/vmnet-only’

    Starting VMware services:
    VMware USB Arbitrator done
    Virtual machine monitor done
    Virtual machine communication interface done
    VM communication interface socket family done
    Blocking file system done
    Virtual ethernet failed

    Any idea howto fix it?

  15. This should help:

    https://www.assembla.com/code/id_slackware/subversion/nodes/trunk/vmware/vmware-2.6.37/vmware-7.1.3-2.6.37-9-generic.patch?rev=11

    And this script, which you’ll have to modify somewhat to support what you’re doing:

    https://www.assembla.com/code/id_slackware/subversion/nodes/trunk/vmware/vmware-2.6.37/patch-modules_v62.sh?rev=11

  16. Hi,
    I’ve followed the guide but i get…
    $ sudo vmware-modconfig –console –install-all
    Stopping VMware services:
    VMware USB Arbitrator done
    VM communication interface socket family done
    Virtual machine communication interface done
    Virtual machine monitor done
    Blocking file system done
    Using 2.6.x kernel build system.
    make: Entering directory `/tmp/vmware-root/modules/vmmon-only’
    make -C /lib/modules/2.6.38-2-686/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \
    MODULEBUILDDIR= modules
    make[1]: Entering directory `/usr/src/linux-headers-2.6.38-2-686′
    CC [M] /tmp/vmware-root/modules/vmmon-only/linux/driver.o
    CC [M] /tmp/vmware-root/modules/vmmon-only/linux/driverLog.o
    CC [M] /tmp/vmware-root/modules/vmmon-only/linux/hostif.o
    /tmp/vmware-root/modules/vmmon-only/linux/hostif.c: In function ‘HostIFReadUptimeWork’:
    /tmp/vmware-root/modules/vmmon-only/linux/hostif.c:2004: warning: ‘newUpBase’ may be used uninitialized in this function
    CC [M] /tmp/vmware-root/modules/vmmon-only/linux/iommu.o
    /tmp/vmware-root/modules/vmmon-only/linux/iommu.c: In function ‘IOMMU_SetupMMU’:
    /tmp/vmware-root/modules/vmmon-only/linux/iommu.c:103: warning: cast from pointer to integer of different size
    /tmp/vmware-root/modules/vmmon-only/linux/iommu.c:113: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 3 has type ‘long long unsigned int’
    /tmp/vmware-root/modules/vmmon-only/linux/iommu.c:117: warning: cast to pointer from integer of different size
    /tmp/vmware-root/modules/vmmon-only/linux/iommu.c:120: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 3 has type ‘uint64’
    CC [M] /tmp/vmware-root/modules/vmmon-only/common/comport.o
    CC [M] /tmp/vmware-root/modules/vmmon-only/common/cpuid.o
    CC [M] /tmp/vmware-root/modules/vmmon-only/common/hashFunc.o
    CC [M] /tmp/vmware-root/modules/vmmon-only/common/memtrack.o
    CC [M] /tmp/vmware-root/modules/vmmon-only/common/phystrack.o
    CC [M] /tmp/vmware-root/modules/vmmon-only/common/task.o
    CC [M] /tmp/vmware-root/modules/vmmon-only/common/vmx86.o
    CC [M] /tmp/vmware-root/modules/vmmon-only/vmcore/moduleloop.o
    LD [M] /tmp/vmware-root/modules/vmmon-only/vmmon.o
    Building modules, stage 2.
    MODPOST 1 modules
    CC /tmp/vmware-root/modules/vmmon-only/vmmon.mod.o
    LD [M] /tmp/vmware-root/modules/vmmon-only/vmmon.ko
    make[1]: Leaving directory `/usr/src/linux-headers-2.6.38-2-686′
    make -C $PWD SRCROOT=$PWD/. \
    MODULEBUILDDIR= postbuild
    make[1]: Entering directory `/tmp/vmware-root/modules/vmmon-only’
    make[1]: `postbuild’ is up to date.
    make[1]: Leaving directory `/tmp/vmware-root/modules/vmmon-only’
    cp -f vmmon.ko ./../vmmon.o
    make: Leaving directory `/tmp/vmware-root/modules/vmmon-only’
    Built vmmon module
    make: *** /tmp/vmware-root/modules/vmnet-only: No such file or directory. Stop.
    Unable to install vmnet

    I opened nautilus to see whta happen during the compilation time in /tmp/vmware-root/
    and the directory modules/vmnet-only is created but in the end the process delete it and hangs out.

  17. Not sure if anyone is still facing this problem the error mentioned above “make: *** /tmp/vmware-root/modules/vmnet-only: No such file or directory. Stop.” is caused because of using the command

    tar cvf /usr/lib/vmware/modules/source/vmnet.tar /tmp/vmnet-only

    instead of

    tar cvf /usr/lib/vmware/modules/source/vmnet.tar vmnet-only

    Follow as below:
    tar xvf /usr/lib/vmware/modules/source/vmnet.tar -C /tmp
    tar xvf /usr/lib/vmware/modules/source/vmci.tar -C /tmp

    cd /tmp

    perl -pi -e ‘s,(“vnetInt.h”),\1\n#include “compat_sched.h”,’ vmnet-only/vnetUserListener.c
    perl -pi -e ‘s,(“compat_page.h”),\1\n#include “compat_sched.h”,’ vmci-only/include/pgtbl.h

    tar cvf /usr/lib/vmware/modules/source/vmnet.tar vmnet-only
    tar cvf /usr/lib/vmware/modules/source/vmci.tar vmci-only

  18. Hi,

    this error “make: *** /tmp/vmware-root/modules/vmnet-only: No such file or directory. Stop.
    Unable to install vmnet” is because of the command
    tar cvf /usr/lib/vmware/modules/source/vmnet.tar /tmp/vmnet-only
    It untars intp /tmp/vmnet-only therefore not found during make.
    Instead use:-
    cd /tmp
    tar cvf /usr/lib/vmware/modules/source/vmnet.tar vmnet-only/

    Same for the other tar


Leave a Reply

You must be logged in to post a comment.

Bad Behavior has blocked 737 access attempts in the last 7 days.