Short Description/Title: Install home grown check-vmware-tools rpm on 32-bit Linux VM -- INFO
Detailed Description/Procedure:
# (AS5) yum install check-vmware-tools
or
# (AS4) up2date -i check-vmware-tools
Priority: Low
Reason for Change/Why is this a
priority?: All 32-bit Linux VM utlilize the Flexible or the VMXNET type
virtual network cards, and these NIC are provided by the VMwareTools 3rd
party software package. Unfortunately, this VMwareTools is tigjtly
coupled with the Linux kernel, and each time the kernel is updated, the
VMwareTools must be manually "activated" again. There exists a period of
time after the kernel is updated but before the VMwareTools is manually
acitivited again during which the VM will not have any network access
(as the NIC cannot be created because VMwareTools is not activited).
This home grown check-vmware-tools rpm package addresses this
shortcoming by "auto-activiting" VMwareTools during the first boot after
the kernel is updated.
-------
[root@bmrtest tsm]# more /etc/init.d/check-vmware-tools
#!/bin/bash
#
# check-vmware-tools
#
# chkconfig: - 00 99
# description: Check whether or not the vmware-tools are installed at boot time.
# processname: check-vmware-tools
#
# source function library
. /etc/rc.d/init.d/functions
RETVAL=0
loadvmxnet() {
/sbin/rmmod pcnet32
/sbin/rmmod vmxnet
/sbin/depmod -a
/sbin/modprobe vmxnet
}
start()
{
echo -n $"Checking VMware Tools: "
if [ "x`uname -m`" == "xi686" -a \
! -e /lib/modules/`/bin/uname -r`/misc/vmxnet.ko ]; then
echo -n "Not available, running vmware-config-tools..."
/usr/bin/vmware-config-tools.pl --default && loadvmxnet
fi
success
echo
}
case $1 in
start)
start
;;
*)
echo "Usage: $0 start"
RETVAL=1
esac
exit $RETVAL
---------------
Original link:
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 ‘vmware-config-tools.pl’ 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:
#!/bin/bash
#
# 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"
fi
}
case $1 in
start)
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/vmware-config-tools.pl --default && loadvmxnet
else
echo "OK"
fi
;;
*)
echo "Usage: $0 start"
exit 1
;;
esac
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 onOn
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 ‘vmware-config-tools.pl and reboots after that.
You can download the file here:
Source:
阅读(641) | 评论(0) | 转发(0) |