<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet href="/templates/default/atom.css" type="text/css" ?>

<feed 
   xmlns="http://www.w3.org/2005/Atom"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/">
    <link href="http://www.olivierhill.ca/feeds/atom10.xml" rel="self" title="Olivier's Blog" type="application/atom+xml" />
    <link href="http://www.olivierhill.ca/"                        rel="alternate"    title="Olivier's Blog" type="text/html" />
    <link href="http://www.olivierhill.ca/rss.php?version=2.0"     rel="alternate"    title="Olivier's Blog" type="application/rss+xml" />
    <title type="html">Olivier's Blog</title>
    <subtitle type="html">Because they listen to me</subtitle>
    <icon>http://www.olivierhill.ca/templates/default/img/s9y_banner_small.png</icon>
    <id>http://www.olivierhill.ca/</id>
    <updated>2010-05-14T17:06:01Z</updated>
    <generator uri="http://www.s9y.org/" version="1.2.1">Serendipity 1.2.1 - http://www.s9y.org/</generator>
    <dc:language>en</dc:language>

    <entry>
        <link href="http://www.olivierhill.ca/archives/62-Update-VMware-tools-before-reboot.html" rel="alternate" title="Update VMware tools before reboot" />
        <author>
            <name>Olivier Hill</name>
            <email>nospam@example.com</email>
        </author>
    
        <published>2010-05-14T16:54:25Z</published>
        <updated>2010-05-14T17:06:01Z</updated>
        <wfw:comment>http://www.olivierhill.ca/wfwcomment.php?cid=62</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://www.olivierhill.ca/rss.php?version=atom1.0&amp;type=comments&amp;cid=62</wfw:commentRss>
    
            <category scheme="http://www.olivierhill.ca/categories/2-Computers" label="Computers" term="Computers" />
    
        <id>http://www.olivierhill.ca/archives/62-guid.html</id>
        <title type="html">Update VMware tools before reboot</title>
        <content type="xhtml" xml:base="http://www.olivierhill.ca/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                I have searched the web and couldn't think of a simpler way to do this.<br />
<br />
When you upgrade your kernel, all modules that were installed by the VMware tools will be missing in the new <code>/lib/modules</code> 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).<br />
<br />
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.<br />
<br />
Tricking the VMware tools software into installing some place else works very well in that case.<br />
<br />
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.<br />
<br />
It is important to note that the tools do run depmod, but not specifying a kernel version, hence defaulting to the running kernel.<br />
<br />
<code><br />
# Get latest kernel installed<br />
VERSION="$(rpm -qa kernel | sort -r | head -n 1 | sed 's/kernel-//')"<br />
<br />
# uname hack (because VMware Tools are stupid)<br />
mv /bin/uname{,.orig} &&amp;<br />
cat > /bin/uname << EOF &&amp;<br />
#!/bin/sh<br />
exec /bin/uname.orig "\$@" | sed 's/2.6.[^ ]*/${VERSION}/'<br />
EOF<br />
chmod 0755 /bin/uname<br />
<br />
# Launch VMware Tools install<br />
/usr/bin/vmware-config-tools.pl -d<br />
<br />
# Remove our uname hack<br />
mv /bin/uname{.orig,}<br />
<br />
# Redo what VMware missed<br />
depmod -a $VERSION<br />
mkinitrd -f /boot/initrd-$VERSION.img $VERSION<br />
</code><br />
<br />
Tested on RHEL 5.4 upgrading to a security fix kernel, works like a charm. 
            </div>
        </content>
        
    </entry>

</feed>