Comments

Kernel – 4.9-rc3 – NVIDIA Patch still works, and Fix for VMware 12.5.1? — 37 Comments

  1. Worked like a charm on RC4. For those folks who don’t know (it took me a while to figure this out):

    You will need gcc v6.2.0 – to install this on Ubuntu (or a derivative – in my case KDE neon):

    – sudo add-apt-repository ppa:ubuntu-toolchain-r/test
    – sudo apt-get update
    – sudo apt-get install gcc-6
    – When prompted for location of GCC, choose /usr/bin/gcc-6
    * note, if that ppa doesnt work, try ppa:ubuntu-toolchain-r/ppa – I can’t remember which one worked, but I think it was the “test” one mentioned above *

    Editing the VMware kernel module code:
    – Open a root shell: sudo su
    – Go to vmware modules sourcecode dir: cd /usr/lib/vmware/modules
    – Extract vmmod.tar and vmnet.tar
    – [INSERT ROBERT’S INSTRUCTIONS HERE]
    – Copy vmmod.tar and vmnet.tar somewhere to back them up (e.g. cp vmmod.tar ~/vmmod-old.tar)
    – Tar the vmnet-only and vmmod-only directories that you just modified back up into vmnet.tar and vmmod.tar
    – Exit root shell
    – Then run the vmware command (or however you start VMWare workstation). This time the build / installation should succeed.

  2. Robert, Adam, I can confirm this works for linux 4.9.0-rc7 with VMware Workstation 12.5.2 x86-64.
    FYI ppa:ubuntu-toolchain-r/test worked for me for gcc-6.

    Fantastic, many thanks.

  3. Perfect, works as well on ubuntu 16.10 with kernel 4.9 stable , Thanks guys!!

    -I installed gcc-6 as Adam said

    -Then I used these COMMANDS:
    sudo -s
    cd /usr/lib/vmware/modules/source
    tar -xf vmnet.tar
    tar -xf vmmon.tar
    cd vmnet-only/
    gedit userif.c
    –(Follow Robert’s step1)
    cd ..
    cd vmmon-only/linux/
    gedit hostif.c
    –(Follow Robert’s step2)
    cd ..
    cd ..
    tar -cf vmnet.tar vmnet-only
    tar -cf vmmon.tar vmmon-only

    VMware Kernel compilation succeeded

    • A huge thanks to Robert for these patches, they saved my life today!

      And very big thanks to KJ Vill for the handy set of commands to implement. I could have worked it out myself … eventually … but very nice to have a ready-made guide when you’re in a hurry 🙂

      VMWare 12.5.2 now up and running on Kernel 4.9.3, Fedora 2. Thanks guys!!

    • Nevermind – had a typo on the tar command :/ I can confirm this works on 12.5.2 build-4638234 with 4.9.0-rc8-amd64. Thanks a lot!

  4. I can confirm the above mod worked like a charm on my system on Ubuntu 16.04 using 4.9.0-11-generic with VMware Workstation Player 12.5.1 build-4542065. Thank you.

  5. Worked seamlessly, many thanks.
    Combination:
    VMware Workstation 12 Pro 12.5.1 build-4542065
    Fedora 25 Kernel 4.9.3-200.fc25.x86_64

  6. works on my Fedora release 25 (Twenty Five)

    kernel-4.9.3-200.fc25.x86_64
    vmware-player 12.5.1.4542065

    thank you a lot

    i used commands from KJ Vill post

    • Hi there:

      1I have the same issue, i cant open vmware

      Could you indicate me please step by step how did you fix it??

      Thanks you

  7. EUREKA!!!!

    I FOLLOWED THIS STEPS CAREFULLY:: HERE IS THE FULL GUIDE

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

    –(Follow Robert’s step1)

    Warning – This is not an official patch, and I am not an expert in kernel code, but I applied this to vmmon and vmnet, and both compile OK, and load/run, on Kernel 4.9-rc3..

    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, 9, 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

    cd ..
    cd vmmon-only/linux/
    nano hostif.c

    –(Follow Robert’s step2)

    Warning – This is not an official patch, and I am not an expert in kernel code, but I applied this to vmmon and vmnet, and both compile OK, and load/run, on Kernel 4.9-rc3..

    – and 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, 9, 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

    cd ..
    cd ..
    tar -cf vmnet.tar vmnet-only
    tar -cf vmmon.tar vmmon-only

    VMWARE_USE_SHIPPED_LIBS=force vmware-modconfig –console –install-all

  8. The change in vmnet-only/userif.c should be changed from:

    #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
    retval = get_user_pages(addr, 1, 0, &page, NULL);
    #else

    To:

    #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
    retval = get_user_pages(addr, 1, FOLL_WRITE, &page, NULL);
    #else

    Since the old `write` argument with a value of 1 was equivalent of setting FOLL_WRITE on the new `gup_flags` argument.

  9. To the OP:
    Following up on the thread I posted: https://communities.vmware.com/message/2651510#2651510 brought me here.

    I made a small bash script to patch the vmnet failed and vmmon failed issue with vmware sources to run on kernel 4.9: (based on the information you provided)

    VMWare vmmon vmnet kernel 4.9 unofficial patch – Direct link vmwkp4.9.tar [ https://bugfixes.promisedev.com/download/patches/vmwkp4.9.tar ] MD5 sum of vmwkp4.9.tar: 9e6040716b3001912147e23a10c4c596

  10. Works with VMware-Player-12.5.1-4542065.x86_64 under Ubuntu 16.10.
    Thank you so much 🙂

    (I tried also Ubuntu 16.04 LTS: Needs an upgrade of gcc from 5.x.x to 6.2.0 to get VMWare-installer running -> preferred to upgrade Linux version.)

  11. Tried doing this. But for some reason, VM is still not loading and giving me the same error, Can somebody please help here? TIA

    Logs:
    2017-03-07T10:38:17.247+05:30| vthread-4| W115: Failed to build vmmon. Failed to execute the build command.
    2017-03-07T10:38:17.249+05:30| vthread-4| I125: Setting destination path for vmnet to “/lib/modules/4.9.0-kali2-amd64/misc/vmnet.ko”.
    2017-03-07T10:38:17.249+05:30| vthread-4| I125: Extracting the vmnet source from “/usr/lib/vmware/modules/source/vmnet.tar”.
    2017-03-07T10:38:17.257+05:30| vthread-4| I125: Successfully extracted the vmnet source.
    2017-03-07T10:38:17.257+05:30| vthread-4| I125: Building module with command “/usr/bin/make -j4 -C /tmp/modconfig-kUUS6s/vmnet-only auto-build HEADER_DIR=/lib/modules/4.9.0-kali2-amd64/build/include CC=/usr/bin/gcc IS_GCC_3=no”
    2017-03-07T10:38:17.261+05:30| vthread-4| W115: Failed to build vmnet. Failed to execute the build command.

    root@kali:/# uname -r
    4.9.0-kali2-amd64
    root@kali:/# uname -a
    Linux kali 4.9.0-kali2-amd64 #1 SMP Debian 4.9.13-1kali1 (2017-03-01) x86_64 GNU/Linux

    • Userif.c section:

      static INLINE struct page *
      UserifLockPage(VA addr) // IN
      {
      struct page *page = NULL;
      int retval;

      down_read(&current->mm->mmap_sem);
      #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 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
      up_read(&current->mm->mmap_sem);

      if (retval != 1) {
      return NULL;
      }

      hostif.c file:
      #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 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

  12. Same as Rac here. Updated today and began getting errors “Could not open /dev/vmmon: No such file or directory. Please make sure that the kernel module ‘vmmon’ is loaded. Failed to initialize monitor service.”

    Already checked that UEFI secure boot is disabled per VMWare documentation.

    Tom

  13. Hey Guys, circling back to check if someone can help me on this. Thanks.
    Userif.c section:

    static INLINE struct page *
    UserifLockPage(VA addr) // IN
    {
    struct page *page = NULL;
    int retval;

    down_read(&current->mm->mmap_sem);
    #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 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
    up_read(&current->mm->mmap_sem);

    if (retval != 1) {
    return NULL;
    }

    hostif.c file:
    #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 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

    root@kali:/# uname -r
    4.9.0-kali2-amd64
    root@kali:/# uname -a
    Linux kali 4.9.0-kali2-amd64 #1 SMP Debian 4.9.13-1kali1 (2017-03-01) x86_64 GNU/Linux

  14. Hey Rac, this was fixed in the latest Kali upgrade. Run the upgrade and it should work again.

    Linux linux 4.9.0-kali3-amd64 #1 SMP Debian 4.9.13-1kali2 (2017-03-07) x86_64 GNU/Linux

  15. Hey Rac, this was fixed in the latest Kali upgrade. Run the upgrade and it should work again.

    Linux linux 4.9.0-kali3-amd64 #1 SMP Debian 4.9.13-1kali2 (2017-03-07) x86_64 GNU/Linux

  16. Hey Tom,

    Upgraded and it still doesnt work.

    Log File
    2017-03-25T05:47:47.853+05:30| vthread-4| W115: Failed to build vmnet. Failed to execute the build command

    Updated and upgraded to:
    Linux kali 4.9.0-kali3-amd64 #1 SMP Debian 4.9.13-1kali3 (2017-03-13) x86_64 GNU/Linux

    Error:
    “before you can run vmware several modules must be compiled and loaded into the kernel”

    And yea rebooted too.

    Can some

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.