The latest Linux kernel 4.10 is out and ships with Ubuntu 17.04. Since we moved over to that kernel Wifi stopped working on our Dell XPS-13 (9343) due to lousy Broadcom drivers. So we bought a new Intel 7265 WLAN card and replaced the Broadcom card that ships with XPS-13 (9343). Suddenly everything is working. Great! We could now install Ubuntu 17.04 Budgie (a really nice OS btw), which ships with the 4.10 kernel. This guide should also work on any other distro with the 4.10 kernel, though we have not tested.

Installing VMware

The installation of Ubuntu 17.04  was no issue at all, everything went smooth and everything worked at first boot, except VMware. We were using the VMware 12.5 installation files and installation went fine at first, but when we were about to start VMware it first gave us an error regarding that GCC was missing. So we installed gcc and build-essentials and thought that was all we had to do… Nope, VMware was still complaining and the logs told us that the installation of vmon was failing etc etc:

    2017-04-17T03:08:23.988+02:00| vthread-4| I125: The header path "/lib/modules/4.10.0-19-generic/build/include" for the kernel "4.10.0-19-generic" is valid.  Whoohoo!
    2017-04-17T03:08:23.989+02:00| vthread-4| I125: The GCC version matches the kernel GCC minor version like a glove.
    2017-04-17T03:08:23.989+02:00| vthread-4| I125: Validating path "/lib/modules/4.10.0-19-generic/build/include" for kernel release "4.10.0-19-generic".
    2017-04-17T03:08:23.989+02:00| vthread-4| I125: Failed to find /lib/modules/4.10.0-19-generic/build/include/linux/version.h
    2017-04-17T03:08:23.989+02:00| vthread-4| I125: /lib/modules/4.10.0-19-generic/build/include/linux/version.h not found, looking for generated/uapi/linux/version.h instead.
    2017-04-17T03:08:23.989+02:00| vthread-4| I125: using /usr/bin/gcc for preprocess check
    2017-04-17T03:08:23.996+02:00| vthread-4| I125: Preprocessed UTS_RELEASE, got value "4.10.0-19-generic".
    2017-04-17T03:08:23.996+02:00| vthread-4| I125: The header path "/lib/modules/4.10.0-19-generic/build/include" for the kernel "4.10.0-19-generic" is valid.  Whoohoo!
    2017-04-17T03:08:23.996+02:00| vthread-4| I125: Using temp dir "/tmp".
    2017-04-17T03:08:23.997+02:00| vthread-4| I125: Obtaining info using the running kernel.
    2017-04-17T03:08:23.997+02:00| vthread-4| I125: Setting header path for 4.10.0-19-generic to "/lib/modules/4.10.0-19-generic/build/include".
    2017-04-17T03:08:23.997+02:00| vthread-4| I125: Validating path "/lib/modules/4.10.0-19-generic/build/include" for kernel release "4.10.0-19-generic".
    2017-04-17T03:08:23.997+02:00| vthread-4| I125: Failed to find /lib/modules/4.10.0-19-generic/build/include/linux/version.h
    2017-04-17T03:08:23.997+02:00| vthread-4| I125: /lib/modules/4.10.0-19-generic/build/include/linux/version.h not found, looking for generated/uapi/linux/version.h instead.
    2017-04-17T03:08:23.997+02:00| vthread-4| I125: using /usr/bin/gcc for preprocess check
    2017-04-17T03:08:24.004+02:00| vthread-4| I125: Preprocessed UTS_RELEASE, got value "4.10.0-19-generic".
    2017-04-17T03:08:24.004+02:00| vthread-4| I125: The header path "/lib/modules/4.10.0-19-generic/build/include" for the kernel "4.10.0-19-generic" is valid.  Whoohoo!
    2017-04-17T03:08:24.149+02:00| vthread-4| I125: found symbol version file /lib/modules/4.10.0-19-generic/build/Module.symvers
    2017-04-17T03:08:24.149+02:00| vthread-4| I125: Reading symbol versions from /lib/modules/4.10.0-19-generic/build/Module.symvers.
    2017-04-17T03:08:24.169+02:00| vthread-4| I125: Read 21363 symbol versions
    2017-04-17T03:08:24.169+02:00| vthread-4| I125: Invoking modinfo on "vmmon".
    2017-04-17T03:08:24.171+02:00| vthread-4| I125: "/sbin/modinfo" exited with status 256.
    2017-04-17T03:08:24.171+02:00| vthread-4| I125: Invoking modinfo on "vmnet".
    2017-04-17T03:08:24.172+02:00| vthread-4| I125: "/sbin/modinfo" exited with status 256.
    2017-04-17T03:08:24.534+02:00| vthread-4| I125: Setting destination path for vmmon to "/lib/modules/4.10.0-19-generic/misc/vmmon.ko".
    2017-04-17T03:08:24.534+02:00| vthread-4| I125: Extracting the vmmon source from "/usr/lib/vmware/modules/source/vmmon.tar".
    2017-04-17T03:08:24.542+02:00| vthread-4| I125: Successfully extracted the vmmon source.
    2017-04-17T03:08:24.542+02:00| vthread-4| I125: Building module with command "/usr/bin/make -j4 -C /tmp/modconfig-PpIKlV/vmmon-only auto-build HEADER_DIR=/lib/modules/4.10.0-19-generic/build/include CC=/usr/bin/gcc IS_GCC_3=no"
    2017-04-17T03:08:26.435+02:00| vthread-4| W115: Failed to build vmmon.  Failed to execute the build command.
    2017-04-17T03:08:26.438+02:00| vthread-4| I125: Setting destination path for vmnet to "/lib/modules/4.10.0-19-generic/misc/vmnet.ko".
    2017-04-17T03:08:26.438+02:00| vthread-4| I125: Extracting the vmnet source from "/usr/lib/vmware/modules/source/vmnet.tar".
    2017-04-17T03:08:26.443+02:00| vthread-4| I125: Successfully extracted the vmnet source.
    2017-04-17T03:08:26.444+02:00| vthread-4| I125: Building module with command "/usr/bin/make -j4 -C /tmp/modconfig-PpIKlV/vmnet-only auto-build HEADER_DIR=/lib/modules/4.10.0-19-generic/build/include CC=/usr/bin/gcc IS_GCC_3=no"

So we tried to build it ourselves and got this instead:

root@XPS-13:/usr/lib/vmware/modules/source/vmnet-only# make
Using kernel build system.
make -C /lib/modules/4.10.0-19-generic/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \
  MODULEBUILDDIR= modules
make[1]: Entering directory '/usr/src/linux-headers-4.10.0-19-generic'
  CC [M]  /usr/lib/vmware/modules/source/vmnet-only/userif.o
/usr/lib/vmware/modules/source/vmnet-only/userif.c: In function ‘UserifLockPage’:
/usr/lib/vmware/modules/source/vmnet-only/userif.c:117:43: error: passing argument 5 of ‘get_user_pages’ from incompatible pointer type [-Werror=incompatible-pointer-types]
    retval = get_user_pages(addr, 1, 1, 0, &page, NULL);
                                           ^
In file included from ./include/linux/highmem.h:7:0,
                 from /usr/lib/vmware/modules/source/vmnet-only/userif.c:26:
./include/linux/mm.h:1293:6: note: expected ‘struct vm_area_struct **’ but argument is of type ‘struct page **’
 long get_user_pages(unsigned long start, unsigned long nr_pages,
      ^~~~~~~~~~~~~~
/usr/lib/vmware/modules/source/vmnet-only/userif.c:117:13: error: too many arguments to function ‘get_user_pages’
    retval = get_user_pages(addr, 1, 1, 0, &page, NULL);
             ^~~~~~~~~~~~~~
In file included from ./include/linux/highmem.h:7:0,
                 from /usr/lib/vmware/modules/source/vmnet-only/userif.c:26:
./include/linux/mm.h:1293:6: note: declared here
 long get_user_pages(unsigned long start, unsigned long nr_pages,
      ^~~~~~~~~~~~~~
cc1: some warnings being treated as errors
scripts/Makefile.build:294: recipe for target '/usr/lib/vmware/modules/source/vmnet-only/userif.o' failed
make[2]: *** [/usr/lib/vmware/modules/source/vmnet-only/userif.o] Error 1
Makefile:1524: recipe for target '_module_/usr/lib/vmware/modules/source/vmnet-only' failed
make[1]: *** [_module_/usr/lib/vmware/modules/source/vmnet-only] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.10.0-19-generic'
Makefile:120: recipe for target 'vmnet.ko' failed
make: *** [vmnet.ko] Error 2
root@XPS-13:/usr/lib/vmware/modules/source/vmnet-only#

We googled the issue and found a patch that we applied, crossing our fingers hoping it would work. It turns out it did, and as the 4.10 kernel is still kind of new and we saw many forum posts about others in the same situation, we thought we would tell the world how it’s done.

  1. Install VMware as normal

    In our case we installed VMware with a bundle file. To get the bundle to run you have to chmod a+x it to be executable then run this as root:

    $~: ./VMware-Workstation-Full-12.5.bundle #(example filename)
  2. Install GCC and build-essentials
    $~: apt install gcc build-essential

    It should install gcc 6.3.0. You can check by typing this in CLI

    $~: gcc -v
  3. Patch VMware

    It may seem hard, but really, it’s easy. It’s all about patching the VM installation files. Though we want to say; do it at your own risk.

    $~: tar -xf /usr/lib/vmware/modules/source/vmmon.tar
    $~: gedit vmmon-only/linux/hostif.c

    In vmmon-only/linux/hostif.c, around line 1162, change

    #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
    retval = get_user_pages((unsigned long)uvAddr, numPages, 0, 0, ppages, NULL);
    #else
    retval = get_user_pages(current, current->mm, (unsigned long)uvAddr,
    numPages, 0, 0, ppages, NULL);
    #endif

    to

    #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
    retval = get_user_pages((unsigned long)uvAddr, numPages, 0, ppages, NULL);
    #else
    #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
    retval = get_user_pages((unsigned long)uvAddr, numPages, 0, 0, ppages, NULL);
    #else
    retval = get_user_pages(current, current->mm, (unsigned long)uvAddr,
    numPages, 0, 0, ppages, NULL);
    #endif
    #endif
    $~: sudo tar -cf /usr/lib/vmware/modules/source/vmmon.tar vmmon-only/
    $~: tar -xf /usr/lib/vmware/modules/source/vmnet.tar
    $~: gedit vmnet-only/userif.c

    In vmnet-only/userif.c, around line 113, change

    #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
    retval = get_user_pages(addr, 1, 1, 0, &page, NULL);
    #else
    retval = get_user_pages(current, current->mm, addr,
    1, 1, 0, &page, NULL);
    #endif

    to

    #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
    retval = get_user_pages(addr, 1, 0, &page, NULL);
    #else
    #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
    retval = get_user_pages(addr, 1, 1, 0, &page, NULL);
    #else
    retval = get_user_pages(current, current->mm, addr,
    1, 1, 0, &page, NULL);
    #endif
    #endif
    $~: sudo tar -cf /usr/lib/vmware/modules/source/vmnet.tar vmnet-only/
  4. Run VMware again

    Now just start VMware as normal and it should install vmon and vmnet correctly.

We hope this guide helped you and that everything now works as expected. Drop a line in the comments below if you’d like, or;