Ubuntu
How To Fix VMware Workstation 15/16 For Linux: Modules Fail To Load After Ubuntu Kernel Update

How To Fix VMware Workstation 15/16 For Linux: Modules Fail To Load After Ubuntu Kernel Update

As a popular virtualization platform, VMware Workstation allows users to run multiple operating systems on a single computer, providing a convenient way to test and develop software. However, the integration of VMware Workstation with the host operating system can sometimes result in issues, particularly after updating the host’s kernel. If you’re facing this issue on your Linux system, where the VMware Workstation modules fail to load after an Ubuntu kernel update, don’t worry. In this blog post, we’ll guide you through the steps to resolve the problem and restore your VMware Workstation to a functional state. Whether you’re using VMware Workstation 15 or 16, this guide will provide you with a simple and straightforward solution that you can implement to fix the issue and get back to virtualizing your systems.

The first time this error is usually encountered is when you try powering on a virtual machine and you receive the following error messages:

Could not open /dev/vmmon error
Failed to initalize monitor device
Unable to change virtual machine power state

This problem essentially occurs because of secure boot which does not allow kernel modules to load without being digitally signed with a trusted certificate. So we need to create a trusted key and use it to sign the newly compiled modules vmmon and vmnet.

  1. Install VMware Workstation for Linux. These instructions have been tested on Workstation versions 15/16 with Ubuntu 18.04 (Bionic Beaver) and Ubuntu 20.04 (Focal Fossa).
  2. Open terminal and run this command:
    sudo vmware-modconfig --console --install-all
    You’ll see that issues with monitor and net are reported, that’s ok.
  3. Generate a new key with this command:
    openssl req -new -x509 -newkey rsa:2048 -keyout VMWARE16.priv -outform DER -out VMWARE.16.der -nodes -days 36500 -subj "/CN=VMWARE/"
  4. Use this newly generated key to sign the two kernel modules using these commands:
    sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./VMWARE16.priv ./VMWARE16.der $(modinfo -n vmmon)
    sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./VMWARE16.priv ./VMWARE16.der $(modinfo -n vmnet)
  5. There is no standard output (stdout) from the last two commands so no feedback will be seen in the terminal. To check that the signatures are applied correctly use this command:
    tail $(modinfo -n vmmon) | grep "Module signature appended"
    You should see Binary file (standard input) matches
  6. Now we make this key trusted by importing it to the machine owner key (MOK) management system with the following command. You can read more about MOK’s job in Linux here:
    sudo mokutil --import VMWARE16.der
    This command will ask you to create a password. The password must be between 8-16 characters but no prompt on password requirements is displayed. Reenter the same password.
  7. Reboot the machine. Following the POST you should be presented with a menu (blue screen background), you have to select to enroll the key and enter the password you created in step 6, then continue to boot.
Enroll MOK
  1. To test the modules have installed correctly enter the command:
    mokutil --test-key VMWARE16.der
    You should see VMWARE16.der is already enrolled which means VMware workstation should now be working.

Note: I have found that whenever the kernel is updated this fix will break and steps 2-7 will have to be reapplied every time. I have a script on my github here that can somewhat automate the process detailed in these steps.

Leave a Reply

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