Visit Jeremy's Blog.
Go Back > Blogs > iamswift
User Name


Rating: 2 votes, 5.00 average.

In place upgrade from RHEL 5.x to RHEL 6.x

Posted 08-17-2012 at 03:25 AM by iamswift
Updated 10-11-2012 at 02:02 AM by iamswift

Inplace upgrade from RHEL 5.x to RHEL 6.x

Recently I contacted RH for in-place upgrade from RHEL 5 to RHEL 6 and got the standard reply from RH that this kind of upgrade is not supported.
I pressed for any document that gives steps carried out when the “upgradeall” option is selected while upgrading from RHEL 5 to RHEL 6 but got the same reply, saying in-place upgrade is not supported across major releases.
Below is the list of steps I followed to get in-place upgrade from RHEL 5.5 to RHEL 6.2.

Disclaimer: The packages I installed in RHEL 5.5 and RHEL 6.2 is minimal set (say some 650+ packages) and the below steps correspond to upgrade from minimal set RHEL 5.5 to RHEL 6.2. While the below steps should be sufficient to make upgraded RHEL 6.2 to up and running, there might be other rpm upgrades which might fail. The installation logs can be looked into to rectify them on case to case basis.

1. RPM magic number differs
The first and foremost hurdle is the rpm support. The magic number used in RHEL 5 is changed in RHEL 6. This means the existing rpm utility installed in RHEL 5.5 cannot be used to install any of the RHEL 6.2 package. If you try to install, following error is thrown:
/media/Packages # rpm -U --nodeps zip-3.0-1.el6.x86_64.rpm
warning: zip-3.0-1.el6.x86_64.rpm: Header V3 RSA/SHA256 signature: NOKEY, key ID fd431d51
error: unpacking of archive failed: cpio: Bad magic
/media/Packages #
We need ‘rpm’ and related packages of RHEL 6.2 to be installed in the RHEL 5.5 first and then use it to install all other packages of RHEL 6.2.
Following are the RHEL 6.2 packages which need to be installed/copied manually in RHEL 5.5 to proceed further:
• rpm-*
• popt
• glibc-*
• libcap
• db4
• xz-libs
• lua

Extract the above packages from RHEL 6.2 repository or DVD using below command:
mkdir rpm_6.2/
cd rpm_6.2/
rpm2cpio /path/to/<pkg>.rpm | cpio –idmv
tar zcvf ../rpm_for_6.2.tar.gz  *			;# Notice tar file created in parent dir

The tar ball has all the RHEL 6.2 rpms required to install the other RHEL 6.2 RPMs.

Copy the created tar file in RHEL 5.5 machine and extract it from “/”.

cd  /
tar  xvf  /path/to/ rpm_for_6.2.tar.gz

There is one other small step required to make the rpm work. The old libpopt libraries are still referred to by the new rpm binary as the /usr/lib64 path is precedent over /lib64/ dir. The old libraries are no longer required and can just be removed.

cd /usr/lib64/
ls –l*
rm –f*

Check the rpm version

/home # rpm –version
RPM version 4.8.0
/home #

Now we have rpm package of RHEL 6.2 in place of older 4.4.x version of rpm package of RHEL 5.5.

2. Getting Installation order list and installing packages

Traverse to dir where the RHEL 6.2 packages are available and execute below command to get the order of rpm packages
rpm –Uvv *.rpm 2>&1 | tee pkg_order.log

The command would read all the packages and provide us the order in which the packages are to be installed (In log file pkg_order.log). Extract the package names and write it in a separate file, say, order_file.txt

The upgrade is triggered by installing RHEL 6.2 rpm packages one-by-one in the same order as given out by previous step.

cd /path/to/rh6.2pkgs/
for Pkg in $(cat order_file.txt)
    rpm –Uvv  --force  --nodeps  $Pkg  2>&1 | tee –a install_logs.log

3. Kernel upgrade and creation of initramfs

While installing kernel package, the creation of initramfs fails. The installation of kernel package itself will be successful but the scriptlet results in error and thereby failing to create the initramfs under /boot. The failure happens because of the segfault while executing /bin/mktemp.

+ grep -q crashkernel
+ '[' 1 -ne 0 ']'
+ NEWKERNARGS=--kernel-args=crashkernel=auto
+ /sbin/new-kernel-pkg --package kernel --mkinitrd --dracut --depmod --update 2.6.32-220.el6.x86_64 --kernel-args=crashkernel=auto
mktemp[12333]: segfault   rsp: 0000xxxxxxx xxxxxxxx x  xxxxxxxxxxxx
chmod: cannot access `': No such file or directory
usage: plymouth [ --verbose | -v ] { --targetdir | -t } <initrd_directory>
cp: `/etc/' and `/etc/' are the same file
cp: `/etc/' and `/etc/' are the same file

gzip: stdout: No space left on device
E: dracut: creation of /boot/initramfs-2.6.32-220.el6.x86_64.img failed
mkinitrd failed
+ exit 1
D: (null): waitpid(8650) rc 8650 status 100 secs 127.394
warning: %posttrans(kernel-2.6.32-220.el6.x86_64) scriptlet failed, exit status 1

Obviously something is wrong with the mktemp. The kernel that is loaded in memory is that of RHEL 5.5 (2.6.18-x) and it expects mktemp version corresponding to RHEL 5.5 whereas the currently installed mktemp is version 8.x which is installed from coreutils package of RHEL 6.2.

Extract mktemp-xxx.rpm package of RHEL 5.5 to get mktemp binary. While the kernel package is upgraded, the mktemp of RHEL 5.5 should be available in /bin/ so that the mktemp does not crask and scriptlet succeeds in creating the initramfs for RHEL 6.2.

cd  /home/mktemp_5.5/
rpm2cpio  /path/to/mktemp-xxx.x86_64.rpm  |  cpio  -idmv
mv   /bin/mktemp   /bin/mktemp_6.2
cp –p /home/mktemp_5.5/mktemp    /bin/

Once the kernel package is installed successfully, the mktemp binaries are to be swapped back to have the correct mktemp version that corresponds to RHEL 6.2

mv  /bin/mktemp_6.2   /bin/mktemp

Once complete, reboot the system and see those beautiful messages of RHEL 6.2 scroll through screen.

- Lakshmivaragan
HCL Technologies Ltd,
Chennai, India
lakshmivaraganm at hcl dot com
Posted in Technical
Views 24670 Comments 0
« Prev     Main     Next »
Total Comments 0




All times are GMT -5. The time now is 08:38 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration