Skip to content

Instantly share code, notes, and snippets.

@PotatoMaster101
Last active February 21, 2021 10:09
Show Gist options
  • Save PotatoMaster101/91c526ef392d5c0c9c03fba01d845258 to your computer and use it in GitHub Desktop.
Save PotatoMaster101/91c526ef392d5c0c9c03fba01d845258 to your computer and use it in GitHub Desktop.
Fixes VMWare after Linux kernel update
#!/bin/sh
####################################################################################################
# Fixes VMWare after Linux kernel update.
# https://askubuntu.com/questions/1096052/vmware-15-error-on-ubuntu-18-4-could-not-open-dev-vmmon-no-such-file-or-dire
#
# Usage: /bin/sh vmfix.sh
####################################################################################################
if [ "$(id -u)" -ne 0 ]; then
echo 'ERROR: Must be run as root' 1>&2
exit 1
fi
if ! type 'vmware-modconfig' 2>&1 > /dev/null; then
echo 'ERROR: Program not found: vmware-modconfig' 1>&2
exit 1
fi
vmware-modconfig --console --install-all
openssl req -new -x509 -newkey rsa:2048 -keyout VMWARE15.priv -outform DER -out VMWARE15.der -nodes -days 36500 -subj "/CN=VMWARE/"
/usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./VMWARE15.priv ./VMWARE15.der $(modinfo -n vmmon)
/usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./VMWARE15.priv ./VMWARE15.der $(modinfo -n vmnet)
mokutil --import VMWARE15.der
echo 'Restart computer to enroll the key'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment