Rebuilding vmmon and vmnet for VMwareAugust 24, 2022
Quick reference notes I compiled for rebuilding and re-inserting vmmon and vment into the kernel; which has to be done everytime you upgrade your kernel.
This is required when you get a message such as the below:
Could not open /dev/vmmon: No such file or directory. Please make sure that the kernel module `vmmon' is loaded
A major frustration when you usually least expect it! But not to worry, it only takes 5 minutes to fix.
Recompile vmmon and vmnet
vmware-modconfig --console --install-all
Generate a key pair (using openssl) so we can sign the 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/"
This will give you two files,
MOK.der in the directory you run it from. Doesn’t matter where you run it.
Sign vmmon using the key pair from above
sudo /usr/src/linux-headers-`uname -r`/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vmmon)
Sign vmnet using the key pair from above
sudo /usr/src/linux-headers-`uname -r`/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vmnet)
Your shell may say that it can’t find
modinfo if it doesn’t pass along sudo privelage to the sub-commands properly. In this case you can run
uname -r and
modinfo -n vmnet,
modinfo -n vmmon manually and then paste the response back into the string above.
If you were to reboot at this stage before doing the below, you will have to do all the above again.
Import the public key to the system’s MOK list
sudo mokutil --import MOK.der
- It will ask to enter a password, it can be anything, you only need to remember it for ~2 minutes as you will be asked for it following reboot and never need it again thereafter.
- Reboot and follow the instructions. They are pretty straight forward. System will do another reboot after following the instructions.
- You can now start vmplayer and should not get the messages about being unable to find vmmon and vmnet.
Building vmmon and vmnet with latest kernels
If you run
vmware-modconfig --console --install-all on a system running a newer kernel (i.e. 5.18) you will get build errors.
Is what you want to do in this case is hop to https://github.com/mkubecek/vmware-host-modules and select a branch with the version of vmplayer or vmworkstation that you are using.
For instance, right now I am running vmplayer v16.2.4 so I perform the below steps.
git clone https://github.com/mkubecek/vmware-host-modules.git
git checkout player-16.2.4
make VM_UNAME=$(uname -r)
Then insert the modules into the kernel
sudo modprobe -a vmmon.o vmnet.o
You will also have to update your initramfs…
To update across all installed kernel versions:
sudo update-initramfs -u -k all
Or for just the version you’re running (in my case, 5.18):
sudo update-initramfs -k 5.18.0