Building required VMWare Workstation Kernel Modules Ubuntu ** updated for Secure Boot **

Ubuntu Authentic Logo - Ubuntu Linux - Pin | TeePublic
Ubuntu logo

VMWare Workstation on Ubuntu requires another step to run. Sometimes the installer will install the kernel modules it requires in the installer, other times it won’t. There’s another step to the setup after running the installer that might as well be documented as part of the installation process.

It’s compiling kernel extensions for vmmon and vmnet – and Workstation tries to compile them out of the box, but it never works. It’s missing some essential kernel extensions that are only available from GitHub. Get used to it, because every time you upgrade your kernel, you’ll have to do this again (unless you create a hook for apt … I’ll have to put that in a later post).

I had to write a post about it since after doing it for the umpteenth time I realized this might be a problem for a lot of people that isn’t well documented and might be exceedingly confusing for first-time users.

Make sure you have the headers and modules for your kernel – this oneliner will refresh your package cache and install them if you don’t have them:

$ sudo apt update && sudo apt install -y linux-headers-$(uname -r) linux-modules-$(uname -r)

First, you’ll have to download the kernel extensions. Here’s where they’re available:

https://github.com/mkubecek/vmware-host-modules/releases

You’ll see filenames available for download that look like w15.5.5-k5.7 – you want to match the first 3 numbers to your Workstation version, and the last two to your kernel – this example would be for Workstation 15.5.5 and an OS with 5.7 kernel.

Thankfully there’s plenty of releases to find one that’ll work for your setup. At the time of writing there is nearly 700 releases to choose from (indicating that this has probably been a major issue for a long, long time… )

After downloading the release, unzip or untar it and it’ll create a folder called:

vmware-host-modules-<release version>

cd into this folder and try making the .ko files:

$ cd vmmon-only && make && cd ..
$ cd vmnet-only && make && cd ..

Create two .tars:

$ tar -cf vmmon.tar vmmon-only
$ tar -cf vmnet.tar vmnet-only

Then copy them to the modules source directory for Workstation (as root):

$ sudo cp -v vmmon.tar vmnet.tar /usr/lib/vmware/modules/source/

After copying the .tar files to /usr/lib/vmware/modules/source/ run this command:

$ sudo vmware-modconfig --console --install-all

If all goes as planned, you should be able to run Workstation now.

If you notice vmware-modconfig complaining about errors / failing, you’re probably booted under secureboot. You can disable secureboot if you’d like to make this process easier for next time, but if not – here’s some additional steps you’ll have the pleasure of performing over and over.

Note: Keep in mind that if you upgrade your kernel you’ll absolutely have to go through this process all over again. Sometimes, but not always, updates to Workstation will require it, too.

You’re sure to get just as familiar with the process as I am before long.

For systems using secure boot, regarding the additional steps, they may only be necessary when changing release version of kernel, but not point version – so 5.8.0-19 to 5.8.0-21 might not need a mokutil update, but 5.6.2 to 5.8.0 definitely would.

Generate a key pair using the openssl to sign vmmon and vmnet modules:

$ openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=VMware/"

Sign the modules using the generated key:

$ sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vmmon)

$ sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vmnet)

Import the public key to the system’s MOK list:

$ sudo mokutil --import MOK.der

Choose a password you’ll remember for the MOK key enrollment, since the next step is rebooting and enrolling it in your UEFI firmware.

Reboot your machine. Follow the instructions to enroll the MOK key in your firmware from the UEFI console, and go back to your Ubuntu terminal and run:

$ sudo vmware-modconfig --console --install-all

That should take care of it for you.

Now just make sure you bookmark this page and the Github releases page so you can come back when you upgrade your kernel and do this all over again!

Good luck!

References:

https://github.com/mkubecek/vmware-host-modules/releases

https://askubuntu.com/questions/1135343/ubuntu-19-04-vmware-kernel-modules-updater

https://kb.vmware.com/s/article/2146460

Author: averyfreeman

Recovering zfs evangelist. Random tech tip disseminator. React/Next.JS site developer, but currently only in spare time. Previously resided: Oakland, SF, Tokyo. Now near Seattle, loving vote by mail.

2 thoughts on “Building required VMWare Workstation Kernel Modules Ubuntu ** updated for Secure Boot **”

  1. That openssl command has an unclosed quote:

    $ openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj “/CN=VMware/

    1. Thanks for pointing that out. I also noticed backticks along with $(cmd) structures, so I updated those for consistency.

      I think in newer versions of Workstation VMware’s has actually managed to make this kernel extension build process function properly when alerting the user from a dialog, so the entire post is hopefully unnecessary for most users going forward.

Leave a Reply to Jeffrey Dege Cancel reply

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