Automate kernel module installations for VMware Workstation on your Linux distro

VMWare Archives - The CloudStack Company
VMware Robot does a little dance

In reference to this post I made earlier: https://develmonk.com/2020/10/20/solve-the-system-cannot-find-the-file-specified-error-in-vmware-workstation/

I found the most helpful script, just drop this in a text file called /etc/kernel/install.d/vmmodules.install

#!/usr/bin/bash

export LANG=C

COMMAND="$1"
KERNEL_VERSION="$2"
BOOT_DIR_ABS="$3"
KERNEL_IMAGE="$4"

ret=0

case "$COMMAND" in
    add)
       VMWARE_VERSION=$(cat /etc/vmware/config | grep player.product.version | sed '/.*\"\(.*\)\".*/ s//\1/g')

       [ -z VMWARE_VERSION ] && exit 0

       mkdir -p /tmp/git; cd /tmp/git
       git clone -b workstation-${VMWARE_VERSION} https://github.com/mkubecek/vmware-host-modules.git
       cd vmware-host-modules
       make VM_UNAME=${KERNEL_VERSION}
       make install VM_UNAME=${KERNEL_VERSION}

       ((ret+=$?))
       ;;
    remove)
        exit 0
        ;;
    *)
        usage
        ret=1;;
esac

exit $ret

It’s so exciting! That should download, compile, and install the proper vmmon and vmnet kernel extensions required for Workstation every time a new kernel is installed (!!).

Now I just have to work out a way to get the MOKutil key submission in there for secure boot, but it’s definite a good start to making the installation of new kernels less painful for Workstation users on Linux.

Tested in: Ubuntu 20.10

Reference:
https://docs.fedoraproject.org/en-US/quick-docs/how-to-use-vmware/

Solve “The system cannot find the file specified” error in VMware Workstation

If you’ve ever run into this, it’s a real bummer. I encountered it after using rsync to clone a vm.

At the outset, I want to say either using vm -> manage -> clone or file -> export to OVF are both easier options, but if you’ve already copied a vm by hand, you can try this out:

After I rsynced my VM, I wanted to rename the files to differentiate it from the old VM.

For the example, let’s say my old VM’s name was Windows Ent EFI and I wanted to rename it to winInsiders

I use this one-liner just to rename the .vmdk files:

for f in *.vmdk; do mv "$f" "$(echo "$f" | sed s/"Windows Ent EFI"/winInsiders/)"; done

and renamed the remaining files {$f.nvram, $f.vmds, $f.vmx, $f.vmxf} by hand (wanted to be careful)

At first, I had forgotten about references in the winInsiders.vmx to old filenames, so when I tried to re-add the hard drive, I ran into the “cannot find the file specified” error

I deleted any .lck directories first (not sure if this is necessary, but it seemed like a good idea)

Then I looked inside the .vmx file with a text editor, and found a few keys that needed new values, because they referenced the old names.

They were:

nvram
extendedConfigFile
scsi0:0.fileName

There could always be more, that’s why instead of editing it by hand, run sed on the .vmx file, as it is faster and far less error-prone (just like the renaming command above, but with the -i flag, meaning inside the file):

sed -i s/"Windows Ent EFI"/winInsiders/g winInsiders.vmx

Then do the same for the .vmxf and first .vmdk file (the first .vmdk in a split virtual disk is just a file descriptor, plain text):

sed -i s/"Windows Ent EFI"/winInsiders/g winInsiders.vmxf
sed -i s/"Windows Ent EFI"/winInsiders/g winInsiders.vmdk

It should work now (at least, it did for me).