NVidia and VMWare Workstation on Linux Kernel 4.9

As mentioned before, Slackware jumped to Linux Kernel 4.9 and this will surely caused NVidia and VMWare Workstation to break. I was quite lucky since Linux Kernel 4.9 has been around for some time and other people have found a way to solve this problem. This post is intended to be a self note just in case i need to re-do the same steps.

NVidia 304.135
My desktop is still using the legacy NVidia driver 304.135. There's no new release for now, so we will need to patch 2 things: the kernel and the driver.
First, you need to patch the kernel using the mtrr.patch as listed in my SlackHacks. Once rebooted, you will be using the new patched kernel image. Time to go to patch the NVidia driver. Let's extract the source of the NVidia driver:
./NVIDIA-Linux-x86-304.135 --extract-only
cd  NVIDIA-Linux-x86-304.135
patch -p1 < /path/to/kernel-4.9.patch
./nvidia-installer

at this point, the installer will work with Linux Kernel 4.9. As a bonus, i accepted NVidia's new xorg.conf and i got a higher resolution (1280x1024) compared to previous config (1024x768). It seems that i haven't updated my xorg.conf for a LONG TIME ago.

VMware Workstation 10.0.0.6
I'm still running x86 machine, so i'm stuck with VMWare Workstation 10.x. If you are using x86_64, then you can try to jump to the latest 12.5 and you will have less trouble on patching the kernels.
Patching VMWare Workstation 10.x is getting trickier as new kernel gets released. For Linux Kernel 4.9, i have written a small README. Here's the complete steps by steps:
  • Navigate to /usr/lib/vmware/modules/source
  • extract vmmon.tar: tar xvf vmmon.tar
  • open vmmon-only/linux/hostif.c and change 
unsigned int anonPages = global_page_state(NR_ANON_PAGES);
to
unsigned int anonPages = global_page_state(NR_ANON_MAPPED);

and also change

retval = get_user_pages(current, current->mm, (unsigned long)uvAddr, numPages, 0, 0, ppages, NULL);

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
  • pack vmmon: tar cvf vmmon.tar vmmon-only
  • extract vmnet.tar: tar xvf vmnet.tar
  • open vmnet-only/netif.c and comment this line
dev->trans_start = jiffies;
  • Change this line
retval = get_user_pages(current, current->mm, addr, 1, 1, 0, &page, NULL);

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 
  • pack vmnet: tar cvf vmnet.tar vmnet-only
  • run vmware-modconfig --console --install-all 
Thanks to the community for sharing all the information i need to get my NVidia and VMware Workstation working again.

The only package that isn't working at the moment is VirtualBox. Even with the latest 5.1.22, it failed to build with this error message on dmesg: vboxdrv: Unknown symbol __udivmoddi4. It seems to be related with latest GCC 7.1.0.

Popular posts from this blog

Python 3.6.0 in SBo 14.2 repository

NVidia Legacy Unix Driver Update

Security Update: Thunderbird, Seamonkey, libpng, python, samba