Centos 8 -> Centos Stream -> Rocky Linux

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