WARNING DANGEROUS!
Disclaimer: This is not supported and it can breaks you computer or delete your data. You have been warned. I take no responsibility if it breaks. Double check that your backup is working.
Past
My main server was updated from Centos 3 -> 4 -> 5 with the help of the undocumented upgrade option of Install CD. So I have a lot of experience with “unofficial” updating Centos. In between it was also moved from physical to a virtual machine. This did not work with update 6 -> 7. The project to port the official red hat tool to CEntOS did never took off.
At the end I had to reinstall my machine, but after more the 10 years of updates, it was time to cleanup, reinstall, configure and check everything. During the cleanup I found a couple of very surprising things that still hung around 🙂
Current
Now with the release Cenos 8. I don’t want to do that again (the 10 years are not up yet) and I tried to run an upgrade from Centos 7 -> 8. It kind of works, but of course it is not for the faint hearted. Yes, I did it in a test environment first.
An update from within a running Centos 7 did not work, because even with the available dnf, the old rpm from C7 was not able run the update.
EPEL and others
If you are using EPEL or other repos this procedure could remove some or all of the packages from this repos. Especially epel is still quite empty at the moment, also other projects do not support Centos8 yet.
Update
So you have to boot the Centos8 image and start a Centos8 rescue system.
You network configuration (network port name) could change as well, so be sure you can access the console (directly or via remote admin card)
You are asked if the file system should be mounted, please answer with yes.
The commands are quite simple:
rpm --root /mnt/sysimage/ -Uvh /mnt/install/repo/BaseOS/Packages/centos-release-*.x86_64.rpm dnf --installroot=/mnt/sysimage/ distro-sync --allowerasing
It is possible that you have to remove some of the packages because it is missing the correct replace line in the spec. In my case I had to remove:
rpm --root /mnt/sysimage/ -e --nodeps systemvinit-tools python-inotify pycairo yum adwaita-qt5 dnf --installroot=/mnt/sysimage/ distro-sync --allowerasing dnf --installroot=/mnt/sysimage/ install @base
If you use other groups like “Server with Gui” please install this group as well.
If you want to use a different language then English, please install the needed langpack like:
dnf --installroot=/mnt/sysimgae/ install glibc-langpack-de
If you prefer to use yum instead of dnf or if you had remove something that you need, you can do it now:
dnf --installroot=/mnt/sysimgae/ install yum
Cleanup
After that you can boot into your server again. It will take a longer time than usual, because a relabel will occur at the first boot. Be patient.
Cleanup the old repos:
rm -rf /var/cache/yum/ /var/cache/dnf/ dnf update --refresh
You can try to remove packages from EL7. But please be careful and check the removed packages. I had to install “@Base” and “@Server with Gui” again:
dnf repoquery --extras -q | xargs dnf remove
I urge you to run the following command and check the output:
dnf repoquery --duplicates dnf repoquery --unneeded dnf repoquery --extras dnf repoquery --unsatisfied
I clean out the rest of network-scripts as well and switch completely to NetworkManager:
dnf install NetworkManager-config-server dnf remove network-scripts
I ran into a new intial-setup screen during every boot. To disable it I had to run:
systemctl disable intial-setup-reconfiguration.service
After that you have updated to Centos8.
Conclusion
I showed that it is possible to update from Centos7 to 8, but I’m not sure if I can trust this system after this upgrade. I will play around with test system at home and will write a new blog post, or update this post when I have decided for myself.
Nicely done, and works well if a couple of additional points are observed:
(1) If you have to (or want to — recommended due to the number of packages that will be changed) do the initial upgrade to CentOS 8 using the repositories on the boot media, specify “–disablerepo=\* –enablerepo=c8-media-\*”.
(2) BEFORE attempting to use the media-based repos, make sure the correct “/mnt/sysimage/etc/yum.repos.d/CentOS-Media.repo” file is in place, and change the “file:///…” URLs in that file to point to the appropriate locations under “/mnt/install/repos”.
Crud :-(. The “point (2)” should have read “/mnt/install/repo”, not “repos”.