After almost 5 hours of upgrading, my server has been successfully upgraded from Fedora 21 to Fedora 24, which uses the latest stable kernel 4.6. There is a online post demonstrating how to upgrade from Fedora 21 to 23 using fedup. This post talks about Fedora upgrading from 21 to 24 using dnf. NOTE: please do backup your data before action!
0. yum update
This is usually not a problem for Fedora 21, whose support has expired for a long time. Anyway, run it just in case.
According to the Fedora official wiki (https://fedoraproject.org/wiki/DNF_system_upgrade), dnf is recommed for system upgrade. Apparently, fedup has been ditched. Here what we need are 3 dnf commands:
sudo dnf upgrade --refresh
sudo dnf install dnf-plugin-system-upgrade
sudo dnf system-upgrade download --refresh --releasever=24
The last dnf command should list any error, which blocks the upgrade. The errors I have encountered were obsolete packages which are not supported in Fedora 24 repo. As you can tell, the only way to move the upgrade is to remove all these obsolete packages, using “yum remove” + unsupported package name reported by dnf.
Once all the errors are cleaned, dnf is able to download all the required packages for Fedora 24. On my server, it was about 4GB. So, you need at least some GB left to hold all these new packages. More important, dnf requires another 5GB under root during the package installation. Make sure you make dnf happy.
Before dnf was able to install all new downloaded packages, I got such an error:
Couldn’t open file /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-24-x86_64
There is a bug report talking about the possibilities of this issue and corresponding fixes (https://bugzilla.redhat.com/show_bug.cgi?id=1044086#c11). However, if you find manual key importing does not work, go and take a look at /etc/pki/rpm-gpg directory. What happened to my server was simply no any key file for Fedora 24. Oops. The fix is also easy – creating the key files by ourselves. Go to https://getfedora.org/keys/ and find the key files (primary/secondary). Create these key files and symlink the x86_64 (arch of my server) with the primary. That’s it.
3. dnf again
Reboot the machine to start the upgrade:
sudo dnf system-upgrade reboot
Hint: yum is now deprecated. Run “dnf update” once you are into the new system.