Recently I wanted to migrate a machine from CentOS 6 (i.e. EL6) to Fedora 16 but I didn't have physical access to it so I decided to do it remotely with yum. An encouraging sign was I found a pretty nice guide for upgrading from CentOS 5 to Fedora 12 and since CentOS 6 was newer things should be even easier. The following is a roughly outline of how to perform such a migration.
There is a really really high probability of butchering the whole operating system and having to reinstall from physical media. This is not a step-by-step guide... it's only a rough outline of the steps involved. You need to have experience with RedHat based systems.
- To make things easier, faster and to avoid some weird conflicts with m17n remove all m17n, gcc, eclipse, gnome, rhn packages, abrt, and -devel packages.
yum erase m17n* gcc* eclipse* rhn* abrt* elfutils* rpm-cron rpm-build rpm-apidocs glibc-headers gnome*\ evolution* launchmail plymouth-theme-rings plymouth-system-theme rpm -e $(rpm -qa '*-devel')
- Find a mirror close to you and then in the releases/16/Everything/x86_64/os/Packages/ directory locate and download the following packages:
db4 db4-utils fedora-release glibc glibc-common libdb libcurl libssh2 openssh openssh-clients openssh-askpass openssh-server pygpgme pyliblzma python python-libs python-pycurl python-urlgrabber rpm rpm-build-libs rpm-libs rpm-python wget xz-libs yum yum-metadata-parser
The most important of these are fedora-release, glibc, python, rpm, yum and db4-utils.
- Check the dependencies by running rpm -Uvh --nodeps. This command will fail and it will print out the package dependency problems. Carefully look over the list and download and add any required rpms, or uninstall unnecessary packages.
If you mess up the installation of the rpm package or one it depends on you will not be able to install packages anymore and will have work around from source (but you just removed the compiler)!
A good way to figure out what depends on what is using one of the web based rpm search services.
- Once all packages only show dependencies that are in the form X is needed by (installed) Y then you can install all of the downloaded packages in one swoop with rpm -Uvh --nodeps
- Try the rpm command and if it fails with the following message (or something similar):
error: db4 error(-30971) from dbenv->open: DB_VERSION_MISMATCH: Database environment version mismatch error: cannot open Packages index using db4 - (-30971) error: cannot open Packages database in /var/lib/rpm
you will need to manually upgrade the rpm database with the db_upgrade command as follows (ignore errors about log.000):cd /var/lib/rpm db_upgrade *
- Perform the upgrade using yum update. If it fails you can try yum --skip-broken and then deal with the conflicting packages by hand. At this point the installation should start.
- Reinstall the plymouth system theme (I had to remove the plymouth theme packages earlier and the machine I was upgrading is a workstation... I don't think plymouth themes are strictly necessary for headless servers)
yum install plymouth-system-theme
- Check for leftover packages, rpm -qa | grep el6, and deal with them as you see fit (I think hal was removed in F16 so you can probably get rid of it). Some packages (e.g. flac, kpartx and ustr) are identical between F16 and EL6 but you can use the --force option of rpm to reinstall them if you would like to get rid of the el6 suffix on the rpms.
- As the blog above explains you need to move the inittab over
mv /etc/inittab.rpmnew /etc/inittab
but you don't have to mess around with dracut (at least I didn't have to).
- Update and merge .rpmnew/.rpmsave files using rpmconf
yum install rpmconf -y rpmconf -a
- When you are confident everything is working... you can try to reboot the machine with reboot... it will probably produce a message but not actually reboot. Then you can try systemctl reboot but you'll probably just get an error:
Failed to get D-Bus connection: No connection to service manager.``
It will probably fail since the systemd is different and even the way the machine is shut down has changed in F16. Luckily there is a way, to restart the machine using the Magic SysReq key.sysctl -w kernel.sysrq=1 sync echo b > /proc/sysrq-trigger
The first line enables the SysReq key, the second makes sure that all files are flushed, and the last line triggers the reboot.
- Sit back ping the machine continously and pray to his holy noodliness that the system comes back up.
In my case it took about 1-2 hours and the machine rebooted successfully.