How To automate the install of vmware-tools after any kernel update
Virtualization - VMware
Written by Allen Sanabria   
Monday, 06 July 2009 10:06

The other day I was installing kernel updates on a few of my Red Hat servers and I ran into a minor nuisance.  After each reboot, I no longer had network connectivity on the hosts, that has the updated kernel. I then realized, that vmware-tools was not running on all of those hosts. So after a few manual instance of me running "vmware-tools-config.pl -d" and "/etc/init.d/network restart"....I decided to automate that, by adding the below into "/etc/rc.local"

rkernel=`uname -r`
if [ -e /etc/vmware-tools/not_configured ]; then
echo "vmware-tools not configured for running kernel $rkernel"
echo "running vmware-config-tools.pl"
/usr/bin/vmware-config-tools.pl -d
echo "vmware-tools now compiled for running kernel $rkernel"
echo "restarting networking"
/etc/init.d/network restart
echo "network restarted"
exit 0
fi
 

 After each host rebooted, I now had network connectivity and vmware-tools was running. I hope the above will save you some time.



Add this page to your favorite Social Bookmarking websites
Reddit! Del.icio.us! Mixx! Free and Open Source Software News Google! Live! Facebook! StumbleUpon! Yahoo! Free Joomla PHP extensions, software, information and tutorials.
Comments
Search RSS
chakkerz  - Very nice ... but wait: there's more   |Registered |2009-08-24 12:54:38
That's awesome but in my situation where I have the VMs managed by another
group, and when they migrate (vmotion) hosts around, the vmware
tools fail to restart because unbeknownst to anyone as part of this
VMware tools was updated.

Anyway, in that scenario your rc.local script
would not work because there is no reboot.

I guess it is an outlier
and may not apply to anyone else. My sol'n:

your script, wrapped in a
status check:

#!/bin/bash

/etc/init.d/vmware-tools status >
/dev/null || running="false"

Code:

if [ "$running" == "false" ]
then
##Your script

else
 /etc/init.d/vmware-tools start
exit 0
 fi
fi
exit 1


running via /etc/cron.d/ every (say) 5 minutes, since what it does isn't
intensive. Plus if there is something wrong hopefully the flood of
messages will cause someone to spring into action 

chee...
dynasty   |SAdministrator |2009-08-24 14:12:14
Thanks for the compliments. It's cool to see someone use my little rc.local
script. I do see your dillema though.. Though I have yet to run into it.
dmalcor   |Registered |2009-09-17 11:33:16
I like the thinking here, I just worry about changes to rc.local getting removed
next up2date/yum patch cycle (so the cron script idea has some merit). Also I'm
worried that the vmware-tools do more than just networking.

Our standard
procedure is to:

1) patch the kernel
2) reboot
3) run
vmware-config-tools.pl -d,
4) reboot (again)

That way we are not missing all
the other things vmware-tools does for the guest. Too paranoid?

:-Dan
Only registered users can write comments!

3.22 Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated on Tuesday, 07 July 2009 07:54