Skip to content

CentOS Linux 8 to CentOS Stream 8 migration

As was recently announced, CentOS Linux 8 will reach end-of-life at the end of 2021 and all users should migrate to CentOS Stream 8 before then. Migration from C8 to CS8 is very simple, as it mostly entails changing repositories and upgrading packages.

Please find below the instructions for your particular setup:

Migration for unmanaged, standalone or locmap-managed machines

As root, run the following commands on the machine to migrate:

  1. dnf swap centos-linux-repos centos-stream-repos
  2. dnf distro-sync --disablerepo=openafs*
  3. dnf distro-sync
  4. reboot

After step 1, some repositories (such as the openafs ones, if used) may be inaccessible due to a missing DNF variable, which is why those repositories need to be disabled in step 2 (this means you may need to disable other repos if necessary).

Step 2 will change some repository configuration files, so the second distro-sync in step 3 is necessary to upgrade packages coming from those repositories as well.

The reboot is necessary to use the new kernel and it's associated modules.

Migration for CERN IT Puppet-managed machines (VMs or Ironic Bare Metal)

Before starting, it is strongly recommended that you create a new machine with a CS8 image in your hostgroup. This will allow you to verify that your Puppet catalog compiles correctly, that all your dependencies are met and that all functional tests for your service pass. Doing this will significantly improve your chances of a smooth migration.

Once that is complete, you have two migration options:

Create or Rebuild machines

You can use ai-bs to create new machines in your hostgroup:

$ ai-bs --cs8 -g foohostgroup fooname.cern.ch

Or you can use ai-rebuild to rebuild your existing machines:

$ ai-rebuild --cs8 fooname.cern.ch

In-place migration

Migration with no reinstall for CERN IT Puppet-managed machines was enabled by the changes in CRM-3981. Here are the steps to follow:

  1. Remove your machine(s) from production, you will be rebooting and your service will be impacted.
  2. In Hiera, set base::migrate::stream8: true for the machine/hostgroup you wish to upgrade.
  3. Run puppet agent -t on your machine(s) twice. This could be done with mco like this:
    $ mco puppet runonce --batch 100 --batch-sleep 60 -t 5 -T lxsoft -F hostgroup_0=lxsoft
    $ mco puppet status  --batch 100 --batch-sleep 60 -t 5 -T lxsoft -F hostgroup_0=lxsoft (repeat until all machines are "Currently idling")
    $ mco puppet runonce --batch 100 --batch-sleep 60 -t 5 -T lxsoft -F hostgroup_0=lxsoft
    
  4. Run systemctl start --wait dnf-distro-sync.service. With mco, this would be:
    $ mco shell run "systemctl start --wait dnf-distro-sync.service" --batch 100 --batch-sleep 60 -t 5 -T lxsoft -F hostgroup_0=lxsoft
    
  5. Reboot.
  6. Once you're happy, add your machine(s) back into production.

The first Puppet run is needed so Facter reports this machine as a CS8 machine to the Puppet servers, the second Puppet run is the one that actually configures the new repositories. Both of them must complete before running distro-sync.

Migration for non-IT Puppet-managed machines

Administrators of non-IT Puppet managed machines can look at the changes introduced in CRM-3981 for inspiration on what they need to do. In short, here is what is needed:

Puppet module changes

You will need to change your Puppet modules to account for the new distribution and new sets of repos. Detailed instructions are outside the scope of this guide, but you can use the following merge requests as inspiration:

Client changes

On the machines to upgrade:

  1. Replace the contents of /etc/redhat-release with CentOS Stream release 8. This will "trick" Facter into reporting that machine as a CS8 machine.
  2. Run puppet agent -t twice.
  3. Run dnf swap centos-linux-repos centos-stream-repos, otherwise the distro-sync won't be able to succeed.
  4. Run dnf distro-sync
  5. Reboot.