Tag Archives: centos

Convert to RHEL from CentOS using Convert2RHEL

Hi everyone – It’s been a while since my last post and basically my situation is the following ben using CentOS 7 for a while at home and at some point on 2020 I did upgrade to CentOS 8 which probably I should have done a post about it is a more complex activity but well, I didn’t (yet).

Given the recent news of CentOS not following their standard cadence and moving away from what enterprise Linux is to CentOS Stream, you might want to move some workloads from CentOS to something with long-term support.

As you might know if you’re here, that includes Oracle Linux and the upcoming Rocky Linux (which first release is expected by end of March 2021) for some sort of easy conversion without re-deployment. Ubuntu is also trying to push new users towards their platform but that’s a bigger leap, specially for enterprise or to users that are not familiar with Debian derivatives.

Before doing any of this, please have the following considerations:

  • Convert2RHEL is currently unsupported by Red Hat;
  • Conversion on UEFI systems is not officially supported as there is an open bug on it, but I do address how to prevent (or how to fix) the issue below.
  • This should work on CentOS 6 as well, but this is something I did not test and as it is EOL, I won’t address it here.
  • Having a working backup of the server and that you have the means to restore it. Personally, I use ESXi so I’ll just take an snapshot;
  • Having a valid Red Hat subscriptions. You can obtain a free one thru the developer program here. They offer 16 VM’s which should be sufficient for most of home lab environments.
  • Perform a yum/dnf update to latest version before starting.
For CentOS 8:
# dnf install -y https://github.com/oamg/convert2rhel/releases/download/v0.17/convert2rhel-0.17-1.el8.noarch.rpm

For CentOS 7:
# dnf install -y https://github.com/oamg/convert2rhel/releases/download/v0.17/convert2rhel-0.17-1.el7.noarch.rpm

Initialize conversion:
# convert2rhel --username your_RHSM_account

At this point you’ll be asked to accept the EULA and to confirm a few times about moving forward with the conversion until you’re asked about your RHSM information and you need to select the subscription number which you want to utilize for this (it means the number on top of the subscription information, this is not the pool id!).

Once the conversion finishes, DO NOT REBOOT if you are on a UEFI system, as you’ll likely encounter (at the time of writing) the bug #1898314. (If you got to this article because you got an issue booting after it and landing on grub, don’t worry, I got you.)

If you didn’t reboot, great! You are in time to fix grub and be on your way to boot your system properly.

Step 1: Generate a grub2-mkconfig by doing

# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

 

Step 2: Delete the CentOS entry from efibootmgr

# efibootmgr -v

 

Now we need to delete the entry for CentOS Linux, in this case Boot004. You need to know the boot disk and partition (/boot/efi) for the following steps. (In my case it is on /dev/sda1). Change the release to 7 or 8 depending on what OS you use.

# efibootmgr -Bb 0003
# efibootmgr -c -d /dev/sda -p 1 -l \\EFI\redhat\shimx64.efi -L "Red Hat Enterprise Linux <version>"

At this point you should be having a working environment! Congratulations.

But if you did the same mistake I did… and here we are and rebooted right away after the conversion to find a grub> screen, this is because UEFI conversions are not supported. Basically you have two choices at this point:

  1. Fix it;
  2. Go back to snapshot/backup and re-do it.

If you go for the fix it way, you’ll need a CentOS or Red Hat disk/ISO and go to recovery mode. Once you are chrooted into /sysroot, you can go back to step 1 on how to fix it before rebooting and get it done. Once you’re done, exit the chroot environment and recovery mode and you should be able to login to your Red Hat installation if your upgrade was successful.

Personally I have done few of this upgrades and I haven’t encountered any major issue. Feel free to comment on your own experiences or ask any question below on the comment section.

Good luck!

Reference: redhat.com