oracle / centos2ol

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

Error when trying to convert latest RHEL 9.3 updated server to Oracle Linux #170

Closed digirave closed 8 months ago

digirave commented 8 months ago

Error when trying to convert latest RHEL 9.3 updated server to Oracle Linux

Error: An error occurred while attempting to switch this system to Oracle Linux and it may be in an unstable/unbootable state. To avoid further issues, the script has terminated.

Standard run:

# bash centos2ol.sh
Checking for required packages...
Checking your distribution...
package epel-release is not installed
Checking for yum lock...
Checking for required python packages...
Finding your repository directory...
Learning which repositories are enabled...
Repositories enabled before update include:
rhel-9-for-x86_64-appstream-rpms
rhel-9-for-x86_64-baseos-rpms
Looking for yumdownloader...
Updating Subscription Management repositories.
Last metadata expiration check: 0:40:01 ago on Wed 20 Mar 2024 03:58:48 AM KST.
Dependencies resolved.
=======================================================================================================================================================
 Package                       Architecture               Version                              Repository                                         Size
=======================================================================================================================================================
Installing:
 yum-utils                     noarch                     4.3.0-11.el9_3                       rhel-9-for-x86_64-baseos-rpms                      45 k

Transaction Summary
=======================================================================================================================================================
Install  1 Package

Total download size: 45 k
Installed size: 23 k
Downloading Packages:
yum-utils-4.3.0-11.el9_3.noarch.rpm                                                                                    154 kB/s |  45 kB     00:00    
-------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                  153 kB/s |  45 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                               1/1 
  Installing       : yum-utils-4.3.0-11.el9_3.noarch                                                                                               1/1 
  Running scriptlet: yum-utils-4.3.0-11.el9_3.noarch                                                                                               1/1 
  Verifying        : yum-utils-4.3.0-11.el9_3.noarch                                                                                               1/1 
Installed products updated.

Installed:
  yum-utils-4.3.0-11.el9_3.noarch                                                                                                                      

Complete!
Backing up and removing old repository files...
An error occurred while attempting to switch this system to Oracle Linux and it may be in an unstable/unbootable state. To avoid further issues, the script has terminated.

Debug output:

# bash -x centos2ol.sh
+ set -e
+ unset CDPATH
+ yum_url=https://yum.oracle.com
+ github_url=https://github.com/oracle/centos2ol/
++ uname -m
+ arch=x86_64
+ bad_packages=(centos-backgrounds centos-gpg-keys centos-logos centos-release centos-release-cr desktop-backgrounds-basic centos-release-advanced-virtualization centos-release-ansible26 centos-release-ansible-27 centos-release-ansible-28 centos-release-ansible-29 centos-release-azure centos-release-ceph-jewel centos-release-ceph-luminous centos-release-ceph-nautilus centos-release-ceph-octopus centos-release-configmanagement centos-release-dotnet centos-release-fdio centos-release-gluster40 centos-release-gluster41 centos-release-gluster5 centos-release-gluster6 centos-release-gluster7 centos-release-gluster8 centos-release-gluster-legacy centos-release-messaging centos-release-nfs-ganesha28 centos-release-nfs-ganesha30 centos-release-nfv-common centos-release-nfv-openvswitch centos-release-openshift-origin centos-release-openstack-queens centos-release-openstack-rocky centos-release-openstack-stein centos-release-openstack-train centos-release-openstack-ussuri centos-release-opstools centos-release-ovirt42 centos-release-ovirt43 centos-release-ovirt44 centos-release-paas-common centos-release-qemu-ev centos-release-qpid-proton centos-release-rabbitmq-38 centos-release-samba411 centos-release-samba412 centos-release-scl centos-release-scl-rh centos-release-storage-common centos-release-virt-common centos-release-xen centos-release-xen-410 centos-release-xen-412 centos-release-xen-46 centos-release-xen-48 centos-release-xen-common libreport-centos libreport-plugin-mantisbt libreport-plugin-rhtsupport python3-syspurpose python-oauth rocky-backgrounds rocky-gpg-keys rocky-logos rocky-release sl-logos yum-rhn-plugin)
+ reinstall_all_rpms=false
+ verify_all_rpms=false
+ install_uek_kernel=true
+ getopts hrkV option
+ '[' x86_64 == aarch64 ']'
++ id -u
+ '[' 0 -ne 0 ']'
+ echo 'Checking for required packages...'
Checking for required packages...
+ for pkg in rpm yum curl
+ dep_check rpm
+ have_program rpm
+ hash rpm
+ for pkg in rpm yum curl
+ dep_check yum
+ have_program yum
+ hash yum
+ for pkg in rpm yum curl
+ dep_check curl
+ have_program curl
+ hash curl
+ echo 'Checking your distribution...'
Checking your distribution...
++ rpm -q --whatprovides /etc/redhat-release
+ old_release=redhat-release-9.3-0.5.el9.x86_64
++ echo redhat-release-9.3-0.5.el9.x86_64
++ wc -l
+ '[' 1 -ne 1 ']'
+ false
+ case "${old_release}" in
++ rpm -q redhat-release-9.3-0.5.el9.x86_64 --qf '%{version}'
+ os_version=9.3
+ major_os_version=9
+ true
+ base_packages=(basesystem initscripts oracle-logos kernel-uek)
+ case "$os_version" in
+ repo_file=public-yum-ol9.repo
+ new_releases=(oraclelinux-release oraclelinux-release-el9 redhat-release)
+ base_packages=("${base_packages[@]}" plymouth grub2 grubby)
+ packages_to_replace=(['epel-release']='oracle-epel-release-el9')
+ declare -A packages_to_replace
+ for package_name in "${!packages_to_replace[@]}"
+ rpm -q epel-release
package epel-release is not installed
+ echo 'Checking for yum lock...'
Checking for yum lock...
+ '[' -f /var/run/yum.pid ']'
+ echo 'Checking for required python packages...'
Checking for required python packages...
+ case "$os_version" in
+ dep_check /usr/libexec/platform-python
+ have_program /usr/libexec/platform-python
+ hash /usr/libexec/platform-python
+ [[ 9.3 =~ 8.* ]]
+ echo 'Finding your repository directory...'
Finding your repository directory...
+ case "$os_version" in
++ /usr/libexec/platform-python -c '
import dnf
import os

dir = dnf.Base().conf.get_reposdir
if os.path.isdir(dir):
    print(dir)
'
+ reposdir=/etc/yum.repos.d
+ echo 'Learning which repositories are enabled...'
Learning which repositories are enabled...
+ case "$os_version" in
++ /usr/libexec/platform-python -c '
import dnf

base = dnf.Base()
base.read_all_repos()
for repo in base.repos.iter_enabled():
  print(repo.id)
'
+ enabled_repos='rhel-9-for-x86_64-appstream-rpms
rhel-9-for-x86_64-baseos-rpms
ol9_baseos_latest
ol9_appstream
ol9_UEKR7'
+ echo -e 'Repositories enabled before update include:\nrhel-9-for-x86_64-appstream-rpms
rhel-9-for-x86_64-baseos-rpms
ol9_baseos_latest
ol9_appstream
ol9_UEKR7'
Repositories enabled before update include:
rhel-9-for-x86_64-appstream-rpms
rhel-9-for-x86_64-baseos-rpms
ol9_baseos_latest
ol9_appstream
ol9_UEKR7
+ '[' -z /etc/yum.repos.d ']'
+ cd /etc/yum.repos.d
+ case "$os_version" in
+ cat
+ '[' x86_64 == x86_64 ']'
+ cat
+ echo 'Looking for yumdownloader...'
Looking for yumdownloader...
+ have_program yumdownloader
+ hash yumdownloader
++ mktemp -d
+ cd /tmp/tmp.Y4DAldnuMx
+ trap final_failure ERR
+ [[ redhat-release-9.3-0.5.el9.x86_64 =~ ^centos-release-8.* ]]
+ [[ redhat-release-9.3-0.5.el9.x86_64 =~ ^centos-linux-release-8.* ]]
+ [[ redhat-release-9.3-0.5.el9.x86_64 =~ ^rocky-release-*.* ]]
+ echo 'Backing up and removing old repository files...'
Backing up and removing old repository files...
+ rpm -ql redhat-release-9.3-0.5.el9.x86_64
+ grep '\.repo$'
++ final_failure
++ echo 'An error occurred while attempting to switch this system to Oracle Linux and it may be in an unstable/unbootable state. To avoid further issues, the script has terminated.'
An error occurred while attempting to switch this system to Oracle Linux and it may be in an unstable/unbootable state. To avoid further issues, the script has terminated.
scoter-oracle commented 8 months ago

If you're trying to migrate from RHEL to OL you should follow steps public available at https://linux.oracle.com/switch/ . Let us know if it works or not. Thanks

digirave commented 8 months ago

@scoter-oracle

If you're trying to migrate from RHEL to OL you should follow steps public available at https://linux.oracle.com/switch/ . Let us know if it works or not. Thanks

It does not, because it requires an UNL subscription and account. It seems even a paid Oracle Cloud account can't use that step and can't even create a new UNL account.

scoter-oracle commented 8 months ago

So, the solution proposed here is to migrate CentOS (7 or 8) to the correspondent Oracle Linux release. That said, there's the solution to switch from RHN to ULN. It seems that your use-case is not covered by those two options; what I can do is to just suggest those steps (to see if those work):

  1. Disable RH Network Yum repositories by

# dnf config-manager --disable

  1. Download .repo file for OL9 with

# wget https://yum.oracle.com/mirror/ol9/x86_64/oracle-linux-ol9-x86_64.repo -O /etc/yum.repos.d/oracle-linux-ol9-x86_64.repo

  1. Download GPG keys for Oracle Linux Yum Server

# wget https://yum.oracle.com/RPM-GPG-KEY-oracle-ol9 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle # gpg --quiet --keyid-format 0xlong --with-fingerprint /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle

  1. Try to update your system with "dnf update --allowerasing"

On (2) you usually need to enable repositories like "ol9_baseos_latest" and "ol9_appstream". Please note that this is not an official process but just a suggestion on how you could get your system leveraging OL updates from yum.oracle.com website.

digirave commented 8 months ago

@scoter-oracle Just to be clear, can you give guidance on what commands should be used for or whether it is on by default: you usually need to enable repositories like "ol9_baseos_latest" and "ol9_appstream".

Thank you.

scoter-oracle commented 8 months ago

You can edit the /etc/yum.repos.d/oracle-linux-ol9-x86_64.repo file and enable the channels you need/want for OL9.

digirave commented 8 months ago

@scoter-oracle Thank you. Of note, I asked because in https://yum.oracle.com/mirror/ol9/x86_64/oracle-linux-ol9-x86_64.repo "ol9_baseos_latest" and "ol9_appstream" are enabled by default.

I do hope that Oracle officially supports migration from RHEL to Oracle Linux without a ULN subscripton in the future, because basicially even testing migration will require buying Oracle Linux subscription at this time, which will definitely hinder people from even testing. I do think the above works somewhat, but is only a partial conversion. For example it doesn't remove the RHEL subscription checks that run each time dnf is run which seems very bad.

digirave commented 8 months ago

Just a note to anyone looking for information:

scoter-oracle commented 8 months ago

Thanks for your feedback @digirave