{"id":203,"date":"2011-04-06T19:07:54","date_gmt":"2011-04-06T23:07:54","guid":{"rendered":"http:\/\/bitc.bme.emory.edu\/~lzhou\/blogs\/?p=203"},"modified":"2011-04-06T19:08:38","modified_gmt":"2011-04-06T23:08:38","slug":"upgrade-rhel5-to-rhel6-2","status":"publish","type":"post","link":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/?p=203","title":{"rendered":"Upgrade RHEL5 to RHEL6"},"content":{"rendered":"<p>Redhat always recommends to reinstall from scratch for a major version upgrade of its RHEL system.<\/p>\n<p>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.\u00a0 If it is a mission critical system, the price might be too high to pay.<\/p>\n<p>Then if you just try to upgrade it using the &#8220;upgradeany&#8221; option available in the new OS installation, you are guaranteed to fail.\u00a0 Is there a way to do this?<\/p>\n<p>The answer is yes.\u00a0 However, it is not straight forward.\u00a0 Still a full day job.\u00a0 But definitely it is do-able.\u00a0 I did it successfully.<\/p>\n<p>First of all, step zero, it is highly recommended that you dd your system hd to a spare, and tested it working.\u00a0 This is the last resort in case anything went out of control and leave you a unusable system.\u00a0 This is an a few tens of bucks work.\u00a0 Do not omit it.<\/p>\n<p>Step 1:Preparation<\/p>\n<p>1.1)<\/p>\n<p>$ rpm -qa &#8211;queryformat &#8220;%{NAME}\\n&#8221; | sort &gt; \/root\/all_old_packages<\/p>\n<p>This will give you a list of all packages you have in the current system.\u00a0 Save it somewhere, your jump drive, a CD-R, for future use.<\/p>\n<p>1.2) uninstall selinux.\u00a0 Skip this if you are not currently using selinux.<\/p>\n<p>If you do not do so, you may have flawed\/mixed policies in the upgraded version and may take you big to debug.<\/p>\n<p>1.3) Edit \/etc\/inittab, to set default runlevel down from 5 to 3.<\/p>\n<p>This will prevent the upgraded system to boot up to graphical interface, which might not work just after you upgraded the version.\u00a0 We will leave X upgrading to later.<\/p>\n<p>1.4) Edit \/etc\/fstab, to comment all network file systems imported from NFS or others.<\/p>\n<p>This will prevent the upgraded system from hanging due to not working network settings.\u00a0\u00a0 We will reenable those after we are sure that the network is working.<\/p>\n<p>1.5)<\/p>\n<p>$ rm -rf \/usr\/share\/doc\/HTML\/*\/docs\/common<\/p>\n<p>The RHEL6 will use links instead of directories for those.\u00a0 Without doing so, the upgradeany will fail.<\/p>\n<p>1.6) (optional) copy the DVD image of your RHEL6 installation DVD to \/, if you are not installing from NFS.<\/p>\n<p>Step 2: Upgrade<\/p>\n<p>2.0)It is not necessary to update your existing system to all newest packages.\u00a0 This might increase the chances of adverse incidents.<\/p>\n<p>2.1)Boot into the RHEL6 installation DVD with upgradeany option.\u00a0 Then choose to upgrade existing system.<\/p>\n<p>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.<\/p>\n<p>Let it run.\u00a0 If you are lucky it will run until the reboot stage.\u00a0 If it hangs in the middle, it will means that it failed to place some file at somewhere.\u00a0 Do not panic.\u00a0 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.\u00a0 Then try again this step.\u00a0 Usually after a few tries, the upgradeany will be able to finish and allows you to reboot.<\/p>\n<p>Do not reboot.\u00a0 It won&#8217;t work.<\/p>\n<p>2.2)Now press Ctrl-Alt-F2 to switch to the shell.<\/p>\n<p>Mount the the installation DVD image or NFS volume to \/mnt\/source,<\/p>\n<p>2.3)<\/p>\n<p>$cd \/mnt\/source\/packages<\/p>\n<p>$rpm -Uvh kernel-2.6.32-71.el6.x86_64.rpm\u00a0 &#8211;replacepkgs<\/p>\n<p>2.4)<\/p>\n<p>$rpm -qa &#8211;root \/mnt\/sysimage &gt; \/mnt\/sysimage\/root\/all-new-packages<\/p>\n<p>$cd \/mnt\/source\/packages<\/p>\n<p>$ls &gt; \/mnt\/sysimage\/root\/all-available-packages<\/p>\n<p>$cd \/mnt\/sysimage\/root\/<\/p>\n<p>$ cat all-available-packages all-new-packages | sort &gt; package-comparasion<\/p>\n<p>Then you should look into the file package-comparasion and search for el5<\/p>\n<p>2.5)For each el5 package that has a el5 version number that is higher than the el6 version number, do<\/p>\n<p>$ rpm -ivh &#8211;force &lt;package_file_name&gt; &#8211;root \/mnt\/sysimage<\/p>\n<p>$ rpm -e &lt;the_respective_el5_package_name&gt; &#8211;root \/mnt\/sysimage<\/p>\n<p>For my system, I found the following:<\/p>\n<p>dmidecode, python-dmidecode, device-mapper,\u00a0 subversion, systemtap, device-mapper-event, device-mapper-event-libs, systemtap-runtime<\/p>\n<p>are critical.\u00a0 Others do not have to be done now.<\/p>\n<p>2.6) For some reason RHEL6 switched eth0 and eth1 identification in my system.\u00a0 You&#8217;d like to check about this.<\/p>\n<p>2.7) Check that \/etc\/inittab and runlevel id:3<\/p>\n<p>2.8) Change boot kernel from el5 to el6 in \/mnt\/sysimage\/boot\/grub\/grub.conf<\/p>\n<p>2.9) Reboot.\u00a0 Remember to take out the installation DVD.<\/p>\n<p>Step 3: Fix packages<\/p>\n<p>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.\u00a0 Do not let it replace any package, and seek for more critical packages to replace in the way showed in step 2.5).<\/p>\n<p>3.1)You will boot into a text interface.\u00a0 Log in as root.\u00a0 Fix network configuration if you cannot connect to internet.<\/p>\n<p>3.2)<\/p>\n<p>$ 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<\/p>\n<p>This will remove the EL5 signature from your system.<\/p>\n<p>3.3) Register RHEL6 to your registration provider, either Redhat or your group-license agent.<\/p>\n<p>3.4) replace EPEL repo to el6 version.\u00a0 Also replace your other third party repos here.<\/p>\n<p>3.5) for all packages you found in \/root\/package-comparasion that have a smaller el6 version number than el5, do<\/p>\n<p>$ yum downgrade &lt;package-name&gt;<\/p>\n<p>3.6)<\/p>\n<p>$ package-cleanup &#8211;oldkernels<\/p>\n<p>This will remove the old kernels<\/p>\n<p>$ package-cleanup &#8211;dupes &gt; dups<br \/>\n$ grep -v el6 dups &gt; \/root\/dups.list<br \/>\n$ for pkg in `cat \/root\/dups.list` ; do yum remove ${pkg} ; done<br \/>\nanswer y if OK<\/p>\n<p>3.7)<\/p>\n<p>$yum -y upgrade<\/p>\n<p>This will upgrade your packages that was not available in the DVD to their most current version.<\/p>\n<p>3.8) Mostly step 3.7) will fail for the first a few tries.\u00a0 Do not worry.\u00a0 You can figure which package hindered the above process, then use either method<\/p>\n<p>$ rpm -ivh &#8211;force &lt;package_file_name&gt; ;rpm -e &lt;the_respective_el5_package_name&gt;<\/p>\n<p>or<\/p>\n<p>$ yum downgrade &lt;package-name&gt;<\/p>\n<p>to fix them, until you can run through step 3.7).\u00a0 You may have to run step 3.9) before step 3.7) can run through.<\/p>\n<p>3.9)<\/p>\n<p>$ package-cleanup &#8211;problems<\/p>\n<p>and fix the problems found.\u00a0 This may<\/p>\n<p>3.10)<\/p>\n<p>$ rpm -qa | grep el6 | sort &gt; \/root\/non-el6-packages<\/p>\n<p>You may want to check this list for the packages you believe to be useless to you upgraded system.<\/p>\n<p>3.11)Now you can set back runlevel to 5 and enable commented items in \/etc\/fstab, and reboot.<\/p>\n<p>Step 4: Finalization<\/p>\n<p>4.1) Your system should be able to boot into graphical interface and function normally &#8211; mostly.\u00a0 If not, go back to eliminate more non-el6 packages and try again.<\/p>\n<p>4.2) reinstall selinux, if you like to use it, set it to permissive, and reboot.\u00a0 It will take a good while to relabel all files in your system.<\/p>\n<p>4.3) If you have any filesystem that was ext3, and you&#8217;d like to upgrade them to ext4, do it now:<\/p>\n<p>$ umount \/dev\/your_dev<br \/>\n$ tune2fs -O extents,uninit_bg,dir_index \/dev\/your_dev<br \/>\n$ fsck -Cy \/dev\/your_dev<br \/>\nEdit \/etc\/fstab, replace ext3 to ext4<br \/>\nmount it<\/p>\n<p>4.4)<\/p>\n<p>$ rpm -qa &#8211;queryformat &#8220;%{NAME}\\n&#8221; | sort &gt; \/root\/all_current_packages<\/p>\n<p>$ diff \/root\/all-current-packages \/root\/all-old-packages &gt; \/root\/package-difference<\/p>\n<p>You may use this file to debug<\/p>\n<p>4.5) Leave the system run for days, and inspect selinux denials.\u00a0 When you are confident,<\/p>\n<p>$ setenforce 1<\/p>\n<p>Step 5: Cheer and relax.\u00a0 You have successfully upgraded you system.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,3],"tags":[],"class_list":["post-203","post","type-post","status-publish","format-standard","hentry","category-computer-tips","category-mri-technical-support","post-blog"],"_links":{"self":[{"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/posts\/203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=203"}],"version-history":[{"count":1,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/posts\/203\/revisions"}],"predecessor-version":[{"id":404,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/posts\/203\/revisions\/404"}],"wp:attachment":[{"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}