#!/bin/sh # Rebuild VMware host modules (vmmon/vmnet) for the running kernel if absent. # VMware Workstation does not register these with DKMS, so a kernel upgrade # leaves them unbuilt until the GUI or vmware-modconfig is run. This runs at # boot, before vmware-host.service, and self-heals using VMware's own builder. set -eu KVER="$(uname -r)" if /sbin/modinfo vmmon >/dev/null 2>&1 && /sbin/modinfo vmnet >/dev/null 2>&1; then # Module objects already present for the running kernel — nothing to do. exit 0 fi logger -t vmware-modules-rebuild "vmmon/vmnet missing for kernel ${KVER} — rebuilding via vmware-modconfig" if ! command -v vmware-modconfig >/dev/null 2>&1; then logger -t vmware-modules-rebuild "ERROR: vmware-modconfig not found" exit 1 fi # vmware-modconfig builds against the running kernel's headers. if /usr/bin/vmware-modconfig --console --install-all; then logger -t vmware-modules-rebuild "rebuild complete for kernel ${KVER}" else logger -t vmware-modules-rebuild "ERROR: vmware-modconfig failed (headers for ${KVER} installed?)" exit 1 fi