Centos 8 -> Centos Stream -> Rocky Linux

Hello,

After unexpected information about discontinuation of the Centos 8 development, I switched to the Centos Stream. I did not know about the Rocky Linux then.

Will it be possible to switch to the Rocky Linux from the Centos Stream?
or
Do I still have the option to switch back from Centos Stream to Centos 8?

Thank you in advance for your help.

1 Like

Hi, I have the same question. Thanks

Interested in this as well.

I am also interested in this.

DISCLAIMER I BY NO MEANS TAKE RESPONSIBILITY FOR YOUR SYSTEM. The instructions below are what worked for ME. I hope it is helpful to someone else.

I decided tonight to downgrade from CentOS 8 Stream → CentOS 8 Linux in preparation for transitioning over to Rocky. Below is how i did it and the problem(s) i ran into.

Inspiration:

Steps

  • Download repo and release RPMs
wget http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-linux-release-8.3-1.2011.el8.noarch.rpm
wget http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-linux-repos-8-2.el8.noarch.rpm
  • Remove stream repo and release RPMs and install the plain CentOS ones
sudo rpm -e --nodeps centos-stream-release centos-stream-repos
sudo rpm -ivh centos-linux-release-8.3-1.2011.el8.noarch.rpm centos-linux-repos-8-2.el8.noarch.rpm
  • Distrosync (i had to run with --allowerasing in order for it to run)
sudo yum distro-sync --allowerasing
  • Reboot
sudo reboot
  • When my system rebooted, i could no longer login. To fix this, i had to follow the Red Hat recovery procedure to boot into recovery mode and fix authselect that was broken for some reason: Chapter 15. Changing and resetting the root password Red Hat Enterprise Linux 8 | Red Hat Customer Portal

  • At GRUB 2 menu, edit the CentOS Linux 8 boot kernel (there will be some CentOS 8 Stream lines, ignore those)

  • In the GRUB 2 menu, go the line that starts with linux at the end add rd.break

  • When the system boots up, your root filesystem will be placed into /sysroot, we need to remount that from read-only to read-write

mount -o remount,rw /sysroot
  • Enter a chroot environment at /sysroot this will allow our CLI utilities to work properly
chroot /sysroot
  • Notice that passwd doesn’t work and /etc/nsswitch.conf is a broken symlink
$ passwd
Permission Denied
$ cat /etc/nsswitch.conf
File doesn't exist   # i'm paraphrasing here because i forget the exact error
  • Fix /etc/nsswitch.conf using authselect
# minimal sets up for reading from /etc/passwd and /etc/shadow only, no sssd daemon
authselect select minimal
  • Tell SELinux to relabel
touch /.autorelabel
  • Exit the chroot
exit
  • Exit (yes, exit) the recovery and this will continue the boot and relabel the filesystem properly
exit
  • System will reboot
  • If you were like me and have proprietary NVIDIA drivers, reinstall your NVIDIA drivers with the current kernel (in init 3 of course), reboot and all good!

AGAIN This is just what worked for me, your mileage may vary and i take no responsibility for any harm done or files lost if you try this on your own system.

-Nick

5 Likes

@ nmaludy

Many thanks for your help!
Unfortunately, I have already switched to Debian.

Thanks so much for your help.

I followed your steps and managed to switch one of my boxes from CentOS Stream back to CentOS Linux 8 successfully. I was lucky that I did not have the login issue as you had experienced so I did not have to do those last steps.

One note though that I had to update the link in the first wget from http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-linux-release-8.3-1.2011.el8.noarch.rpm to http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-linux-release-8.4-1.2105.el8.noarch.rpm
That’s the only change I made.

Once again thanks you, you have saved my day.

1 Like

Huge thank you for this post which pointed me in the correct direction for fixing a botched attempt at converting my NextCloud box from Centos 8 to Rocky Linux due to some issues with installed packages.

I resolved the package issues by using dnf update --allowerasing. I also had to add --releasever 8 as dnf was now complaining about not being able to determine the release version

I then rebooted but the conversion attempt left me with an unbootable server due to a missing grubx64.efi file. I managed to fix this by booting up a recovery console from the Rocky Linux DVD and then copying over the grubx64.efi from the one left in the /boot/efi/EFI/centos folder to the /boot/efi/EFI/rocky folder.
There was also a problem with SwitchRoot complaining about os-release being missing. I think I fixed this by copying the relevant file over from the Rocky installation DVD and setting the necessary symlinks up again.

Now with the system booting again, albeit I suspect in a sort of hybrid CentOS / Rocky Linux set up, I attempted to run the migrate2rocky script once more. The script now started complaining about being unable to determine the release version as well and would not complete.
At this point I started thinking how to get the system back to a vanilla CentOS 8 set up.
Your post helped me massively with this task.
The one main difference for me was that I also had to wget and install the centos-gpg-keys-8-2.el8.noarch.rpm file from the CentOS mirror before I could install the other 2 RPMs that you mentioned.

I was then able to run dnf distro-sync with no trouble at all. I then rebooted and ran the migrate2rocky script, this time it completed as expected. I rebooted again for good measure and I’m pleased to announce it looks as though the conversion has gone through perfectly!!

There are issues attempting to switch from CentOS stream 8 to any EL8, namely that versions of certain programs will end up going down and this can (and has been known to) cause some issues with compatibility with some configuration files.

Basically put when some programs get downgraded the older version of the program can no longer read the config file that was written by the newer version of the program, and that program may refuse to start or may appear to work but have other, hidden, undefined issues that will crop up later.

I am currently working on a solution that will allow migrate2rocky to work to migrate from CentOS stream 8 by keeping the newer versions of programs from CentOS stream until a new point release drops from RockyLinux and they can be safely upgraded, thus avoiding the issues with downgrading those programs.

2 Likes

@caletron , me too. I don’t have login issue and only needed to install the 8.4 release rpm.

  1. Download two RPMs

r1=http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-linux-release-8.4-1.2105.el8.noarch.rpm

wget $r1

r2=http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-linux-repos-8-2.el8.noarch.rpm

wget $r2

  1. remove existing centos-stream repos

sudo rpm -e --nodeps centos-stream-release centos-stream-repos

sudo rpm -ivh centos-linux-release-8.4-1.2105.el8.noarch.rpm centos-linux-repos-8-2.el8.noarch.rpm

  1. Distrosync (i had to run with --allowerasing in order for it to run)

sudo yum distro-sync --allowerasing -y

  1. reboot

sudo reboot

  1. end

IMHO, install from scratch should be a natural option. The same procedure that you would use if your system has fatal incident.

1 Like

That sounds very interesting @pajamian . Do you have any updates in the progress for Centos Stream → Rocky conversion?

I have a Stream VM that doesn’t work with the steps described here. My problem is

centos-gpg-keys are dependent on centos-linux-repos-8-2.el8.noarch.rpm is the issue.

Migrating it to Rocky would seem perfect :slight_smile:

CentOS Stream 8 to Rocky 8 conversion is supported now. What it does is leave the Stream 8 packages in place and leaves the repos for Stream 8 disabled. This means that those packages will not get updated until Rocky Linux moves to the next point release at which point they should get automatically replaced with the Rocky Linux packages on the next update. This avoids actually downgrading packages in the migration.

Thanks @pajamian
You mean it should work with this tool? GitHub - pajamian/rocky-tools

It looks like my bash version is too high for the conversion script:

bash >= 4.2 is required for this script.

I have v4.4 installed. Is there any way to solve it without downgrading bash?

So >= means higher than and equal to 4.2 which means 4.4 is ok since its higher than 4.2. So should be fine.

Sorry, yes …

Will try the converter now

Seems to have worked just fine. Thanks!

How can i safe migrate form Centos to Rocky?
Is it 100% working?
Can I risk on working 24/7 machine? Is it safe?
I can’t stop machine and try many different rules, manulay mounting, manualy change many files for migrate - isn’t possible for this moment.
I can’t risk that something will be wrong and machine past reboot don’t more wake up.

Actualy:

yum repolist

identyfikator repozytorium nazwa repozytorium
appstream CentOS Linux 8 - AppStream
baseos CentOS Linux 8 - BaseOS
epel Extra Packages for Enterprise Linux 8 - x86_64
epel-modular Extra Packages for Enterprise Linux Modular 8 - x86_64
extras CentOS Linux 8 - Extras

cat /etc/*-release

CentOS Linux release 8.3.2011
NAME=“CentOS Linux”
VERSION=“8”
ID=“centos”
ID_LIKE=“rhel fedora”
VERSION_ID=“8”
PLATFORM_ID=“platform:el8”
PRETTY_NAME=“CentOS Linux 8”
ANSI_COLOR=“0;31”
CPE_NAME=“cpe:/o:centos:centos:8”
HOME_URL=“https://centos.org/
BUG_REPORT_URL=“https://bugs.centos.org/
CENTOS_MANTISBT_PROJECT=“CentOS-8”
CENTOS_MANTISBT_PROJECT_VERSION=“8”
CentOS Linux release 8.3.2011
CentOS Linux release 8.3.2011

grep -rH enabled=1 /etc/yum.repos.d/*

/etc/yum.repos.d/CentOS-Linux-AppStream.repo:enabled=1
/etc/yum.repos.d/CentOS-Linux-BaseOS.repo:enabled=1
/etc/yum.repos.d/CentOS-Linux-Extras.repo:enabled=1
/etc/yum.repos.d/epel-modular.repo:enabled=1
/etc/yum.repos.d/epel.repo:enabled=1

rpm -q bash

bash-4.4.19-12.el8.x86_64

How can I safe migrate in ~20min to Rocky?
This machine is critical working and can’t stop longer.
Is it possible or only in my dream?

I used the howto here which worked for me, but mind you don’t do anything daft™…
The only caveat I would add would be to add the --allowerasing switch to dnf dsync, though I wouldn’t add -y but instead interrogate carefully anything that is to be erased.
Thanks