Linux upgrade from i386/i686 to x86_64
This article describes upgrade CentOS 5.5 from i386 arch to x86_64 arch.
First of all, upgrade kernel and boot loader from CD. For my system this operation was done by hosting provider.
After kernel upgrade system have a lot of i386/i686 packages. It isn’t possible to upgrade each package manually. For example, my CentOS had 300+ packages.
To continue you need to install yum
The algorithm of upgrading is simple:
- install for each i386/i686 package its x86_64 analogue
- erase i386/i686 packages
But it can be complicated, because any packages uses the same paths or something else and you need manually to install RPMs.
Let’s begin.
Install yum plugin yum-downloadonly:
yum install yum-allowdowngrade
Then take a list of packages for upgrade:
rpm -qa --qf "%{name}.%{arch}\n" | grep -E "i386|i686"
Copy this list into your text editor and replace “.i386” and “.i686” with “.x86_64”. Also replace all returns with spaces. You will take something like this:
glibc.x86_64 readline.x86_64 ncurses.x86_64
Now download this packages RPMs:
yum install --downloadonly --downloaddir=/root/rpms/ <packages>
where <packages> are in my example glibc.x86_64 readline.x86_64 ncurses.x86_64
Of course directory/root/rpms/ must exist.
When yum finishes to download hundreds of packets, chdir to /root/rpms/ and execute
rpm -i --force *.rpm
rpm will force installation of all downloaded packages.
After installation you need come back to your i386/i686 packages list and uninstall them.
yum erase <packages>
where <packages> are in my example glibc.i686 readline.i386 ncurses.i386
That’s all!
Thanks a lot! very useful.
Improvements:
+ In modern distros, like CentOS, you have to install yum-plugin-downloadonly.noarch for the downloadonly option
+ The package editing can be reduced with creative use of sed, like:
rpm -qa –qf “%{name}.%{arch}\n” | grep -E “i386|i686” | sed -e ‘s/i.86/x86_64/’ > newrpms
rpm -qa –qf “%{name}.%{arch}\n” | grep -E “i386|i686” > oldrpms
Then, the lists can be placed in any command by way of $(cat newrpms)
Maybe that at some point an “rpm –rebuilddb” might be needed.