This post is originally posted on my colleague Michel aka ‘HighKing’ blog:

When you install a new kernel on a RHEL/CentOS VM, you need to reconfigure the vmware-tools using the ‘’ script. I have created a simple script that does this automatically, so you don’t have to be there when the kernel is updated (handy for automatically updating machines).

Place this in a script called ‘check-vmware-tools’ in /etc/init.d:

# check-vmware-tools
# chkconfig:   - 00 99
# description: Check whether or not the vmware-tools are installed at boot time.
# processname: check-vmware-tools

loadvmxnet() {
  if [ "`uname -i`" != "x86_64" ]; then 
        echo -n "Reloading vmxnet driver... "
        /sbin/rmmod pcnet32
        /sbin/rmmod vmxnet
        /sbin/depmod -a
        /sbin/modprobe vmxnet
        echo "done"

case $1 in
    echo -n $"Checking VMware-tools: "
   if [ ! -e /lib/modules/`/bin/uname -r`/misc/vmci.ko ]; then
      echo "Not available, running vmware-config-tools..."
      /usr/bin/ --default && loadvmxnet
     echo "OK"
    echo "Usage: $0 start"
    exit 1

Make it writeable with:

chmod +x /etc/init.d/check-vmware-tools

Next is to make it known by chkconfig with:

chkconfig --add check-vmware-tools

Now we have done that, we can simply enable it with:

chkconfig check-vmware-tools on

On the next boot, this script checks whether or not the vmware-tools are configured for the running kernel (by checking if vmmemctl.ko is in place). If not, it runs ‘ and reboots after that.

You can download the file here: check-vmware-tools



4 thoughts on “Bash Script: Auto Configure vmware-tools at Boot time

  1. Very useful stuff, will save me quite some time 😉
    Only one question, why didn’t you use the Invoke-VMScript cmdlet to push this automatically to all your RH guests ?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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