<?xml version="1.0" encoding="utf-8" ?>

<rss version="0.91" >
<channel>
<title>Olivier's Blog</title>
<link>http://www.olivierhill.ca/</link>
<description>Because they listen to me</description>
<language>en</language>
<image>
        <url>http://www.olivierhill.ca/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: Olivier's Blog - Because they listen to me</title>
        <link>http://www.olivierhill.ca/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Update VMware tools before reboot</title>
    <link>http://www.olivierhill.ca/archives/62-Update-VMware-tools-before-reboot.html</link>

    <description>
        I have searched the web and couldn&#039;t think of a simpler way to do this.&lt;br /&gt;
&lt;br /&gt;
When you upgrade your kernel, all modules that were installed by the VMware tools will be missing in the new &lt;code&gt;/lib/modules&lt;/code&gt; directory. To reinstall those, you need to reboot first and then re-run the VMware tools. Problems arise if you need the modules prior to the next reboot (ie: if you are doing weird pvscsi on root partition for example).&lt;br /&gt;
&lt;br /&gt;
Out of the box, the VMware tools cannot regenerate modules and initrd for a kernel different than the running one. If you are upgrading the same distribution to a different patch level (RHEL 5 system to a bugfix kernel), chances are that the same modules will work, you just have to install them at the new location.&lt;br /&gt;
&lt;br /&gt;
Tricking the VMware tools software into installing some place else works very well in that case.&lt;br /&gt;
&lt;br /&gt;
This snippet is very RedHat specific, but could be adjusted for any distro. Main points include the uname hack, running a depmod and rebuilding initrd image.&lt;br /&gt;
&lt;br /&gt;
It is important to note that the tools do run depmod, but not specifying a kernel version, hence defaulting to the running kernel.&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
# Get latest kernel installed&lt;br /&gt;
VERSION=&quot;$(rpm -qa kernel | sort -r | head -n 1 | sed &#039;s/kernel-//&#039;)&quot;&lt;br /&gt;
&lt;br /&gt;
# uname hack (because VMware Tools are stupid)&lt;br /&gt;
mv /bin/uname{,.orig} &amp;&amp;amp;&lt;br /&gt;
cat &gt; /bin/uname &lt;&lt; EOF &amp;&amp;amp;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
exec /bin/uname.orig &quot;\$@&quot; | sed &#039;s/2.6.[^ ]*/${VERSION}/&#039;&lt;br /&gt;
EOF&lt;br /&gt;
chmod 0755 /bin/uname&lt;br /&gt;
&lt;br /&gt;
# Launch VMware Tools install&lt;br /&gt;
/usr/bin/vmware-config-tools.pl -d&lt;br /&gt;
&lt;br /&gt;
# Remove our uname hack&lt;br /&gt;
mv /bin/uname{.orig,}&lt;br /&gt;
&lt;br /&gt;
# Redo what VMware missed&lt;br /&gt;
depmod -a $VERSION&lt;br /&gt;
mkinitrd -f /boot/initrd-$VERSION.img $VERSION&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Tested on RHEL 5.4 upgrading to a security fix kernel, works like a charm. 
    </description>
</item>

</channel>
</rss>
