Sunday 29 January 2017

VMware workstation installation issues on Linux Kernel >= 4.6

VMware Workstation 12.x does not compile correctly on Linux Kernel >= 4.6. Read the update section for Kernel 4.9 fix

Once the installation completes and tries to start the services, it throws several errors including missing kernel headers.




Workaround includes getting the kernel path headers correct and creating the correct symlinks for the location

cd /lib/modules/$(uname -r)/build/include/linux
sudo ln -s ../generated/utsrelease.h
sudo ln -s ../generated/autoconf.h
sudo ln -s ../generated/uapi/linux/version.h
Once the symlinks are ready, the path is
/usr/src/linux-headers-$(uname -r)/include

If the VMware still encounters issues with its services not starting , you will need to make changes in VMware modules C code and recompile.





Locate the source for vmmon.tar and vmnet.tar usually found under
/usr/lib/vmware/modules/source

Untar vmmon.tar and under  ./vmmon-only/linux/hostif.c replace all get_user_pages to get_user_pages_remote. Now tar and replace original file

Similarly, untar vmnet.tar and under ./vmnet-only/userif.c replace all get_user_pages to get_user_pages_remote. Now tar and replace original . This has been successfully compiled and tested on Linux kernels 4.6 and 4.7

If for some reason, the module updater asks for GCC (though earlier versions exist) , follow the steps here for new compiler setup.



If you want to install VMware fresh, try uninstalling via cli using
sudo vmware-installer --uninstall-product vmware-workstation


Update for Kernel 4.9 :

If you are now on kernel 4.9 , do the following

STEP 1:

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

Change at Line 113

    #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

 STEP 2:

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

Change at line 1165

    #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

Credits goto RGLinuxTech for this patch.


No comments:

Post a Comment

author
Vijay Vikram Shreenivos