The Oracle conversion script to convert CentOS to Oracle Linux, and an alternative

As mentioned in my previous post there is a script supplied to convert CentOS systems to Oracle Linux, available at https://github.com/oracle/centos2ol. As mentioned in that post it is not safe to use at the currect time.

At the end of this post I will list steps that have worked for me that you should use in preference to this script. It’s at the end as this post is primarily on why not to use the supplied conversion script.

Obviously as Oracle Linux relies on RedHat continuing to follow the software license guidelines and make available all the sources they modify it can only be hoped they continue to do so to ensure Oracle Linux remains a viable alternative to CentOS. However as the RedHat announcement makes CentOS unsafe for production work any more Oracle Linux is the currently available free alternative that requires the least conversion work.

As of 26 December 2020 using that script on a fresh centOS8 install from CentOS-8-x86_64-1905-dvd1.iso results in the below.

The error that stopped the converted system booting after the conversion script was run was

Failed to switch root: Specified switch root path '/sysroot' does not seem to be an OS tree. os-release file is missing.

So I built a new CentOS8 KVM instance as a bare server install. Prior to running the conversion script

[mark@c8toOL8-test etc]$ cat os-release
NAME="CentOS Linux"
VERSION="8 (Core)" 
ID="centos"
ID_LIKE="rhel fedora" 
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8 (Core)" 
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="8"

[mark@c8toOL8-test etc]$ ls -la *release
-rw-r--r--. 1 root root  38 Aug 14  2019 centos-release
-rw-r--r--. 1 root root 420 Aug 14  2019 os-release
lrwxrwxrwx. 1 root root  14 Aug 14  2019 redhat-release -> centos-release
lrwxrwxrwx. 1 root root  14 Aug 14  2019 system-release -> centos-release
[mark@c8toOL8-test etc]$

[mark@c8toOL8-test etc]$ ls /etc/yum.repos.d
CentOS-AppStream.repo   CentOS-CR.repo         CentOS-fasttrack.repo   CentOS-Sources.repo
CentOS-Base.repo        CentOS-Debuginfo.repo  CentOS-Media.repo       CentOS-Vault.repo
CentOS-centosplus.repo  CentOS-Extras.repo     CentOS-PowerTools.repo
[mark@c8toOL8-test etc]$

After running the supplied conversion script we are left with

[root@c8toOL8-test centos2ol]# cd /etc
[root@c8toOL8-test etc]# cat os-release
cat: os-release: No such file or directory
[root@c8toOL8-test etc]# ls *release
ls: cannot access '*release': No such file or directory
[root@c8toOL8-test etc]# ls /etc/yum.repos.d
switch-to-oraclelinux.repo

So the conversion script seems to get only part of the way through, far enough
to wipe out CentOS but not far enough to make OL usable.

So do not use the oracle conversion script.

This does not mean that the script may not become usable at some future point, it is just not safe to use at present.

Unrelated information

On a fresh Oracle Linux 8 install these are the files created

[mark@oracle8-freshinstall etc]$ cat os-release
NAME="Oracle Linux Server"
VERSION="8.3"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="8.3"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Oracle Linux Server 8.3"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:8:3:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 8"
ORACLE_BUGZILLA_PRODUCT_VERSION=8.3
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=8.3

[mark@oracle8-freshinstall etc]$ ls -la *release
-rw-r--r--. 1 root root  32 Nov  5 12:58 oracle-release
-rw-r--r--. 1 root root 479 Nov  5 12:58 os-release
-rw-r--r--. 1 root root  45 Nov  5 12:58 redhat-release
lrwxrwxrwx. 1 root root  14 Nov  5 12:58 system-release -> oracle-release
[mark@oracle8-freshinstall etc]$ 

[mark@oracle8-freshinstall etc]$ ls /etc/yum.repos.d
oracle-linux-ol8.repo  uek-ol8.repo

An alternative upgrade method that seems to work

This method was suggested in a response to the origional CentOS moving to be stream only post at https://blog.centos.org/2020/12/future-is-centos-stream/ by commenter “Phil”. I have edited it to what works for me (which was basically correcting ‘centos-release’ and highlighting the importance of needing yum-utils installed before disabling the centos repositories; plus the reset module step I needed to use.

setenforce 0
dnf -y install yum-utils       # <---- this MUST be installed
repobase=http://yum.oracle.com/repo/OracleLinux/OL8/baseos/latest/x86_64/getPackage
wget \
  ${repobase}/redhat-release-8.3-1.0.0.1.el8.x86_64.rpm \
  ${repobase}/oracle-release-el8-1.0-1.el8.x86_64.rpm \
  ${repobase}/oraclelinux-release-8.3-1.0.4.el8.x86_64.rpm \
  ${repobase}/oraclelinux-release-el8-1.0-9.el8.x86_64.rpm

rpm -e centos-release --nodeps
dnf --disablerepo='*' localinstall ./*rpm
:> /etc/dnf/vars/ociregion
dnf remove centos-linux-repos
dnf --refresh distro-sync --allowerasing --nobest

The last dnf command results in

[root@oracle8 ~]# dnf --refresh distro-sync --allowerasing --nobest
Oracle Linux 8 BaseOS Latest (x86_64)                                                                                                            28 kB/s | 2.7 kB     00:00    
Oracle Linux 8 Application Stream (x86_64)                                                                                                       36 kB/s | 3.1 kB     00:00    
Oracle Instant Client for Oracle Linux 8 (x86_64)                                                                                                28 kB/s | 2.5 kB     00:00    
Latest Unbreakable Enterprise Kernel Release 6 for Oracle Linux 8 (x86_64)                                                                       26 kB/s | 2.5 kB     00:00    
Dependencies resolved.
The operation would result in switching of module 'llvm-toolset' stream 'rhel8' to stream 'ol8'
Error: It is not possible to switch enabled streams of a module.
It is recommended to remove all installed content from the module, and reset the module using 'dnf module reset ' command. After you reset the module, you can install the other stream.

Easily fixed with

[root@oracle8 ~]# dnf module reset llvm-toolset
Last metadata expiration check: 0:01:22 ago on Sat 26 Dec 2020 11:41:27 NZDT.
Dependencies resolved.
================================================================================================================================================================================
 Package                                   Architecture                             Version                                     Repository                                 Size
================================================================================================================================================================================
Resetting modules:
 llvm-toolset                                                                                                                                                                  
Transaction Summary
================================================================================================================================================================================
Is this ok [y/N]: y
Complete!

After which rerunning the “dnf –refresh distro-sync –allowerasing –nobest” works.

There was one failure

Failed:
  pcp-webapi-4.3.0-3.el8.x86_64 

This left “package-cleanup –problems” reporting problems for that; resolved with “rpm -e pcp pcp-webapi pcp-mnager –nopreun” (noreun was required as the pre-uninstall script kept erroring).

“package-cleanup –orphans” showed quite a few entries, these are packages installed that are not available from the configured repositories; and included things like buildah and podman that certainly should be.

“dnf autoremove” also listed a few packages I would want to keep as available for removal.

The supprising issue was that “shutdown -r now” refused to shutdown, “init 6” has no effect. Neither did “halt” or “reboot”; too many interface changes ?. I had to trigger a ‘force-off’ poweroff from the virt-manager interface and start the KVM again from there. However after that first forced restart reboots were behaving normally again.

So that would be my recomended upgrade path, not the script on github.

Future posts planned

While conversion to Oracle Linux is the least disruptive as far as compatibility goes, I will also be looking at getting tools like docker-ce, puppet-agent, bacula-client etc running on Debian; which if successful may result in a lot less rhel based posts here and a lot more debian based ones.

About mark

At work, been working on Tandems for around 30yrs (programming + sysadmin), plus AIX and Solaris sysadmin also thrown in during the last 20yrs; also about 5yrs on MVS (mainly operations and automation but also smp/e work). At home I have been using linux for decades. Programming background is commercially in TAL/COBOL/SCOBOL/C(Tandem); 370 assembler(MVS); C, perl and shell scripting in *nix; and Microsoft Macro Assembler(windows).
This entry was posted in Unix. Bookmark the permalink.