How To Fix The Vmware Error could not open /dev/vmmon: no such file or directory. please make sure that the kernel module `vmmon’ is loaded.

Recently when I install VMware Fusion on macOS, I meet the error “Could not open /dev/vmmon: No such file or directory” during the installation process. When I investigate this error, I found this error happened not only on macOS, but also when you start VMWare on Linux, this article will tell you how to fix it.

1. The Steps To Reproduce & How To Fix The Error On macOS.

1.1 Download And Install VMware Fusion For Mac.

  1. Click here to download the VMware Fusion MacOS version.
  2. Double click the dmg file to install it correctly.

1.2 Create Windows 7 Virtual Machine.

  1. Click Finder in the desktop dock.
  2. Click Go —> Applications in Finder app top menu bar. Double click the VMware Fusion app in the right panel to start it.
  3. Click File —> New in VMware Fusion top menu bar to open the Select the Installation Method dialog. Select the Create a custom virtual machine item in the right panel.
  4. Click the Continue button and select Windows 7 x64 in the virtual machine list. Click the Continue button again. And select Create a new virtual disk option then click Finish.
  5. If you meet error messages such as “Could not open /dev/vmmon: No such file or directory.”, You can follow the below steps to fix it.
    Could not open /dev/vmmon: No such file or directory.
    
    Please make sure that the kernel module ‘vmmon‘ is loaded.
    
                                                OK

1.3 Fix Could Not Open /dev/vmmon Error During Virtual Machine Creation.

  1. Click Apple start menu —> System Preferences… menu item.
  2. Click Security & Privacy in the System Preferences popup dialog.
  3. Click the Allow button after the text System software from developer “VMware, Inc.” was blocked from loading to enable VMware to create the virtual machine.
    allow-create-virtual-machine-in-vmware
  4. If you can not see the Allow button, you can read the article How To Install Programs From Unidentified Developers In Mac OS.
  5. Also, make sure to select the radio button App Store and identified developers in the section Allow apps downloaded from. If you can not change it, click the bottom left lock icon to make the radio button clickable.
  6. Now click VMware Fusion app to go back to VMware Fusion screen, click File —> Open in the top menu bar, and select the created Windows 7 x 64 virtual machine file.
  7. Click Virtual Machines —> CD / DVD (SATA) —> Choose Disc or Disc Image… menu item. Select the Windows 7 iso file and click the triangle button to start the image in the virtual machine window to start windows 7 installation. The installation process is the same as installing Windows 7 on a physical machine.

2. The Steps To Reproduce & How To Fix This Error On Linux.

2.1 Download & Install VMWare WorkStation For Linux.

  1. Go to VMWare’s official website home page, and download the VMWare workstation trial version which you can use for evaluation.
  2. The VMWare Linux installer is a file like VMware-Workstation-Full-16.2.1-18811642.x86_64.bundle.
  3. To run the installer file, you need to add the execute permission to the above file like below.
  4. Open a terminal and run the command $ chmod +x VMware-Workstation-Full-16.2.1-18811642.x86_64.bundle to add the execute permission to it.
  5. After that, you can run the command $ sudo ./VMware-Workstation-Full-16.2.1-18811642.x86_64.bundle to extract the downloaded file.
    $ sudo ./VMware-Workstation-Full-16.2.1-18811642.x86_64.bundle 
    Extracting VMware Installer...done.
    Installing VMware Workstation 16.2.1
        Configuring...
    [######################################################################] 100%
    Installation was successful.
  6. Now you can click the VMware workstation icon to start it, if this is the first time you run the VMWare workstation, it will prompt you to install GCC.

2.2 The Steps To Raise This Error.

  1. When I create a virtual machine in the VMware workstation, the below error will appear.
  2. Could not open /dev/vmmon: No such file or directory. Please make sure that the kernel module `vmmon' is loaded
  3. It also said the virtual machine initialization failed. So I try to run the below commands to fix it.
  4. So I try to run the below command to fix it.
    $sudo vmware-modconfig --console --install-all
    [AppLoader] Use shipped Linux kernel AIO access library.
    An up-to-date "libaio" or "libaio1" package from your system is preferred.
    [AppLoader] GLib does not have GSettings support.
    
    
    $ sudo openssl req -new -x509 -newkey rsa:2048 -keyout VMWARE.priv -outform DER -out VMWARE.der -nodes -days 36500 -subj "/CN=VMWARE/"
    Generating a RSA private key
    .........+++++
    ..........+++++
    writing new private key to 'VMWARE.priv'
    -----
    
    
    $ sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./VMWARE.priv ./VMWARE.der $(modinfo -n vboxdrv)
    modinfo: ERROR: Module vboxdrv not found.
    Usage: scripts/sign-file [-dp] <hash algo> <key> <x509> <module> [<dest>]
           scripts/sign-file -s <raw sig> <hash algo> <x509> <module> [<dest>]
    
    
    $ tail $(modinfo -n vboxdrv) | grep "Module signature appended"
    modinfo: ERROR: Module vboxdrv not found.
    
  5. Now I run the command sudo mokutil –import VMWARE.der in a new terminal tab and get the below output.
    $ sudo mokutil --import VMWARE.der
    sudo: mokutil: command not found
    
    $ sudo apt install mokutil
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following NEW packages will be installed:
      mokutil
    0 upgraded, 1 newly installed, 0 to remove and 191 not upgraded.
    Need to get 22.6 kB of archives.
    After this operation, 71.7 kB of additional disk space will be used.
    Get:1 http://cn.archive.ubuntu.com/ubuntu focal/main amd64 mokutil amd64 0.3.0+1538710437.fb6250f-1 [22.6 kB]
    Fetched 22.6 kB in 1s (28.4 kB/s)  
    Selecting previously unselected package mokutil.
    (Reading database ... 150971 files and directories currently installed.)
    Preparing to unpack .../mokutil_0.3.0+1538710437.fb6250f-1_amd64.deb ...
    Unpacking mokutil (0.3.0+1538710437.fb6250f-1) ...
    Setting up mokutil (0.3.0+1538710437.fb6250f-1) ...
    Processing triggers for man-db (2.9.1-1) ...
  6. When I run the command $ sudo mokutil –import VMWARE.der again, I got the below error.
    $ sudo mokutil --import VMWARE.der
    [sudo] password for jerry: 
    EFI variables are not supported on this system

2.3 How To Fix The Error.

  1. In most cases, when you secure boot a virtual machine, it will need a trusted certificate to load the kernel modules.
  2. So you should first create a trusted key and then use the trusted key to sign the modules vmmon, vmnet that you just compiled.
  3. You can follow the below steps to fix it.
  4. Open a terminal and run the command sudo vmware-modconfig –console –install-all after you install the VMWare.
    $ sudo vmware-modconfig --console --install-all
    [sudo] password for jerry: 
    [AppLoader] Use shipped Linux kernel AIO access library.
    An up-to-date "libaio" or "libaio1" package from your system is preferred.
    [AppLoader] GLib does not have GSettings support.
    
  5. Run the OpenSSL command to generate a trusted key.
    $ openssl req -new -x509 -newkey rsa:2048 -keyout VMWARE15.priv -outform DER -out VMWARE15.der -nodes -days 36500 -subj "/CN=VMWARE/"
    Generating a RSA private key
    .........+++++
    .......................+++++
    writing new private key to 'VMWARE15.priv'
    -----
  6. Sign the 2 kernel modules vmmon, vmnet with the generated key above.
    $ sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./VMWARE15.priv ./VMWARE15.der $(modinfo -n vmmon)
    $ sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./VMWARE15.priv ./VMWARE15.der $(modinfo -n vmnet)
    $ 
    
  7. Run the tail command to verify that you have applied the signatures successfully.
    $ tail $(modinfo -n vmmon) | grep "Module signature appended"
    Binary file (standard input) matches
  8. The next step is to import the key to the management system of the machine owner key (MOK). During the process, it will let you input a password.
    $ sudo mokutil --import VMWARE15.der
  9. You should run the above command in a physical machine, if you run the command in a virtual machine, you will get the error EFI variables are not supported on this system. This is because the virtual machines disable the secure boot.
  10. Restart the virtual machine. In the process of the restart, it will prompt a menu, you need to input the key and the password that you created.
  11. After reboot, you can run the command mokutil –test-key VMWARE15.der to test whether the driver or module has been installed successfully.
    $ mokutil --test-key VMWARE15.der
    VMWARE15.der is already enrolled

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Clicky