oracle / centos2ol

Script and documentation to switch CentOS/Rocky Linux to Oracle Linux
https://linux.oracle.com/switch/centos/
Universal Permissive License v1.0
344 stars 81 forks source link

CentOS 8-stream conversion support #131

Open cwadrupldijjit opened 2 years ago

cwadrupldijjit commented 2 years ago

I recently tried to set up an Oracle Linux machine using WSL 2 and basing it off of the CentOS 8 version, but I ran into insurmountable issues (at least, for me) while trying to update/upgrade everything necessary due to the fact that CentOS 8 has reached its EOL as of a month ago and the suggestion is to use either CentOS 7 or CentOS 8-stream. As such, I installed CentOS 8-stream instead and tried to run the script.

Looking into the script, I ran into an error stating that the distribution wasn't supported. Since my understanding of CentOS 8-stream is that it is CentOS 8, but supported upstream (or something like that), I figured I'd try to use the script anyway to see if it would work.

Lo and behold, I tweaked two lines of the script to include the -stream postfix and it upgraded smoothly.

Could this support be added for the help of others who, like me, might need it? I do have a PR that I created for it (#130), but because I hadn't read the contributing guidelines yet and there was some discussion started there talking about the different requirements that might need to be accounted for, I moved over to an issue for that discussion to live.

MasterYous commented 2 years ago

Wanted to add that this is a worthwhile effort for anyone whose CentOS 8 system is in a state where it can't be upgraded directly from dnf anymore. This would be anyone who doesn't have the latest gpg keys, or who's on 8.2 or previous. I first migrated to Streams 8, because that is a direct path out of the CentOS roadblock, and centos2ol does not work in such a case without a lot of manual intervention. Then I took the Streams 8 system and moved it to Oracle Linux 8.4.

A more worthwhile effort MIGHT be to fold in the dnf repo swap commands that might allow a "stuck" CentOS 8 system to sync directly from the Oracle repositories, but that would involve major surgery to this script. This might be the equivalent of:

dnf --disablerepo '*' --enablerepo=ol8_UEKR6 --enablerepo=ol8_baseos_latest swap centos-repos ol8_appstream

It would also require a fetch and an RPM installation of the proper GPG keys for OL for the above to work.

If I can get that automated in the script I'll submit that.

Given the difficulty of the above, I wound up doing the same thing as in this issue / PR to get it to work, and it did work without issue, except for some unresolved dependencies with glibc which were just local yum db errors (the libraries are all correct). As such, I added --allowerasing to the script to make sure dnf distro-sync worked without error. --allowerasing is safe to use if you're using the -r flag with the centos2ol.sh script.

My diffs are below, as it does not make sense to put in another PR.

15c15
< bad_packages=(centos-backgrounds centos-gpg-keys centos-logos centos-release centos-release-cr desktop-backgrounds-basic \
---
> bad_packages=(centos-backgrounds centos-gpg-keys centos-logos centos-release centos-stream-release centos-release-cr desktop-backgrounds-basic \
130c130
<     centos-release* | centos-linux-release*) ;;
---
>     centos-release* | centos-stream-release* | centos-linux-release*) ;;
357c357
< if [[ $old_release =~ ^centos-release-8.* ]] || [[ $old_release =~ ^centos-linux-release-8.* ]]; then
---
> if [[ $old_release =~ ^centos-release-8.* ]] || [[ $old_release =~ ^centos-stream-release-8.* ]] || [[ $old_release =~ ^centos-linux-release-8.* ]]; then
506c506
< if ! yum -y distro-sync; then
---
> if ! yum -y distro-sync --allowerasing; then
Djelibeybi commented 2 years ago

This script is used to convert systems in a manner in which they remain eligible for Oracle Support, which means we can't add CentOS Stream support, because we don't track that at all. It is however something that a fork could do. :)

As to the underlying issue, we have released Oracle Linux for WSL on the Microsoft Store.