[Spacewalk-list] Re: VMware from spacewalk kickstart
Andy Speagle
andy.speagle at wichita.edu
Fri Dec 18 14:06:03 UTC 2009
On Fri, 2009-12-18 at 04:20 -0600, James Hogarth wrote:
> For reference to the source material (and proper credit) I used these
> as guides to getting this working:
>
> http://www.linuxdynasty.org/how-to-automate-the-install-of-vmware-tools-after-any-kernel-update.html
>
> http://drcs.ca/blog/?p=181
>
> 2009/12/18 James Hogarth <james.hogarth at gmail.com>
> After a little head scratching and hiccups I managed to get my
> vmware guests kickstarting and including the vmware tools
> install and config as part of the kickstart process... using
> the vmxnet driver.
>
> Testing in our environments has shown the vmxnet driver to be
> superior and we wanted to use it on our guests but of course
> since it isn't part of the kernel source the guests had to be
> built with e1000 emulated NICs and then changed over
> afterwards....
>
> Seeing that there are probably others in the same situation I
> thought that popping the steps I took onto the mailing list
> would be good for others - and when I have to do it in 6
> months for Centos 5.5 again (or 6) I can search this list for
> the instructions ;)
>
> This should work in any rpm based kickstartable distrobution
> but was tested on Centos 5.4 x86_64.
>
> First you will need a reference system with VMwareTools
> already installed onto in order to get the kernel module and
> check the PCI IDs your modules are.
>
> From the PXE or kickstart ISO you are using unpack your initrd
> to a work directory....
>
> mkdir /tmp/work
> cd /tmp/work
> cp /mnt/dvd/images/pxeboot/initrd.img .
> mkdir initrd
> cd initrd
>
>
> zcat ../initrd.img | cpio -id
>
> On the reference PC check the PCI ID for your modules....
>
> lspci | grep -i -E 'vmware.*ethernet|ethernet.*vmware'
>
> It will look something like:
>
> 00:11.0 Ethernet controller: VMware VMXNET Ethernet Controller (rev 10)
>
> Next get the full vendor/product ID for the driver where the
> PCI ID is 00:11.0 in the example above.
>
> lspci -n | grep -i '15ad'
>
> Look for the line matching the PCI ID found above and make a
> note of the product ID...
>
> The example from my case is:
>
> lspci -n00:11.0 0200: 15ad:0720 (rev 10) | grep -i '15ad'
>
> Where the vendor ID can be seen as 15ad and the product ID to
> make a note of is above is 0720
>
> Next we need to expand the modules cpio archive to add our
> vmware module to it.
>
> mkdir /tmp/work/modules
>
>
> cd /tmp/work/modules
> zcat ../initrd/modules/modules.cgz | cpio -id
> cd /tmp/work/modules/2.6.*/x86_64
> cp /lib/modules/`uname -r`/misc/vmxnet*.ko .
> chmod 744 vmxnet*
>
> Depending on the version of VMwareToosl you have you may have
> separate vmxnet.o and vmxnet.ko modules in /lib/modules/`uname
> -r`/misc - and you may also jave vmxnet and vmxnet3
> modules.... For the 2.6 kernel you will need the vmxnet*.ko
> modules. If your module is symlinked to the .o version (as in
> my case) make sure you grab the actual file ;)
>
> Next pack back up the modules cpio archive....
>
> cd /tmp/work/modules
> find . | cpio -o -H crc | gzip -9 > /tmp/work/initrd/modules/modules.cgz
>
> Note that the type is crc here....
>
> Next we need to tell our kernel/initrd about our new
> modules....
>
> cd /tmp/work/initrd/modules
> vi pci.ids
>
> Look for the section with the vmware vendor ID of 15ad and add
> your ethernet modules to this... for reference here is my part
> of that file after the addition:
>
> 15ad VMware
> 0405 SVGA II Adapter
> 0710 SVGA Adapter
> 0720 VMware VMXNET Ethernet Controller (rev 10)
>
> Note that you might need the vmxnet3 driver added too
> depending on your version of VMwareTools....
>
> Next append to the initrd modules-info alias info....
>
> vmxnet
> eth
> "VMware VMXNET Ethernet Controller (rev 10)"
>
>
>
> Remember to add a vmxnet3 section if required... On the
> reference system get the entries required for the
> modules.alias file....
>
> grep vmxnet /lib/modules/2.6.18-164.6.1.el5/modules.alias
> alias pci:v000015ADd00000720sv*sd*bc*sc*i* vmxnet
>
>
> alias pci:v00001022d00002000sv*sd*bc*sc*i* vmxnet
>
> Append these to the modules.alias file
> in /tmp/work/initrd/modules
>
> Next pack all this back up....
>
> cd /tmp/work/initrd
> find . | cpio -o -H newc | gzip -9 > /tmp/work/initrd.img.vmxnet
>
>
>
> Copy this initrd.img file to your PXE tree or ISO or however
> you want to use this (renaming it if need be)...
>
> That's the hard work done and that will allow a kickstart of
> the system using the vmxnet network driver instead of the
> e1000 driver. But that is only good for the kickstart itself
> this next final bit is to allow the system to still have a
> network interface after the kickstart is over....
>
> On the spacewalk server create a post script for your
> kickstart containing something like the following:
>
> /usr/bin/yum install -y --nogpgcheck VMwareTools
> sed -i -e '/^\#.*$/d' -e '/^HWADDR=.*$/d' /etc/sysconfig/network-scripts/ifcfg-eth0
>
>
> echo "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 system"
>
> reboot
> fi" >> /etc/rc.local
>
> This assumes that the VMwareToosl rpm is somewhere in your
> channels. It removes any comments from the ifcfg-eth0 file and
> removes the HWADDR restriction so that the system doesn't
> rename it to ifcfg-eth0.bak or somesuch on changes to network
> interface - this was valid for Centos 5.4 YMMV.... The
> rc.local addition is important as vmware-tools-config.pl
> detects module to install based on the running kernel - this
> is of course different in the kickstart. This will also allow
> a kernel upgrade and if need be the system will auto-configure
> on next boot. The reboot is there to ensure that any network
> services etc or any dependencies on network/vmware running
> during start up are met.
>
> Hope this is helpful to someone apart from me next distro
> update ;)
>
> James
>
Automating the install/update of vmware-tools after a kernel install
sounds like something that's begging for a "trigger" RPM. I need to
migrate my ESX VMs to use vmxnet, so I'll go through this process and
post my results.
Thanks for the info.
--
Andy Speagle
"THE Student" - UCATS
Wichita State University
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20091218/c0654ad9/attachment.sig>
More information about the Spacewalk-list
mailing list