Skip to content

Instantly share code, notes, and snippets.

@JavaScriptDude
Last active November 6, 2023 05:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JavaScriptDude/a1b94089dddeda19b41047d0ab337b7b to your computer and use it in GitHub Desktop.
Save JavaScriptDude/a1b94089dddeda19b41047d0ab337b7b to your computer and use it in GitHub Desktop.
VMWare Workstation 16 Launcher

VMWare Workstation for Linux v16 has issues related to memory fragmentation. This will cause the CPU to choke with 100% after a time. The scripts provided will allow you to fix this at launch of vmware on Linux.

Instructions:

  1. Put vmware-workstation.sh to a good location on your computer like ~/bin or similar
  2. Make vmware-workstation.sh executable
  3. Edit vmware-workstation.desktop to have correct paths based on your setup
  4. Open shell, cd to directory with .desktop file and run:
desktop-file-install --dir=$HOME/.local/share/applications ./vmware-workstation.desktop

The above will create a new desktop launcher that will open a terminal window initially, prompt for su , drop vm caches, compact vm memory and then launch vmware

After a few days of running VMs, the kcompacd0 issue may come back and if it does, hybernate or shutdown vms and bounce vmware.

#!/usr/bin/env xdg-open
# Home Path: <svn>/sys/shortcuts
# Installation:
# % desktop-file-install --dir=$HOME/.local/share/applications ./vmware-workstation.desktop
[Desktop Entry]
Encoding=UTF-8
Name=VMware Workstation
Comment=Run and manage virtual machines (fixed)
Exec=sh -c "/dpool/vcmain/sys/shortcuts/vmware-workstation.sh"
Terminal=true
Type=Application
Icon=vmware-workstation
StartupNotify=true
Categories=System;
MimeType=application/x-vmware-vm;application/x-vmware-team;application/x-vmware-enc-vm;x-scheme-handler/vmrc;
#! /bin/sh
# See: https://communities.vmware.com/t5/VMware-Workstation-Pro/kcompacd0-using-100-CPU-with-VMware-Workstation-16/td-p/2896972
echo "Need sudo to drop caches and compact memory"
sudo sync
echo dropping caches ...
sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'
echo compacting memory ...
sudo sh -c 'echo 1 > /proc/sys/vm/compact_memory'
echo launching vmware
/usr/bin/vmware
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment