Could not open /dev/vmmon: No such file or directory. Please make sure that the kernel module `vmmon’ is loaded.
I recently needed to run a VM in VMware and bumped into this issue. After some digging, I managed to get over this with these simple steps outlined in this article.
Update 2nd September 2024
I didn’t run VMware for a long time and now I need it to run a Windows machine. As it’s still installed on my machine, I wanted to give it a go. I expected again to have that error, hence I went back to this article and run the fixing commands. And surprise, the module compilation step was not working:
error: implicit declaration of function ‘random_get_entropy_fallback’; did you mean ‘random_get_entropy’?
As it turns out, there is a newer version of the kernel patches module from this Github page. Using the version 17.5.1 seems to do the trick and we are back in business. I will update the article with this new version accordingly 😉
So run these commands after a kernel or VMware update:
$ sudo vmware-modconfig --console --install-all
$ sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./VMMON.priv ./VMMON.der $(modinfo -n vmmon)
$ sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./VMMON.priv ./VMMON.der $(modinfo -n vmnet)
Reboot the machine and try to run VMware again. You should have no more issues!
Update 29th May 2024
It now seems VMware has been acquired by Broadcom and unfortunately the process of getting a new version of VMware has been over-complicated in a crappy loopy way. There seems to be no easy way of downloading newer versions of the product, the Broadcom website is buggy and requires you to register a lot of details.
It fails to provide you with a download link, the support page says that to download you need to go to another page which surprise, takes you to the very same page. How delightful to open 10+ tabs and not being able to install the product.
So having said that, I would either recommend another product or try to stick with whatever version you have.
Update 1st December 2023
The version of WMware Workstation I used originally in this article is 17.0.2. Now I was configuring VMware Player 17.5.0 on a new machine and I had some issues with the host modules. It seems the right version is necessary depending on what VMware you have. I have updated the commands below accordingly.
The background of the error
Basically, when you install VMware it might silently fail to install 2 required modules:
- vmmon
- vmnet
These 2 kernel modules are responsible for host to virtual machine integration to work properly, hence they are vital for VMware to work. In order to make them work, the fix requires building them from source and also signing them with a trusted certificate. This issue occurs on machines with UEFI enabled. UEFI has some protective mechanism that disallows kernel modules to be loaded unless they are from a safe trustworthy source.
I promised 3 easy steps, so let’s prove it! 😉
Step 1: Download VMware modules kernel patches from Github
It seems that Michal Kubeček has some kernel patches on his trusted Github page. We have to download the release for the right VMware version (17.0.2 in my case) and extract them into VMware modules source folder. Run these commands one by one:
$ wget https://github.com/mkubecek/vmware-host-modules/archive/refs/heads/workstation-17.5.1.zip
$ unzip workstation-17.5.1.zip
$ cd vmware-host-modules-workstation-17.5.1
$ tar -cf vmmon.tar vmmon-only && tar -cf vmnet.tar vmnet-only
$ sudo cp -v vmmon.tar vmnet.tar /usr/lib/vmware/modules/source/
Now that these sources are copied in the right location, use the following command to build them:
$ sudo vmware-modconfig --console --install-all
You might see that starting the vmmon and vmnet services will fail, but it’s ok, that’s why we need the following 2 steps.
Step 2: Generate a self signed certificate, sign the modules and register the certificate with the system
Okay, let’s generate a certificate with a private key. We’re going to use the OpenSSL module which should be available on any Linux system:
$ openssl req -new -x509 -newkey rsa:2048 -keyout VMMON.priv -outform DER -out VMMON.der -nodes -days 36500 -subj "/CN=AFITech/"
It is not necessary to add a passphrase to the private key, if you do, make sure you remember it! Next step is to sign both kernel modules with the certificate:
$ sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./VMMON.priv ./VMMON.der $(modinfo -n vmmon)
$ sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./VMMON.priv ./VMMON.der $(modinfo -n vmnet)
IMPORTANT: Please be aware that the above 2 commands will need to be run each time you update the Linux kernel version or the WMware itself. You can skip the SSL certificate generation and also the mokutil command below since the certificate is already enrolled.
The final command of this step which is necessary is to import the certificate into the MOK (Machine Owner Key). This is an important command, make sure you do it precisely:
$ sudo mokutil --import VMMON.der
IMPORTANT: A password prompt will ask you to supply one password and repeat it. It’s necessary to remember this password, you will need it at the next startup.
Step 3: Restart your machine and check for the magic
The last command we ran requires you to reboot your machine. The idea is that you’ll then enroll the certificate you just imported with the TPM hardware module and it requires you to enter the password you previously remembered. The screen which appears on reboot should look like this:
Unfortunately I forgot to take a picture of the first screen, this is the screen after entering the password and importing successfully but you get the idea 😀
Now after you login into your machine, do a check in the terminal for the proper initialization of both modules:
$ modinfo vmnet && modinfo vmmon
The result should look similar to this screenshot:
This proves that the modules were loaded correctly and the signer is the certificate common name that we generated in Step 2.
Now check that the VM starts correctly, you should have no more issues.
Side note: some older SSL package might be required
When I started figuring out all of these things, I tried different solutions and commands. I remember at some point the vmnet module was complaining about some SSL issue. I don’t remember when or how but I also ran these commands, which might not be necessary in your case:
$ wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.19_amd64.deb
$ sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.19_amd64.deb
Conclusion
Well, the conclusion is pretty simple: we notice that the fantastic Linux world requires sometimes some mind boggling extra work to be done. As it is usually with life, you don’t achieve much without some elbow grease. I do hope that this guide helps you overcome this challenge if you encounter it. Don’t hesitate to contact me or drop a comment if you need some help. Any feedback is much appreciated, thanks!
Thanks for reading, I hope you found this article useful and interesting. If you have any suggestions don’t hesitate to contact me. If you found my content useful please consider a small donation. Any support is greatly appreciated! Cheers 😉