You are here

Auto-configure vmware-tools at boottime on CentOS 6

So, a few years ago I wrote a simple script to configure the vmware-tools at boot after a kernel upgrade. This worked well for us ever since. However, on CentOS 6 machines I noticed there's no vmware-tools service anymore after the latest vmware-tools upgrade (version 8.6.11 on our machines).

It seems VMware moved the starting/stopping of VMware-tools from an old style sysv-rc script to an upstart script in /etc/init (/etc/init/vmware-tools.conf to be exactly). In this script a subscript /etc/vmware-tools/ is executed to start the vmware-tools.

So, there's an updated version that should work well on both CentOS 6 and older versions:

# 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
      [ -f /etc/vmware-tools/ ] && /etc/vmware-tools/ start
     echo "OK"
    echo "Usage: $0 start"
    exit 1

The only big difference is that it checks for the existence of /etc/vmware-tools/ and runs it if it's there.