A shell script that patches and rebuilds VMware Workstation Pro's kernel modules (vmmon and vmnet) for Linux kernel 7.0.x, where the official build fails due to multiple removed or renamed kernel APIs.
VMware Workstation ships its kernel modules (vmmon, vmnet) as source tarballs and compiles them against your running kernel at install time. This works reliably on kernels up to ~6.14. On kernel 7.0, the build fails immediately because several internal Linux APIs that VMware's source depends on were renamed or removed during the 6.x → 7.0 transition.
This patch was developed and tested on Ubuntu 26.04 LTS (Resolute) with kernel 7.0.0-15-generic, by manually tracing each compiler error to its root cause and applying the minimal correct fix.
Root cause: VMware's Makefile.kernel sets compiler include flags using the EXTRA_CFLAGS variable. Modern Linux kernels (5.0+) replaced EXTRA_CFLAGS with ccflags-y for out-of-tree module builds. The kernel build system silently ignores EXTRA_CFLAGS, so the -I paths pointing to VMware's own header directory never reach the compiler.
Fix: Replace EXTRA_CFLAGS with ccflags-y in Makefile.kernel for both vmmon and vmnet. Additionally, hardcode absolute paths into the INCLUDE variable because $(SRCROOT) resolves incorrectly when the kernel build system changes working directories internally.
Root cause: del_timer_sync() was renamed to timer_delete_sync() in kernel 6.15 (commit 97a32539b956) as part of a broader timer API cleanup to align naming with other subsystems.
Affected files: vmmon-only/linux/hostif.c, vmmon-only/linux/driver.c
Fix: s/del_timer_sync/timer_delete_sync/g
Root cause: rdmsrl_safe() was renamed to rdmsrq_safe() in kernel 7.0 as part of the x86 MSR (Model Specific Register) API cleanup. The l suffix (for "long") was replaced with q (for "quad") to be consistent with other low-level x86 accessors.
Affected files: vmmon-only/linux/hostif.c
Fix: s/rdmsrl_safe/rdmsrq_safe/g
Root cause: These page table inspection functions were renamed to their *_leaf equivalents in kernel 6.x. The renaming reflects more accurate semantics: a "large page" mapping is technically a "leaf" node in the page table tree, not merely a "large" entry.
Affected files: vmmon-only/include/pgtbl.h, vmmon-only/include/compat_pgtable.h
Fix:
pgd_large → pgd_leaf
p4d_large → p4d_leaf
pud_large → pud_leaf
pmd_large → pmd_leaf
compat_p4d_large → compat_p4d_leaf
Root cause: dev_base_lock was a global rwlock_t used to protect the kernel's network device list. It was removed in kernel 6.x in favour of the RTNL (Routing Netlink) lock, which provides equivalent serialisation for network device list operations.
Affected files: vmnet-only/vmnetInt.h
Fix:
read_lock(&dev_base_lock) → rtnl_lock()
read_unlock(&dev_base_lock) → rtnl_unlock()
Root cause: This is a bug in Ubuntu 26.04's linux-headers-7.0.0 package. The shipped arch/x86/include/asm/timex.h references random_get_entropy_fallback(), which was removed from the kernel. The function body is only reachable on x86 systems without a TSC (very rare hardware), so stubbing it to return 0 has no practical effect on normal systems.
Affected file: /usr/src/linux-headers-7.0.0-*/arch/x86/include/asm/timex.h
Fix: Replace the unreachable call with return 0.
- VMware Workstation Pro 17.6.4 already installed
- Linux kernel 7.0.x
- Kernel headers installed:
sudo apt install linux-headers-$(uname -r) - Build tools:
sudo apt install build-essential - Root access
# Clone the repo
git clone https://github.com/caleb173/vmware-kernel7-patch.git
cd vmware-kernel7-patch
# Make executable
chmod +x patch-vmware-kernel7.sh
# Run as root
sudo bash patch-vmware-kernel7.shThe script will:
- Back up the original VMware module tarballs to a timestamped directory under
/usr/lib/vmware/modules/source/ - Extract and patch
vmmonandvmnetsources - Patch the broken kernel header (
timex.h) if needed - Build both modules against your running kernel
- Install the compiled
.kofiles to/lib/modules/$(uname -r)/updates/ - Repack the patched sources back into VMware's tarball directory
- Run
depmod, load the modules, and start VMware services
Then launch VMware with:
vmware| Component | Version |
|---|---|
| Host OS | Ubuntu 26.04 LTS (Resolute) |
| Kernel | 7.0.0-15-generic |
| VMware Workstation Pro | 17.6.4 (build-24832109) |
| CPU | Intel Core i5-2450M (Sandy Bridge) |
| GCC | 15.2.0 |
- This patch targets kernel 7.0.x specifically. For kernels 6.15–6.19, the
dev_base_lockandccflags-yfixes still apply, butrdmsrl_safeand the*_large→*_leafrenames may not be needed depending on your exact kernel version. - The
timex.hfix is specific to Ubuntu 26.04's packaged headers and may not be needed on other distributions. - VMware Workstation 26H1 (the calendar-versioned successor to 17.6.4) may or may not need these patches — it was released too recently to have community-verified kernel 7.0 support at time of writing.
Run the script with bash -x for verbose output:
sudo bash -x patch-vmware-kernel7.sh 2>&1 | tee patch.logThen open an issue and attach patch.log.
The script backs up your original tarballs automatically. To revert:
BACKUP=$(ls /usr/lib/vmware/modules/source/ | grep backup | tail -1)
sudo cp /usr/lib/vmware/modules/source/$BACKUP/vmmon.tar /usr/lib/vmware/modules/source/vmmon.tar
sudo cp /usr/lib/vmware/modules/source/$BACKUP/vmnet.tar /usr/lib/vmware/modules/source/vmnet.tar
sudo vmware-modconfig --console --install-allMIT — do whatever you want with it. Attribution appreciated but not required.
Patch developed by tracing compiler errors manually on a live Ubuntu 26.04 + kernel 7.0.0 system. Referenced kernel changelogs, Linux git history, and the mkubecek/vmware-host-modules project for prior art on older kernel patches. Assisted by Claude (Anthropic) — AI pair programming throughout the debugging and patching session.