Vmware Workstation on Ubuntu 17.04

I have recently updated to Ubuntu 17.04. Unfortunately I can't run VMware Workstation, because the kernel modules won't install.

This is the log file:

2017-04-16T12:59:06.065+01:00| vthread-4| I125: Log for VMware Workstation pid=6683 version=12.5.2 build=build-4638234 option=Release
2017-04-16T12:59:06.065+01:00| vthread-4| I125: The process is 64-bit.
2017-04-16T12:59:06.065+01:00| vthread-4| I125: Host codepage=UTF-8 encoding=UTF-8
2017-04-16T12:59:06.065+01:00| vthread-4| I125: Host is Linux 4.10.0-19-generic Ubuntu 17.04
2017-04-16T12:59:06.064+01:00| vthread-4| I125: DictionaryLoad: Cannot open file "/usr/lib/vmware/settings": No such file or directory.
2017-04-16T12:59:06.064+01:00| vthread-4| I125: PREF Optional preferences file not found at /usr/lib/vmware/settings. Using default values.
2017-04-16T12:59:06.064+01:00| vthread-4| I125: DictionaryLoad: Cannot open file "/root/.vmware/config": No such file or directory.
2017-04-16T12:59:06.064+01:00| vthread-4| I125: PREF Optional preferences file not found at /root/.vmware/config. Using default values.
2017-04-16T12:59:06.064+01:00| vthread-4| I125: PREF Unable to check permissions for preferences file.
2017-04-16T12:59:06.064+01:00| vthread-4| I125: DictionaryLoad: Cannot open file "/root/.vmware/preferences": No such file or directory.
2017-04-16T12:59:06.064+01:00| vthread-4| I125: PREF Failed to load user preferences.
2017-04-16T12:59:06.107+01:00| vthread-4| W115: Logging to /tmp/vmware-root/vmware-6683.log
2017-04-16T12:59:06.113+01:00| vthread-4| I125: Obtaining info using the running kernel.
2017-04-16T12:59:06.113+01:00| vthread-4| I125: Created new pathsHash.
2017-04-16T12:59:06.113+01: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-16T12:59:06.113+01: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-16T12:59:06.113+01:00| vthread-4| I125: Failed to find /lib/modules/4.10.0-19-generic/build/include/linux/version.h
2017-04-16T12:59:06.113+01: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-16T12:59:06.113+01:00| vthread-4| I125: using /usr/bin/gcc for preprocess check
2017-04-16T12:59:06.119+01:00| vthread-4| I125: Preprocessed UTS_RELEASE, got value "4.10.0-19-generic".
2017-04-16T12:59:06.119+01: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-16T12:59:06.247+01:00| vthread-4| I125: found symbol version file /lib/modules/4.10.0-19-generic/build/Module.symvers
2017-04-16T12:59:06.248+01:00| vthread-4| I125: Reading symbol versions from /lib/modules/4.10.0-19-generic/build/Module.symvers.
2017-04-16T12:59:06.265+01:00| vthread-4| I125: Read 21363 symbol versions
2017-04-16T12:59:06.265+01:00| vthread-4| I125: Reading in info for the vmmon module.
2017-04-16T12:59:06.265+01:00| vthread-4| I125: Reading in info for the vmnet module.
2017-04-16T12:59:06.265+01:00| vthread-4| I125: Reading in info for the vmblock module.
2017-04-16T12:59:06.265+01:00| vthread-4| I125: Reading in info for the vmci module.
2017-04-16T12:59:06.265+01:00| vthread-4| I125: Reading in info for the vsock module.
2017-04-16T12:59:06.265+01:00| vthread-4| I125: Setting vsock to depend on vmci.
2017-04-16T12:59:06.265+01:00| vthread-4| I125: Invoking modinfo on "vmmon".
2017-04-16T12:59:06.267+01:00| vthread-4| I125: "/sbin/modinfo" exited with status 256.
2017-04-16T12:59:06.267+01:00| vthread-4| I125: Invoking modinfo on "vmnet".
2017-04-16T12:59:06.268+01:00| vthread-4| I125: "/sbin/modinfo" exited with status 256.
2017-04-16T12:59:06.268+01:00| vthread-4| I125: Invoking modinfo on "vmblock".
2017-04-16T12:59:06.269+01:00| vthread-4| I125: "/sbin/modinfo" exited with status 256.
2017-04-16T12:59:06.269+01:00| vthread-4| I125: Invoking modinfo on "vmci".
2017-04-16T12:59:06.270+01:00| vthread-4| I125: "/sbin/modinfo" exited with status 256.
2017-04-16T12:59:06.270+01:00| vthread-4| I125: Invoking modinfo on "vsock".
2017-04-16T12:59:06.271+01:00| vthread-4| I125: "/sbin/modinfo" exited with status 0.
2017-04-16T12:59:06.286+01:00| vthread-4| I125: to be installed: vmmon status: 0
2017-04-16T12:59:06.286+01:00| vthread-4| I125: to be installed: vmnet status: 0
2017-04-16T12:59:06.308+01:00| vthread-4| I125: Obtaining info using the running kernel.
2017-04-16T12:59:06.308+01: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-16T12:59:06.308+01: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-16T12:59:06.308+01:00| vthread-4| I125: Failed to find /lib/modules/4.10.0-19-generic/build/include/linux/version.h
2017-04-16T12:59:06.308+01: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-16T12:59:06.308+01:00| vthread-4| I125: using /usr/bin/gcc for preprocess check
2017-04-16T12:59:06.313+01:00| vthread-4| I125: Preprocessed UTS_RELEASE, got value "4.10.0-19-generic".
2017-04-16T12:59:06.313+01: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-16T12:59:06.434+01:00| vthread-4| I125: found symbol version file /lib/modules/4.10.0-19-generic/build/Module.symvers
2017-04-16T12:59:06.434+01:00| vthread-4| I125: Reading symbol versions from /lib/modules/4.10.0-19-generic/build/Module.symvers.
2017-04-16T12:59:06.451+01:00| vthread-4| I125: Read 21363 symbol versions
2017-04-16T12:59:06.451+01:00| vthread-4| I125: Kernel header path retrieved from FileEntry: /lib/modules/4.10.0-19-generic/build/include
2017-04-16T12:59:06.451+01:00| vthread-4| I125: Update kernel header path to /lib/modules/4.10.0-19-generic/build/include
2017-04-16T12:59:06.451+01: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-16T12:59:06.451+01:00| vthread-4| I125: Failed to find /lib/modules/4.10.0-19-generic/build/include/linux/version.h
2017-04-16T12:59:06.451+01: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-16T12:59:06.451+01:00| vthread-4| I125: using /usr/bin/gcc for preprocess check
2017-04-16T12:59:06.456+01:00| vthread-4| I125: Preprocessed UTS_RELEASE, got value "4.10.0-19-generic".
2017-04-16T12:59:06.456+01: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-16T12:59:06.457+01:00| vthread-4| I125: Found compiler at "/usr/bin/gcc"
2017-04-16T12:59:06.459+01:00| vthread-4| I125: Got gcc version "6.3.0".
2017-04-16T12:59:06.459+01:00| vthread-4| I125: The GCC version matches the kernel GCC minor version like a glove.
2017-04-16T12:59:06.459+01:00| vthread-4| I125: Using user supplied compiler "/usr/bin/gcc".
2017-04-16T12:59:06.461+01:00| vthread-4| I125: Got gcc version "6.3.0".
2017-04-16T12:59:06.461+01:00| vthread-4| I125: The GCC version matches the kernel GCC minor version like a glove.
2017-04-16T12:59:06.462+01:00| vthread-4| I125: Trying to find a suitable PBM set for kernel "4.10.0-19-generic".
2017-04-16T12:59:06.462+01:00| vthread-4| I125: No matching PBM set was found for kernel "4.10.0-19-generic".
2017-04-16T12:59:06.462+01:00| vthread-4| I125: The GCC version matches the kernel GCC minor version like a glove.
2017-04-16T12:59:06.462+01: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-16T12:59:06.462+01:00| vthread-4| I125: Failed to find /lib/modules/4.10.0-19-generic/build/include/linux/version.h
2017-04-16T12:59:06.462+01: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-16T12:59:06.462+01:00| vthread-4| I125: using /usr/bin/gcc for preprocess check
2017-04-16T12:59:06.468+01:00| vthread-4| I125: Preprocessed UTS_RELEASE, got value "4.10.0-19-generic".
2017-04-16T12:59:06.468+01: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-16T12:59:06.469+01:00| vthread-4| I125: The GCC version matches the kernel GCC minor version like a glove.
2017-04-16T12:59:06.469+01: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-16T12:59:06.469+01:00| vthread-4| I125: Failed to find /lib/modules/4.10.0-19-generic/build/include/linux/version.h
2017-04-16T12:59:06.469+01: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-16T12:59:06.469+01:00| vthread-4| I125: using /usr/bin/gcc for preprocess check
2017-04-16T12:59:06.475+01:00| vthread-4| I125: Preprocessed UTS_RELEASE, got value "4.10.0-19-generic".
2017-04-16T12:59:06.475+01: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-16T12:59:06.475+01:00| vthread-4| I125: Using temp dir "/tmp".
2017-04-16T12:59:06.476+01:00| vthread-4| I125: Obtaining info using the running kernel.
2017-04-16T12:59:06.476+01: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-16T12:59:06.476+01: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-16T12:59:06.476+01:00| vthread-4| I125: Failed to find /lib/modules/4.10.0-19-generic/build/include/linux/version.h
2017-04-16T12:59:06.476+01: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-16T12:59:06.476+01:00| vthread-4| I125: using /usr/bin/gcc for preprocess check
2017-04-16T12:59:06.481+01:00| vthread-4| I125: Preprocessed UTS_RELEASE, got value "4.10.0-19-generic".
2017-04-16T12:59:06.481+01: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-16T12:59:06.608+01:00| vthread-4| I125: found symbol version file /lib/modules/4.10.0-19-generic/build/Module.symvers
2017-04-16T12:59:06.608+01:00| vthread-4| I125: Reading symbol versions from /lib/modules/4.10.0-19-generic/build/Module.symvers.
2017-04-16T12:59:06.626+01:00| vthread-4| I125: Read 21363 symbol versions
2017-04-16T12:59:06.626+01:00| vthread-4| I125: Invoking modinfo on "vmmon".
2017-04-16T12:59:06.628+01:00| vthread-4| I125: "/sbin/modinfo" exited with status 256.
2017-04-16T12:59:06.628+01:00| vthread-4| I125: Invoking modinfo on "vmnet".
2017-04-16T12:59:06.630+01:00| vthread-4| I125: "/sbin/modinfo" exited with status 256.
2017-04-16T12:59:07.100+01:00| vthread-4| I125: Setting destination path for vmmon to "/lib/modules/4.10.0-19-generic/misc/vmmon.ko".
2017-04-16T12:59:07.101+01:00| vthread-4| I125: Extracting the vmmon source from "/usr/lib/vmware/modules/source/vmmon.tar".
2017-04-16T12:59:07.106+01:00| vthread-4| I125: Successfully extracted the vmmon source.
2017-04-16T12:59:07.106+01:00| vthread-4| I125: Building module with command "/usr/bin/make -j4 -C /tmp/modconfig-JzkDhJ/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-16T12:59:08.721+01:00| vthread-4| W115: Failed to build vmmon.  Failed to execute the build command.
2017-04-16T12:59:08.723+01:00| vthread-4| I125: Setting destination path for vmnet to "/lib/modules/4.10.0-19-generic/misc/vmnet.ko".
2017-04-16T12:59:08.723+01:00| vthread-4| I125: Extracting the vmnet source from "/usr/lib/vmware/modules/source/vmnet.tar".
2017-04-16T12:59:08.729+01:00| vthread-4| I125: Successfully extracted the vmnet source.
2017-04-16T12:59:08.729+01:00| vthread-4| I125: Building module with command "/usr/bin/make -j4 -C /tmp/modconfig-JzkDhJ/vmnet-only auto-build HEADER_DIR=/lib/modules/4.10.0-19-generic/build/include CC=/usr/bin/gcc IS_GCC_3=no"
2017-04-16T12:59:10.142+01:00| vthread-4| W115: Failed to build vmnet.  Failed to execute the build command.

I had exactly the same problem. The solution that worked for me is in this article:
How to install VMWare Workstation 12 on Linux 4.10 Kernel

  1. Install VMware as normal

    In our case we installed VMware with a bundle file. To get the bundle to run you have to run chmod u+x on it, then run:

    sudo ./VMware-Workstation-Full-12.5.bundle #(example filename)
    
  2. Install GCC and build-essentials

    sudo apt install gcc build-essential
    
  3. Patch VMware

    sudo tar -xf /usr/lib/vmware/modules/source/vmmon.tar
    sudo nano 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
    

    Save the file and exit, then:

    sudo tar -cf /usr/lib/vmware/modules/source/vmmon.tar vmmon-only/
    sudo tar -xf /usr/lib/vmware/modules/source/vmnet.tar
    sudo nano vmnet-only/userif.c
    

    Below line 114, 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
    

    Save the file, exit, and then re-tar that one too

     sudo tar -cf /usr/lib/vmware/modules/source/vmnet.tar vmnet-only/
    
  4. Run VMware again

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