Wednesday, July 10, 2013

HP server firmware update over PXE from Windows



The correct way to deploy server is to update all firmware components before installing the operating system. The most common way to update is to burn SPP to DVD or mount SPP.iso as a virtual media via iLO and update each server. You either have to burn a separate DVD for each server for simultaneous updates, or you should configure iLO and mount DVD ISO on each server. Too much time spent on updates...

I'll tell you how to update a lot of servers at one time just by powering them on.


It is a pretty long instruction because it is a step-by-step guide to create a Windows lite-weight PXE environment for updating servers firmware. Finally you can get a good-working solution to easy unattended update a big number of servers (for example on installations).

I used my notebook with Windows 7 as a server. It's IP address was 10.10.10.1.
You can download a fresh SPP version here.
Read more about SPP in my article.

This article consists of 3 parts.

PART 1 - Prepare environment


1.    Make a windows network share and copy or move SPP iso into the share (I created a share named "SPP". It became available via the address \\10.10.10.1\SPP\).

2.    Create a folder for use as TFTP root folder (for example here and later I use C:\
www\spp201302pxe)

3.    Copy contents of the “system” folder from SPP iso or SPP disk to C:\www\spp201302pxe\

4.    Download syslinux-4.06 syslinux pack (not a 5 version) from https://www.kernel.org/pub/linux/utils/boot/syslinux/

5.    Find in a syslinux pack a file called pxelinux.0 (usually in a “core” subfolder) and copy it to C:\www\spp201302pxe\

6.    Create a new folder and name it “pxelinux.cfg” in the TFTP root folder (C:\www\spp201302pxe\)

7.    Create a new file in the pxelinux.cfg folder and name it “default” (without any extension)

8.    Edit this “default” file to include the following lines: 

UI menu.c32
MENU TITLE HP Service Pack 2013.02 for ProLiant PXE Boot Menu
prompt 0
timeout 150
# 1/10s * timeout = value

label auto_power_off
MENU LABEL Automatically update firmware and power off the server
kernel vmlinuz
append initrd=initrd.img media=net rw root=/dev/ram0 ramdisk_size= init=/bin/init loglevel=3 ide=nodma ide=noraid nopat pnpbios=off vga=791 splash=silent hp_fibre showopts noexec32=off numa=off nox2apic TYPE=AUTOMATIC hp_poweroff iso1=cifs://10.10.10.1/SPP/HP_Service_Pack_for_Proliant_2013.02.iso iso1mnt=/mnt/bootdevice

label auto
MENU LABEL Automatically update firmware and reboot the server
kernel vmlinuz
append initrd=initrd.img media=net rw root=/dev/ram0 ramdisk_size= init=/bin/init loglevel=3 ide=nodma ide=noraid nopat pnpbios=off vga=791 splash=silent hp_fibre showopts noexec32=off numa=off nox2apic TYPE=AUTOMATIC AUTOPOWEROFFONSUCCESS=no AUTOREBOOTONSUCCESS=yes iso1=cifs://10.10.10.1/SPP/HP_Service_Pack_for_Proliant_2013.02.iso iso1mnt=/mnt/bootdevice

label manual
MENU LABEL Run SPP in a manual mode (Firmware, ACU, Diagnostic)
kernel vmlinuz
append initrd=initrd.img media=net rw root=/dev/ram0 ramdisk_size= init=/bin/init loglevel=3 ide=nodma ide=noraid nopat pnpbios=off vga=791 splash=silent hp_fibre showopts noexec32=off numa=off nox2apic TYPE=MANUAL AUTOPOWEROFFONSUCCESS=no iso1=cifs://10.10.10.1/SPP/HP_Service_Pack_for_Proliant_2013.02.iso iso1mnt=/mnt/bootdevice

label local_boot
MENU LABEL Boot local hard drive
kernel chain.c32
append hd0 0

This file is a configuration file for PXE boot. It will create a boot menu of 4 items. Each item is described in a section started with a word "label". The difference between 1st, 2nd and 3rd items is in the way SPP launches and terminates. The first item automatically start the update process and power down the server after upgrade is complete.

Do not forget to replace iso address to you real iso address, cause this one is my. As far as I use Windows network share folder I use cifs:// as a prefix (do not mix with smb:// or smbfs:// as it may be written in some HP guides – it doesn’t work). As an alternative you can use Linux NFS to share an SPP iso file, but I use windows with cifs.

 PART 2 - modify initrd.img


As you can mention each boot item contains "append initrd=initrd.img" where a path to initrd file is written (a relative path from tftp root folder). Initrd.img is a main boot image file for our SPP. This file is contained on the SPP DVD/ISO. 

But at the moment this article is written this initrd.img file is not suitable for booting, because it doesn't contain all necessary files inside. You can safely check it by yourselves - just skip this part and try to boot server - you'll catch an error, stating that some file is missing. Though it is intended to work properly, it doesn’t work without modifying.

I hope HP will correct the problem in future releases of SPP, but now we have to correct it by ourselves.



1. Now you need some linux server/PC for next actions. 
2. Copy “system\initrd.img” file from SPP iso to linux pc. 
3. Make a temporary directory on the linux PC (I created init_temp directory with # mkdir /init_temp ) 
4. Move uploaded initrd.img (step 2) to the created temporary directory( # mv /initrd.img /init_temp )
5. # cd /init_temp 
6. Run a command # file initrd.img It will show you what type of compression is used against the initrd.img file. In my case it is a LZMA compression. 
7.   Rename initrd.img to initrd.img.lzma file # mv initrd.img initrd.img.lzma 
8.   Uncompress initrd.img.lzma # unlzma initrd.img.lzma 
9.   Unarchive initrd.img  # cpio -i --make-directories < initrd.img 
10.   Remove packed source file # rm –f initrd.img
11. Find out the current SPP kernel version by executing command # ls /init_temp/lib/modules You will see the output like 3.0.13-0.27-default. This is the version of kernel the SPP uses. 
12. Download original SUSE kernel (the same version as used in SPP dvd).
For example:
- SPP 2013.02 - http://demeter.uni-regensburg.de/SLES11SP2-x64/DVD1/suse/x86_64/kernel-default-3.0.13-0.27.1.x86_64.rpm
-   SPP 2013.09(B) - http://pkgs.clodo.ru/suse/test/213.141.145.240/SLES11SP2_UPD64/kernel-default-3.0.58-0.6.2.1.x86_64.rpm
In this article I'll use kernel-default-3.0.13-0.27.1.x86_64.rpm for SPP 2013.02 just for example.
13.   Copy downloaded kernel-default-3.0.13-0.27.1.x86_64.rpm (step 10) to the linux PC
14. Make a temporary directory on the linux PC (I created kern_temp directory with # mkdir /kern_temp )
15. Move uploaded kernel-default-3.0.13-0.27.1.x86_64.rpm (step 14) to created temporary directory ( # mv /kernel-default-3.0.13-0.27.1.x86_64.rpm /kern_temp )

16. # cd /kern_temp
17.  Convert RPM to CPIO and unarchive it # rpm2cpio kernel-default-3.0.13-0.27.1.x86_64.rpm | cpio –idmv
18. Copy missing in HP’s initrd.img files # cp /kern_temp/lib/modules/3.0.13-0.27-default/kernel/crypto/des_generic.ko /init_temp/lib/modules/3.0.13-0.27-default/kernel/crypto/
19.# cp /kern_temp/lib/modules/3.0.13-0.27-default/kernel/crypto/ecb.ko /init_temp/lib/modules/3.0.13-0.27-default/kernel/crypto/
20.# cp /kern_temp/lib/modules/3.0.13-0.27-default/kernel/crypto/md4.ko /init_temp/lib/modules/3.0.13-0.27-default/kernel/crypto/
21.# cp /kern_temp/lib/modules/3.0.13-0.27-default/kernel/crypto/md5.ko /init_temp/lib/modules/3.0.13-0.27-default/kernel/crypto/
22.# cd /init_temp/
23. Create a new CPIO file # find ./* | cpio -oc > initrd.cpio
24. Compress it with LZMA # lzma -9 initrd.cpio
25. Rename the compressed file # mv initrd.cpio.lzma initrd.img
26.Now copy /init_temp/initrd.img back to the windows host to C:\www\spp201302pxe\ folder and replace already existing old initrd.img.
27.Don’t forget to delete unnecessary temporary files on Linux host: # rm –fR /init_temp
28.# rm –fR /kern_temp



Looks to complicated, but thats the job we have to do to get things work. Special thanks to HP :)
Anyway we have to modify initrd.img only once and forget about it.

PART 3 - Setting up TFTPD (final part)




1.    Download TFTPD32 or TFTPD64 program from http://tftpd32.jounin.net/tftpd32_download.html (I use tftpd64). It is used as a DHCP and a TFTP server for windows very small in size and very simple to use.
2.    Install downloaded tftpd program
3.    Run tftpd program, click “settings” and setup setting like in screenshots. You may need to run program as “Administrator”.



4.    Restart program to apply changes.
5.    Connect to network and connect you target server to the same network.
6.    Boot your target server. You may need to turn on PXE boot in BIOS if it is not turned on yet (turned on by default).
 



1 comment:

  1. Hi Vitaliy,
    I did part 1 and part 3 and looks working with a new SPP, but one thing not working, it is loading a main squared HP screen and no more. I think it is not mounted an iso. could you hel please

    ReplyDelete