Upgrade RHEL5 to RHEL6
Redhat always recommends to reinstall from scratch for a major version upgrade of its RHEL system.
However, if you have a highly customized system with plenty third party softwares and non-standard settings, even if you have a full record of all customer settings, it will still be a big job, days, and aftermath to have everything set back properly. If it is a mission critical system, the price might be too high to pay.
Then if you just try to upgrade it using the “upgradeany” option available in the new OS installation, you are guaranteed to fail. Is there a way to do this?
The answer is yes. However, it is not straight forward. Still a full day job. But definitely it is do-able. I did it successfully.
First of all, step zero, it is highly recommended that you dd your system hd to a spare, and tested it working. This is the last resort in case anything went out of control and leave you a unusable system. This is an a few tens of bucks work. Do not omit it.
Step 1:Preparation
1.1)
$ rpm -qa –queryformat “%{NAME}\n” | sort > /root/all_old_packages
This will give you a list of all packages you have in the current system. Save it somewhere, your jump drive, a CD-R, for future use.
1.2) uninstall selinux. Skip this if you are not currently using selinux.
If you do not do so, you may have flawed/mixed policies in the upgraded version and may take you big to debug.
1.3) Edit /etc/inittab, to set default runlevel down from 5 to 3.
This will prevent the upgraded system to boot up to graphical interface, which might not work just after you upgraded the version. We will leave X upgrading to later.
1.4) Edit /etc/fstab, to comment all network file systems imported from NFS or others.
This will prevent the upgraded system from hanging due to not working network settings. We will reenable those after we are sure that the network is working.
1.5)
$ rm -rf /usr/share/doc/HTML/*/docs/common
The RHEL6 will use links instead of directories for those. Without doing so, the upgradeany will fail.
1.6) (optional) copy the DVD image of your RHEL6 installation DVD to /, if you are not installing from NFS.
Step 2: Upgrade
2.0)It is not necessary to update your existing system to all newest packages. This might increase the chances of adverse incidents.
2.1)Boot into the RHEL6 installation DVD with upgradeany option. Then choose to upgrade existing system.
If you do not have a DVD, you may boot into the installation CD and use NFS to reach the DVD image that is mounted in another linux box.
Let it run. If you are lucky it will run until the reboot stage. If it hangs in the middle, it will means that it failed to place some file at somewhere. Do not panic. You may now try press Ctrl-Alt-F1 through F6 to find out the broken point, and use the shell in Ctrl-Alt-F2 to hand remove the files that blocks the installation. Then try again this step. Usually after a few tries, the upgradeany will be able to finish and allows you to reboot.
Do not reboot. It won’t work.
2.2)Now press Ctrl-Alt-F2 to switch to the shell.
Mount the the installation DVD image or NFS volume to /mnt/source,
2.3)
$cd /mnt/source/packages
$rpm -Uvh kernel-2.6.32-71.el6.x86_64.rpm –replacepkgs
2.4)
$rpm -qa –root /mnt/sysimage > /mnt/sysimage/root/all-new-packages
$cd /mnt/source/packages
$ls > /mnt/sysimage/root/all-available-packages
$cd /mnt/sysimage/root/
$ cat all-available-packages all-new-packages | sort > package-comparasion
Then you should look into the file package-comparasion and search for el5
2.5)For each el5 package that has a el5 version number that is higher than the el6 version number, do
$ rpm -ivh –force <package_file_name> –root /mnt/sysimage
$ rpm -e <the_respective_el5_package_name> –root /mnt/sysimage
For my system, I found the following:
dmidecode, python-dmidecode, device-mapper, subversion, systemtap, device-mapper-event, device-mapper-event-libs, systemtap-runtime
are critical. Others do not have to be done now.
2.6) For some reason RHEL6 switched eth0 and eth1 identification in my system. You’d like to check about this.
2.7) Check that /etc/inittab and runlevel id:3
2.8) Change boot kernel from el5 to el6 in /mnt/sysimage/boot/grub/grub.conf
2.9) Reboot. Remember to take out the installation DVD.
Step 3: Fix packages
3.0)If you still cannot boot, you will need to go back to step 2 and proceed until you have the shell by pressing Ctrl-Alt-F2. Do not let it replace any package, and seek for more critical packages to replace in the way showed in step 2.5).
3.1)You will boot into a text interface. Log in as root. Fix network configuration if you cannot connect to internet.
3.2)
$ yum remove redhat-release-5Server redhat-lsb-4.0-x.x.x.el5.i386 redhat-release-notes-5Server-xx.x86_64 redhat-lsb-4.0-x.x.x.el5.x86_64
This will remove the EL5 signature from your system.
3.3) Register RHEL6 to your registration provider, either Redhat or your group-license agent.
3.4) replace EPEL repo to el6 version. Also replace your other third party repos here.
3.5) for all packages you found in /root/package-comparasion that have a smaller el6 version number than el5, do
$ yum downgrade <package-name>
3.6)
$ package-cleanup –oldkernels
This will remove the old kernels
$ package-cleanup –dupes > dups
$ grep -v el6 dups > /root/dups.list
$ for pkg in `cat /root/dups.list` ; do yum remove ${pkg} ; done
answer y if OK
3.7)
$yum -y upgrade
This will upgrade your packages that was not available in the DVD to their most current version.
3.8) Mostly step 3.7) will fail for the first a few tries. Do not worry. You can figure which package hindered the above process, then use either method
$ rpm -ivh –force <package_file_name> ;rpm -e <the_respective_el5_package_name>
or
$ yum downgrade <package-name>
to fix them, until you can run through step 3.7). You may have to run step 3.9) before step 3.7) can run through.
3.9)
$ package-cleanup –problems
and fix the problems found. This may
3.10)
$ rpm -qa | grep el6 | sort > /root/non-el6-packages
You may want to check this list for the packages you believe to be useless to you upgraded system.
3.11)Now you can set back runlevel to 5 and enable commented items in /etc/fstab, and reboot.
Step 4: Finalization
4.1) Your system should be able to boot into graphical interface and function normally – mostly. If not, go back to eliminate more non-el6 packages and try again.
4.2) reinstall selinux, if you like to use it, set it to permissive, and reboot. It will take a good while to relabel all files in your system.
4.3) If you have any filesystem that was ext3, and you’d like to upgrade them to ext4, do it now:
$ umount /dev/your_dev
$ tune2fs -O extents,uninit_bg,dir_index /dev/your_dev
$ fsck -Cy /dev/your_dev
Edit /etc/fstab, replace ext3 to ext4
mount it
4.4)
$ rpm -qa –queryformat “%{NAME}\n” | sort > /root/all_current_packages
$ diff /root/all-current-packages /root/all-old-packages > /root/package-difference
You may use this file to debug
4.5) Leave the system run for days, and inspect selinux denials. When you are confident,
$ setenforce 1
Step 5: Cheer and relax. You have successfully upgraded you system.
19 Comments
Leave a Reply
You must be logged in to post a comment.
It’s good to learn about upgrade from RHEL5 To RHEL6 🙂
[…] http://bitc.bme.emory.edu/~lzhou/blogs/?p=203 Like this:Like Loading… […]
You sir are awesome for posting this. It took me 8+ hours but it worked! Thank you so much.
MUCH Thanks!!! This worked well on a RHEL 5.8 system to RHEL 6.3
I have to do some more verification to make sure everything works as it should, but so far it looks good! This is saving me from having to completely re-engineer our current image (which of course has 0 documentation on configs that were changed!)
We stumbled over here from a different web address and thought I may as well check things out. I like what I see so now i’m following you. Look forward to finding out about your web page again.
Thanks for your submission, previously it was interesting and compelling. I stumbled upon my way here through Google, I’ll return one more time 🙂
I actually wanted to compose a small note to express my thanks you for a few of the pleasant secrets you are showing on this webpage.
Do you mind if I quote a couple of your posts as long as I provide credit and sources back to your webpage? My website is in the exact same niche as yours and my visitors would certainly benefit from a lot of the information you present here. Please let me know if this ok with you. Thanks!
I actually wanted to compose a small note to thank you for some of the pleasant secrets you are showing on this website.
You make a great point. Got some great info here. I think that if more people thought about it that way, they’d have a better time get the hang ofing the issue.
Just wish to say your article is as astonishing. The clearness to your put up is just great and that i can suppose you’re knowledgeable in this subject. Fine together with your permission allow me to take hold of your RSS feed to stay updated with forthcoming post. Thanks one million and please continue the enjoyable work.
Greetings! This is my first comment here so I just wanted to give a quick shout out and tell you I genuinely enjoy reading your posts. Can you recommend any other blogs/websites/forums that cover the same topics? Thanks for your time!
I do enjoy the manner in which you have presented this difficulty plus it really does supply me some fodder for thought. Nonetheless, through what I have experienced, I just trust as the actual comments stack on that folks stay on point and in no way get started on a tirade involving some other news du jour. Anyway, thank you for this outstanding piece and though I do not necessarily go along with it in totality, I value your perspective.
This really answered my drawback, thanks!
Good stuff, I anticipate reading even more.
Off topic but very interesting template. Would you mind giving me name of template ? Btw i searched on google “temizlik sirketleri antalya” and found myself here in a way 🙂
I gotta favorite this internet site it seems very useful very beneficial
RHEL5.6 – > RHEL6.1 revision:
m -rf /usr/share/doc/HTML/*/*/common
rpm -ivh –force ; yum remove :
Packages are:
dmidecode, python-dmidecode, xorg-x11-drv-evdev, xorg-x11-dev-mga, less, lcm subversion, pythos-nose, sblim-wbemcli
To be removed:
rhel-instnum, redhat-*
gnome-panel-2.16.1-7.el5.i386
xmlsec1-1.2.9-8.1.2.i386
replace epel:
rpm -Uvh http://download.fedora.redhat.com/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm
Once I came over to Dao’s BLOG I can only see part of it, is this my net internet browser or the internet web site? Should I reboot? Cheers Lois Gordon