How to upgrade to CentOS Stream 9 from CentOS Stream 8

Author:

This article will show how to update to CentOS Stream 9 from CentOS Stream 8.

main menu
grub entries

If only official repositories are used it is fairly easy to upgrade to the new rolling based CentOS Stream 9 release, which follows the Red Hat Enterprise Linux 9. Using unofficial or users’ repositories CentOS Stream 8 may lead to unstable system or break user’s system following this tutorial. First, check out for CentOS Stream 9 compatibility issues the currently installed repositories if some specific or unofficial are used.
The following article uses a CentOS Stream 9 with only the official default repositories and in addition, the EPEL repository, which has a CentOS Stream 9 support.
How to install – Network installation of CentOS Stream 9 (20220606.0) – minimal server installation with additional information about important CentOS Stream 9 URLs and links and what kind of software the user can expect to have Software and technical details of CentOS Stream 9 minimal install. Camparing the packages of the two systems – a clean install of CentOS Stream 9 and an upgrade from CentOS Stream 8, the clean install has 377 packages installed and the upgrade has 387 packages installed. The strated processes are the same except the chronyd service is not started on boot. chronyd daemon offers a time synchronization.

STEP 1) All installed packages should be updated to the latest versions.

[root@srv ~]# dnf update -y
Last metadata expiration check: 0:09:08 ago on Tue Oct  4 12:12:07 2022.
Dependencies resolved.
Nothing to do.
Complete!

The DNF tool reports that all packages are up-to-date, because there is nothing to upgrade.

STEP 2) A cleanup of all packages, which are not required anymore.

Check orphan and leaves packages. Some of the packages here may be used by the user explicitly, so it is important to know the system. Remove the packages if not used by the system and they are showed as an output of the following commands and they are not used by the user of the system.

[root@srv ~]# dnf repoquery --unneeded
Last metadata expiration check: 0:12:56 ago on Tue Oct  4 12:12:07 2022.
NetworkManager-initscripts-updown-1:1.40.0-1.el8.noarch
grub2-tools-efi-1:2.02-129.el8.x86_64
libmetalink-0:0.1.3-7.el8.x86_64
pciutils-0:3.7.0-1.el8.x86_64
python3-configobj-0:5.0.6-11.el8.noarch
python3-schedutils-0:0.6-6.el8.x86_64
rdma-core-0:41.0-1.el8.x86_64
[root@srv ~]# dnf repoquery --extras
Last metadata expiration check: 0:00:12 ago on Tue Oct  4 12:34:17 2022.

Remove the unneeded packages:

[root@srv ~]# dnf remove -y NetworkManager-initscripts-updown-1:1.40.0-1.el8.noarch grub2-tools-efi-1:2.02-129.el8.x86_64  libmetalink-0:0.1.3-7.el8.x86_64 pciutils-0:3.7.0-1.el8.x86_64 python3-configobj-0:5.0.6-11.el8.noarch python3-schedutils-0:0.6-6.el8.x86_64 rdma-core-0:41.0-1.el8.x86_64
Dependencies resolved.
=========================================================================================
 Package                               Arch       Version            Repository     Size
=========================================================================================
Removing:
 NetworkManager-initscripts-updown     noarch     1:1.40.0-1.el8     @baseos       2.1 k
 grub2-tools-efi                       x86_64     1:2.02-129.el8     @baseos       2.0 M
 libmetalink                           x86_64     0.1.3-7.el8        @anaconda      75 k
 pciutils                              x86_64     3.7.0-1.el8        @anaconda     211 k
 python3-configobj                     noarch     5.0.6-11.el8       @anaconda     342 k
 python3-schedutils                    x86_64     0.6-6.el8          @anaconda      46 k
 rdma-core                             x86_64     41.0-1.el8         @baseos       103 k

Transaction Summary
=========================================================================================
Remove  7 Packages

Freed space: 2.8 M
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                 1/1 
  Running scriptlet: python3-configobj-5.0.6-11.el8.noarch                           1/1 
  Erasing          : python3-configobj-5.0.6-11.el8.noarch                           1/7 
  Running scriptlet: NetworkManager-initscripts-updown-1:1.40.0-1.el8.noarch         2/7 
  Erasing          : NetworkManager-initscripts-updown-1:1.40.0-1.el8.noarch         2/7 
  Erasing          : rdma-core-41.0-1.el8.x86_64                                     3/7 
  Running scriptlet: rdma-core-41.0-1.el8.x86_64                                     3/7 
  Erasing          : pciutils-3.7.0-1.el8.x86_64                                     4/7 
  Erasing          : python3-schedutils-0.6-6.el8.x86_64                             5/7 
  Erasing          : libmetalink-0.1.3-7.el8.x86_64                                  6/7 
  Erasing          : grub2-tools-efi-1:2.02-129.el8.x86_64                           7/7 
  Running scriptlet: grub2-tools-efi-1:2.02-129.el8.x86_64                           7/7 
  Verifying        : NetworkManager-initscripts-updown-1:1.40.0-1.el8.noarch         1/7 
  Verifying        : grub2-tools-efi-1:2.02-129.el8.x86_64                           2/7 
  Verifying        : libmetalink-0.1.3-7.el8.x86_64                                  3/7 
  Verifying        : pciutils-3.7.0-1.el8.x86_64                                     4/7 
  Verifying        : python3-configobj-5.0.6-11.el8.noarch                           5/7 
  Verifying        : python3-schedutils-0.6-6.el8.x86_64                             6/7 
  Verifying        : rdma-core-41.0-1.el8.x86_64                                     7/7 

Removed:
  NetworkManager-initscripts-updown-1:1.40.0-1.el8.noarch                                
  grub2-tools-efi-1:2.02-129.el8.x86_64                                                  
  libmetalink-0.1.3-7.el8.x86_64                                                         
  pciutils-3.7.0-1.el8.x86_64                                                            
  python3-configobj-5.0.6-11.el8.noarch                                                  
  python3-schedutils-0.6-6.el8.x86_64                                                    
  rdma-core-41.0-1.el8.x86_64                                                            

Complete!

In fact, some of the above packages may be left on the system, but it is better to remove them and if they are needed to be installed after the upgrade.

STEP 3)Install the CentOS Stream 9 repositories.

Three files should be installed:

  1. http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/centos-stream-repos-9.0-18.el9.noarch.rpm
  2. http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/centos-stream-release-9.0-18.el9.noarch.rpm
  3. http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/centos-gpg-keys-9.0-18.el9.noarch.rpm

These are the latest version at the time of writing this article. Check the URL http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/ for newer versions.

main menu
The CentOS Stream 9 repository RPMs.

[root@srv ~]# dnf install -y http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/centos-stream-repos-9.0-18.el9.noarch.rpm http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/centos-stream-release-9.0-18.el9.noarch.rpm http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/centos-gpg-keys-9.0-18.el9.noarch.rpm
Last metadata expiration check: 0:01:37 ago on Tue Oct  4 12:59:52 2022.
centos-stream-repos-9.0-18.el9.noarch.rpm                 47 kB/s |  12 kB     00:00    
centos-stream-release-9.0-18.el9.noarch.rpm               92 kB/s |  26 kB     00:00    
centos-gpg-keys-9.0-18.el9.noarch.rpm                     77 kB/s |  15 kB     00:00    
Dependencies resolved.
=========================================================================================
 Package                      Architecture  Version            Repository           Size
=========================================================================================
Upgrading:
 centos-stream-release        noarch        9.0-18.el9         @commandline         26 k
 centos-stream-repos          noarch        9.0-18.el9         @commandline         12 k
Downgrading:
 centos-gpg-keys              noarch        9.0-18.el9         @commandline         15 k

Transaction Summary
=========================================================================================
Upgrade    2 Packages
Downgrade  1 Package

Total size: 53 k
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                 1/1 
  Running scriptlet: centos-gpg-keys-9.0-18.el9.noarch                               1/1 
  Downgrading      : centos-gpg-keys-9.0-18.el9.noarch                               1/6 
  Upgrading        : centos-stream-repos-9.0-18.el9.noarch                           2/6 
  Upgrading        : centos-stream-release-9.0-18.el9.noarch                         3/6 
  Cleanup          : centos-stream-release-8.6-1.el8.noarch                          4/6 
  Cleanup          : centos-stream-repos-8-6.el8.noarch                              5/6 
  Cleanup          : centos-gpg-keys-1:8-6.el8.noarch                                6/6 
  Running scriptlet: centos-gpg-keys-1:8-6.el8.noarch                                6/6 
Line is not an assignment at '/usr/lib/sysctl.d/50-redhat.conf:7': (null)
Couldn't write '1' to 'net/ipv4/conf/*/rp_filter', ignoring: No such file or directory
warning: %transfiletriggerin(systemd-239-67.el8.x86_64) scriptlet failed, exit status 1

Error in <unknown> scriptlet in rpm package centos-gpg-keys
  Verifying        : centos-gpg-keys-9.0-18.el9.noarch                               1/6 
  Verifying        : centos-gpg-keys-1:8-6.el8.noarch                                2/6 
  Verifying        : centos-stream-repos-9.0-18.el9.noarch                           3/6 
  Verifying        : centos-stream-repos-8-6.el8.noarch                              4/6 
  Verifying        : centos-stream-release-9.0-18.el9.noarch                         5/6 
  Verifying        : centos-stream-release-8.6-1.el8.noarch                          6/6 

Upgraded:
  centos-stream-release-9.0-18.el9.noarch      centos-stream-repos-9.0-18.el9.noarch     
Downgraded:
  centos-gpg-keys-9.0-18.el9.noarch                                                      

Complete!

Upgrade the distro with

[root@srv ~]# dnf -y --releasever=9-stream --allowerasing --setopt=deltarpm=false distro-sync
CentOS Stream 9-stream - BaseOS                          1.8 MB/s | 5.9 MB     00:03    
CentOS Stream 9-stream - AppStream                       3.2 MB/s |  15 MB     00:04    
CentOS Stream 9-stream - Extras packages                 7.2 kB/s | 8.7 kB     00:01    
Extra Packages for Enterprise Linux 8 - x86_64           2.3 MB/s |  13 MB     00:05    
Extra Packages for Enterprise Linux Modular 8 - x86_64   596 kB/s | 733 kB     00:01    
Extra Packages for Enterprise Linux 8 - Next - x86_64    2.0 MB/s | 1.4 MB     00:00    
Dependencies resolved.
=========================================================================================
 Package                       Arch   Version                        Repository     Size
=========================================================================================
Installing:
 kernel                        x86_64 5.14.0-171.el9                 baseos        1.9 M
 kernel-core                   x86_64 5.14.0-171.el9                 baseos         46 M
 kernel-modules                x86_64 5.14.0-171.el9                 baseos         34 M
Upgrading:
 NetworkManager                x86_64 1:1.40.0-1.el9                 baseos        2.2 M
 NetworkManager-libnm          x86_64 1:1.40.0-1.el9                 baseos        1.7 M
 NetworkManager-team           x86_64 1:1.40.0-1.el9                 baseos         36 k
 NetworkManager-tui            x86_64 1:1.40.0-1.el9                 baseos        231 k
 acl                           x86_64 2.3.1-3.el9                    baseos         73 k
 audit                         x86_64 3.0.7-103.el9                  baseos        272 k
 audit-libs                    x86_64 3.0.7-103.el9                  baseos        118 k
 authselect                    x86_64 1.2.5-1.el9                    baseos        144 k
 authselect-libs               x86_64 1.2.5-1.el9                    baseos        243 k
 basesystem                    noarch 11-13.el9                      baseos        3.9 k
 bash                          x86_64 5.1.8-5.el9                    baseos        1.7 M
 biosdevname                   x86_64 0.7.3-9.el9                    baseos         36 k
......
......
 subscription-manager          x86_64 1.29.30-1.el9                  baseos        900 k
     replacing  python3-syspurpose.x86_64 1.28.28-1.el8
 subscription-manager-rhsm-certificates
                               noarch 20220623-1.el9                 baseos         21 k
 systemd-rpm-macros            noarch 250-11.el9                     baseos         43 k
 usermode                      x86_64 1.114-4.el9                    baseos        190 k
 userspace-rcu                 x86_64 0.12.1-6.el9                   baseos        110 k
 util-linux-core               x86_64 2.37.4-9.el9                   baseos        461 k
     replacing  hardlink.x86_64 1:1.3-6.el8
Installing weak dependencies:
 gawk-all-langpacks            x86_64 5.1.0-6.el9                    appstream     207 k
 libcap-ng-python3             x86_64 0.8.2-7.el9                    appstream      30 k
 libxcrypt-compat              x86_64 4.4.18-3.el9                   appstream      89 k
 python-unversioned-command    noarch 3.9.14-1.el9                   appstream      12 k
 rsyslog-logrotate             x86_64 8.2102.0-105.el9               appstream      12 k
 zstd                          x86_64 1.5.1-2.el9                    baseos        548 k
Removing:
 kernel                        x86_64 4.18.0-338.el8                 @baseos         0  
 kernel-core                   x86_64 4.18.0-338.el8                 @baseos        68 M
 kernel-modules                x86_64 4.18.0-338.el8                 @baseos        22 M
Removing dependent packages:
 gdbm                          x86_64 1:1.18-2.el8                   @baseos       381 k
 python3-slip                  noarch 0.6.4-13.el8                   @baseos        60 k
 python3-slip-dbus             noarch 0.6.4-13.el8                   @baseos        70 k
Downgrading:
 ethtool                       x86_64 2:5.10-4.el9                   baseos        212 k
 libldb                        x86_64 2.5.2-1.el9                    baseos        187 k
 libtalloc                     x86_64 2.3.3-1.el9                    baseos         32 k
 linux-firmware                noarch 20220708-127.el9               baseos        233 M
 memstrack                     x86_64 0.2.4-1.el9                    appstream      50 k

Transaction Summary
=========================================================================================
Install     53 Packages
Upgrade    333 Packages
Remove       6 Packages
Downgrade    5 Packages

Total download size: 530 M
Downloading Packages:
(1/391): libtalloc-2.3.3-1.el9.x86_64.rpm                 38 kB/s |  32 kB     00:00    
......
......
(391/391): linux-firmware-20220708-127.el9.noarch.rpm    956 kB/s | 233 MB     04:09    
-----------------------------------------------------------------------------------------
Total                                                    2.1 MB/s | 530 MB     04:14     
CentOS Stream 9-stream - Extras packages                 2.1 MB/s | 2.1 kB     00:00    
Importing GPG key 0x1D997668:
 Userid     : "CentOS Extras SIG (https://wiki.centos.org/SpecialInterestGroup) <security@centos.org>"
 Fingerprint: 363F C097 2F64 B699 AED3 968E 1FF6 A217 1D99 7668
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Running scriptlet: filesystem-3.16-2.el9.x86_64                                    1/1 
  Running scriptlet: selinux-policy-targeted-34.1.43-1.el9.noarch                    1/1 
  Running scriptlet: firewalld-1.0.0-2.el9.noarch                                    1/1 
  Preparing        :                                                                 1/1 
  Running scriptlet: libgcc-11.3.1-2.1.el9.x86_64                                    1/1 
  Upgrading        : libgcc-11.3.1-2.1.el9.x86_64                                  1/742 
  Running scriptlet: libgcc-11.3.1-2.1.el9.x86_64                                  1/742 
  Installing       : linux-firmware-whence-20220708-127.el9.noarch                 2/742 
  Upgrading        : crypto-policies-20220815-1.git0fbe86f.el9.noarch              3/742 
  Running scriptlet: crypto-policies-20220815-1.git0fbe86f.el9.noarch              3/742 
  Upgrading        : setup-2.13.7-7.el9.noarch                                     4/742 
warning: /etc/shadow created as /etc/shadow.rpmnew

  Running scriptlet: setup-2.13.7-7.el9.noarch                                     4/742 
.......
.......
  util-linux-core-2.37.4-9.el9.x86_64                                                    
  zstd-1.5.1-2.el9.x86_64                                                                
Removed:
  gdbm-1:1.18-2.el8.x86_64                  kernel-4.18.0-338.el8.x86_64                 
  kernel-core-4.18.0-338.el8.x86_64         kernel-modules-4.18.0-338.el8.x86_64         
  python3-slip-0.6.4-13.el8.noarch          python3-slip-dbus-0.6.4-13.el8.noarch        

Complete!

Rebuild the RPM database.

[root@srv ~]# rpmdb --rebuilddb
warning: Converting database from bdb_ro to sqlite backend
[root@srv ~]#

Clean DNF cache:

[root@srv ~]# dnf clean packages
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

0 files removed

Issue the update command again:

[root@srv ~]# dnf update -y
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 3:28:41 ago on Tue Oct  4 13:32:49 2022.
Dependencies resolved.
=========================================================================================
 Package                          Architecture  Version              Repository     Size
=========================================================================================
Upgrading:
 epel-next-release                noarch        9-4.el9              epel          8.2 k
 epel-release                     noarch        9-4.el9              epel           18 k
 initscripts                      x86_64        10.11.5-1.el9        baseos        230 k
 initscripts-service              noarch        10.11.5-1.el9        baseos         14 k
 trousers                         x86_64        0.3.15-5.el9         epel          144 k
 trousers-lib                     x86_64        0.3.15-5.el9         epel          165 k
Installing dependencies:
 initscripts-rename-device        x86_64        10.11.5-1.el9        baseos         17 k

Transaction Summary
=========================================================================================
Install  1 Package
Upgrade  6 Packages

Total size: 598 k
Total download size: 581 k
Downloading Packages:
[SKIPPED] initscripts-rename-device-10.11.5-1.el9.x86_64.rpm: Already downloaded        
(2/7): epel-next-release-9-4.el9.noarch.rpm               41 kB/s | 8.2 kB     00:00    
(3/7): epel-release-9-4.el9.noarch.rpm                   838 kB/s |  18 kB     00:00    
(4/7): initscripts-service-10.11.5-1.el9.noarch.rpm       46 kB/s |  14 kB     00:00    
(5/7): trousers-0.3.15-5.el9.x86_64.rpm                  1.5 MB/s | 144 kB     00:00    
(6/7): trousers-lib-0.3.15-5.el9.x86_64.rpm              1.5 MB/s | 165 kB     00:00    
(7/7): initscripts-10.11.5-1.el9.x86_64.rpm              349 kB/s | 230 kB     00:00    
-----------------------------------------------------------------------------------------
Total                                                    222 kB/s | 581 kB     00:02     
Extra Packages for Enterprise Linux 9 - x86_64           1.6 MB/s | 1.6 kB     00:00    
Importing GPG key 0x3228467C:
 Userid     : "Fedora (epel9) <epel@fedoraproject.org>"
 Fingerprint: FF8A D134 4597 106E CE81 3B91 8A38 72BF 3228 467C
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                 1/1 
  Upgrading        : epel-release-9-4.el9.noarch                                    1/13 
warning: Unable to get systemd shutdown inhibition lock: Failed to activate service 'org.freedesktop.login1': timed out (service_start_timeout=25000ms)

  Running scriptlet: epel-release-9-4.el9.noarch                                    1/13 
  Upgrading        : epel-next-release-9-4.el9.noarch                               2/13 
  Upgrading        : trousers-lib-0.3.15-5.el9.x86_64                               3/13 
  Upgrading        : initscripts-service-10.11.5-1.el9.noarch                       4/13 
  Installing       : initscripts-rename-device-10.11.5-1.el9.x86_64                 5/13 
  Upgrading        : initscripts-10.11.5-1.el9.x86_64                               6/13 
  Running scriptlet: initscripts-10.11.5-1.el9.x86_64                               6/13 
  Running scriptlet: trousers-0.3.15-5.el9.x86_64                                   7/13 
  Upgrading        : trousers-0.3.15-5.el9.x86_64                                   7/13 
  Running scriptlet: trousers-0.3.15-5.el9.x86_64                                   7/13 
  Cleanup          : epel-next-release-9-2.el9.noarch                               8/13 
  Running scriptlet: trousers-0.3.15-1.el8.x86_64                                   9/13 
  Cleanup          : trousers-0.3.15-1.el8.x86_64                                   9/13 
  Running scriptlet: trousers-0.3.15-1.el8.x86_64                                   9/13 
  Running scriptlet: initscripts-10.11.2-1.el9.x86_64                              10/13 
  Cleanup          : initscripts-10.11.2-1.el9.x86_64                              10/13 
  Running scriptlet: initscripts-10.11.2-1.el9.x86_64                              10/13 
  Cleanup          : initscripts-service-10.11.2-1.el9.noarch                      11/13 
  Cleanup          : epel-release-9-2.el9.noarch                                   12/13 
  Cleanup          : trousers-lib-0.3.15-1.el8.x86_64                              13/13 
  Running scriptlet: trousers-lib-0.3.15-1.el8.x86_64                              13/13 
  Verifying        : initscripts-rename-device-10.11.5-1.el9.x86_64                 1/13 
  Verifying        : initscripts-10.11.5-1.el9.x86_64                               2/13 
  Verifying        : initscripts-10.11.2-1.el9.x86_64                               3/13 
  Verifying        : initscripts-service-10.11.5-1.el9.noarch                       4/13 
  Verifying        : initscripts-service-10.11.2-1.el9.noarch                       5/13 
  Verifying        : epel-next-release-9-4.el9.noarch                               6/13 
  Verifying        : epel-next-release-9-2.el9.noarch                               7/13 
  Verifying        : epel-release-9-4.el9.noarch                                    8/13 
  Verifying        : epel-release-9-2.el9.noarch                                    9/13 
  Verifying        : trousers-0.3.15-5.el9.x86_64                                  10/13 
  Verifying        : trousers-0.3.15-1.el8.x86_64                                  11/13 
  Verifying        : trousers-lib-0.3.15-5.el9.x86_64                              12/13 
  Verifying        : trousers-lib-0.3.15-1.el8.x86_64                              13/13 
Installed products updated.

Upgraded:
  epel-next-release-9-4.el9.noarch        epel-release-9-4.el9.noarch                    
  initscripts-10.11.5-1.el9.x86_64        initscripts-service-10.11.5-1.el9.noarch       
  trousers-0.3.15-5.el9.x86_64            trousers-lib-0.3.15-5.el9.x86_64               
Installed:
  initscripts-rename-device-10.11.5-1.el9.x86_64                                         

Complete!

Install all packages for “Minimal Install”:

[root@srv ~]# dnf -y groupupdate "Core" "Minimal Install"
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 0:01:02 ago on Tue Oct  4 17:02:07 2022.
Dependencies resolved.
=========================================================================================
 Package                  Architecture   Version                    Repository      Size
=========================================================================================
Installing group/module packages:
 iproute-tc               x86_64         5.18.0-1.el9               baseos         461 k
 rpm-plugin-audit         x86_64         4.16.1.3-17.el9            baseos          18 k
Installing Environment Groups:
 Minimal Install                                                                        
Installing Groups:
 Core                                                                                   

Transaction Summary
=========================================================================================
Install  2 Packages

Total download size: 478 k
Installed size: 937 k
Downloading Packages:
(1/2): rpm-plugin-audit-4.16.1.3-17.el9.x86_64.rpm        26 kB/s |  18 kB     00:00    
(2/2): iproute-tc-5.18.0-1.el9.x86_64.rpm                469 kB/s | 461 kB     00:00    
-----------------------------------------------------------------------------------------
Total                                                    188 kB/s | 478 kB     00:02     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                 1/1 
  Installing       : rpm-plugin-audit-4.16.1.3-17.el9.x86_64                         1/2 
warning: Unable to get systemd shutdown inhibition lock: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

  Installing       : iproute-tc-5.18.0-1.el9.x86_64                                  2/2 
  Running scriptlet: iproute-tc-5.18.0-1.el9.x86_64                                  2/2 
  Verifying        : iproute-tc-5.18.0-1.el9.x86_64                                  1/2 
  Verifying        : rpm-plugin-audit-4.16.1.3-17.el9.x86_64                         2/2 
Installed products updated.

Installed:
  iproute-tc-5.18.0-1.el9.x86_64         rpm-plugin-audit-4.16.1.3-17.el9.x86_64        

Complete!

Now the system is upgraded to the CentOS Stream 9. The system should be restarted.

[root@srv ~]# cat /etc/*release
CentOS Stream release 9
NAME="CentOS Stream"
VERSION="9"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="9"
PLATFORM_ID="platform:el9"
PRETTY_NAME="CentOS Stream 9"
ANSI_COLOR="0;31"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:centos:centos:9"
HOME_URL="https://centos.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux 9"
REDHAT_SUPPORT_PRODUCT_VERSION="CentOS Stream"
CentOS Stream release 9
CentOS Stream release 9

STEP 4) Additional cleanups.

Remove the old kernels and all old packages, which have in the version “.el8” for CentOS Stream 8.
First, remove the old kernels:

[root@srv ~]# rpm -q kernel-core
kernel-core-4.18.0-383.el8.x86_64
kernel-core-4.18.0-408.el8.x86_64
kernel-core-5.14.0-171.el9.x86_64
[root@srv ~]# dnf remove -y kernel-core-4.18.0-383.el8.x86_64 kernel-core-4.18.0-408.el8.x86_64
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Dependencies resolved.
=========================================================================================
 Package                 Architecture    Version                  Repository        Size
=========================================================================================
Removing:
 kernel-core             x86_64          4.18.0-383.el8           @baseos           69 M
 kernel-core             x86_64          4.18.0-408.el8           @baseos           69 M
Removing dependent packages:
 kernel                  x86_64          4.18.0-383.el8           @baseos            0  
 kernel                  x86_64          4.18.0-408.el8           @baseos            0  
 kernel-modules          x86_64          4.18.0-383.el8           @baseos           23 M
 kernel-modules          x86_64          4.18.0-408.el8           @baseos           23 M

Transaction Summary
=========================================================================================
Remove  6 Packages

Freed space: 184 M
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                 1/1 
  Erasing          : kernel-4.18.0-383.el8.x86_64                                    1/6 
  Running scriptlet: kernel-4.18.0-383.el8.x86_64                                    1/6 
  Erasing          : kernel-4.18.0-408.el8.x86_64                                    2/6 
  Running scriptlet: kernel-4.18.0-408.el8.x86_64                                    2/6 
  Erasing          : kernel-modules-4.18.0-408.el8.x86_64                            3/6 
  Running scriptlet: kernel-modules-4.18.0-408.el8.x86_64                            3/6 
  Erasing          : kernel-modules-4.18.0-383.el8.x86_64                            4/6 
  Running scriptlet: kernel-modules-4.18.0-383.el8.x86_64                            4/6 
  Running scriptlet: kernel-core-4.18.0-383.el8.x86_64                               5/6 
  Erasing          : kernel-core-4.18.0-383.el8.x86_64                               5/6 
  Running scriptlet: kernel-core-4.18.0-383.el8.x86_64                               5/6 
  Running scriptlet: kernel-core-4.18.0-408.el8.x86_64                               6/6 
  Erasing          : kernel-core-4.18.0-408.el8.x86_64                               6/6 
  Running scriptlet: kernel-core-4.18.0-408.el8.x86_64                               6/6 
  Verifying        : kernel-4.18.0-408.el8.x86_64                                    1/6 
  Verifying        : kernel-4.18.0-383.el8.x86_64                                    2/6 
  Verifying        : kernel-core-4.18.0-383.el8.x86_64                               3/6 
  Verifying        : kernel-core-4.18.0-408.el8.x86_64                               4/6 
  Verifying        : kernel-modules-4.18.0-408.el8.x86_64                            5/6 
  Verifying        : kernel-modules-4.18.0-383.el8.x86_64                            6/6 
Installed products updated.

Removed:
  kernel-4.18.0-383.el8.x86_64                kernel-4.18.0-408.el8.x86_64               
  kernel-core-4.18.0-383.el8.x86_64           kernel-core-4.18.0-408.el8.x86_64          
  kernel-modules-4.18.0-383.el8.x86_64        kernel-modules-4.18.0-408.el8.x86_64       

Complete!

Remove the Subscription Manager if you do not have a subscription:

[root@srv ~]# dnf remove -y subscription-manager 
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Dependencies resolved.
=========================================================================================
 Package                                   Arch      Version            Repository  Size
=========================================================================================
Removing:
 subscription-manager                      x86_64    1.29.30-1.el9      @baseos    3.2 M
Removing unused dependencies:
 libdnf-plugin-subscription-manager        x86_64    1.29.30-1.el9      @baseos     63 k
 python3-chardet                           noarch    4.0.0-5.el9        @baseos    1.4 M
 python3-cloud-what                        x86_64    1.29.30-1.el9      @baseos     73 k
 python3-decorator                         noarch    4.4.2-6.el9        @baseos     61 k
 python3-ethtool                           x86_64    0.15-2.el9         @baseos     94 k
 python3-idna                              noarch    2.10-7.el9         @baseos    459 k
 python3-iniparse                          noarch    0.4-45.el9         @baseos    106 k
 python3-inotify                           noarch    0.9.6-25.el9       @baseos    244 k
 python3-librepo                           x86_64    1.14.2-3.el9       @baseos    183 k
 python3-pysocks                           noarch    1.7.1-12.el9       @baseos     88 k
 python3-requests                          noarch    2.25.1-6.el9       @baseos    389 k
 python3-setuptools                        noarch    53.0.0-11.el9      @baseos    4.2 M
 python3-subscription-manager-rhsm         x86_64    1.29.30-1.el9      @baseos    431 k
 python3-urllib3                           noarch    1.26.5-3.el9       @baseos    728 k
 subscription-manager-rhsm-certificates    noarch    20220623-1.el9     @baseos     27 k
 usermode                                  x86_64    1.114-4.el9        @baseos    836 k

Transaction Summary
=========================================================================================
Remove  17 Packages

Freed space: 12 M
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                 1/1 
  Running scriptlet: subscription-manager-1.29.30-1.el9.x86_64                      1/17 
Removed "/etc/systemd/system/multi-user.target.wants/rhsmcertd.service".

  Erasing          : subscription-manager-1.29.30-1.el9.x86_64                      1/17 
  Running scriptlet: subscription-manager-1.29.30-1.el9.x86_64                      1/17 
  Erasing          : python3-subscription-manager-rhsm-1.29.30-1.el9.x86_64         2/17 
  Erasing          : python3-cloud-what-1.29.30-1.el9.x86_64                        3/17 
  Erasing          : python3-requests-2.25.1-6.el9.noarch                           4/17 
  Erasing          : python3-urllib3-1.26.5-3.el9.noarch                            5/17 
  Erasing          : python3-inotify-0.9.6-25.el9.noarch                            6/17 
  Erasing          : python3-setuptools-53.0.0-11.el9.noarch                        7/17 
  Erasing          : python3-idna-2.10-7.el9.noarch                                 8/17 
  Erasing          : python3-pysocks-1.7.1-12.el9.noarch                            9/17 
  Erasing          : python3-chardet-4.0.0-5.el9.noarch                            10/17 
  Erasing          : python3-iniparse-0.4-45.el9.noarch                            11/17 
  Erasing          : subscription-manager-rhsm-certificates-20220623-1.el9.noarc   12/17 
  Erasing          : python3-decorator-4.4.2-6.el9.noarch                          13/17 
  Erasing          : libdnf-plugin-subscription-manager-1.29.30-1.el9.x86_64       14/17 
  Erasing          : python3-ethtool-0.15-2.el9.x86_64                             15/17 
  Erasing          : python3-librepo-1.14.2-3.el9.x86_64                           16/17 
  Erasing          : usermode-1.114-4.el9.x86_64                                   17/17 
  Running scriptlet: usermode-1.114-4.el9.x86_64                                   17/17 
  Verifying        : libdnf-plugin-subscription-manager-1.29.30-1.el9.x86_64        1/17 
  Verifying        : python3-chardet-4.0.0-5.el9.noarch                             2/17 
  Verifying        : python3-cloud-what-1.29.30-1.el9.x86_64                        3/17 
  Verifying        : python3-decorator-4.4.2-6.el9.noarch                           4/17 
  Verifying        : python3-ethtool-0.15-2.el9.x86_64                              5/17 
  Verifying        : python3-idna-2.10-7.el9.noarch                                 6/17 
  Verifying        : python3-iniparse-0.4-45.el9.noarch                             7/17 
  Verifying        : python3-inotify-0.9.6-25.el9.noarch                            8/17 
  Verifying        : python3-librepo-1.14.2-3.el9.x86_64                            9/17 
  Verifying        : python3-pysocks-1.7.1-12.el9.noarch                           10/17 
  Verifying        : python3-requests-2.25.1-6.el9.noarch                          11/17 
  Verifying        : python3-setuptools-53.0.0-11.el9.noarch                       12/17 
  Verifying        : python3-subscription-manager-rhsm-1.29.30-1.el9.x86_64        13/17 
  Verifying        : python3-urllib3-1.26.5-3.el9.noarch                           14/17 
  Verifying        : subscription-manager-1.29.30-1.el9.x86_64                     15/17 
  Verifying        : subscription-manager-rhsm-certificates-20220623-1.el9.noarc   16/17 
  Verifying        : usermode-1.114-4.el9.x86_64                                   17/17 

Removed:
  libdnf-plugin-subscription-manager-1.29.30-1.el9.x86_64                                
  python3-chardet-4.0.0-5.el9.noarch                                                     
  python3-cloud-what-1.29.30-1.el9.x86_64                                                
  python3-decorator-4.4.2-6.el9.noarch                                                   
  python3-ethtool-0.15-2.el9.x86_64                                                      
  python3-idna-2.10-7.el9.noarch                                                         
  python3-iniparse-0.4-45.el9.noarch                                                     
  python3-inotify-0.9.6-25.el9.noarch                                                    
  python3-librepo-1.14.2-3.el9.x86_64                                                    
  python3-pysocks-1.7.1-12.el9.noarch                                                    
  python3-requests-2.25.1-6.el9.noarch                                                   
  python3-setuptools-53.0.0-11.el9.noarch                                                
  python3-subscription-manager-rhsm-1.29.30-1.el9.x86_64                                 
  python3-urllib3-1.26.5-3.el9.noarch                                                    
  subscription-manager-1.29.30-1.el9.x86_64                                              
  subscription-manager-rhsm-certificates-20220623-1.el9.noarch                           
  usermode-1.114-4.el9.x86_64                                                            

Complete!

List all packages with .el8, which means they are from CentOS Stream 8:

[root@srv ~]# dnf list --installed|grep el8
inih.x86_64                        56-1.el8                        @epel        
iwl6000-firmware.noarch            9.221.4.1-110.el8.1             @baseos      
libcbor.x86_64                     0.7.0-6.el8                     @epel        
libcroco.x86_64                    0.6.12-4.el8_2.1                @anaconda    
libfido2.x86_64                    1.11.0-2.el8                    @epel        
mozjs60.x86_64                     60.9.0-4.el8                    @anaconda

These are old libraries or modules, which old versions are not included in CentOS Stream 9 release. The best way is to search their equivalents in CentOS Stream 9 and to install those packages. It’s safe to remove them if not used.
For example, inih library is older version in CentOS Stream 9, than the CentOS Stream 8. inih in CentOS Stream 8 is from EPEL repo, but in CentOS Stream 9 is from the baseos. In rear cases, it may happen the packages in the new CentOS release to be a little bit older than the EPEL package from the old CentOS release.

[root@srv ~]# dnf info inih
Last metadata expiration check: 0:27:12 ago on Tue 04 Oct 2022 05:02:07 PM UTC.
Installed Packages
Name         : inih
Version      : 56
Release      : 1.el8
Architecture : x86_64
Size         : 47 k
Source       : inih-56-1.el8.src.rpm
Repository   : @System
From repo    : epel
Summary      : Simple INI file parser library
URL          : https://github.com/benhoyt/inih
License      : BSD
Description  : The inih package provides simple INI file parser which is only a couple of
             : pages of code, and it was designed to be small and simple, so it's good
             : for embedded systems.

Available Packages
Name         : inih
Version      : 49
Release      : 6.el9
Architecture : i686
Size         : 18 k
Source       : inih-49-6.el9.src.rpm
Repository   : baseos
Summary      : Simple INI file parser library
URL          : https://github.com/benhoyt/inih
License      : BSD
Description  : The inih package provides simple INI file parser which is only a couple of
             : pages of code, and it was designed to be small and simple, so it's good
             : for embedded systems.

[root@srv ~]# dnf remove -y inih-56-1.el8
Dependencies resolved.
=========================================================================================
 Package                 Architecture     Version                Repository         Size
=========================================================================================
Removing:
 inih                    x86_64           56-1.el8               @epel              47 k
Removing dependent packages:
 xfsprogs                x86_64           5.14.2-1.el9           @baseos           3.3 M
Removing unused dependencies:
 userspace-rcu           x86_64           0.12.1-6.el9           @baseos           408 k

Transaction Summary
=========================================================================================
Remove  3 Packages

Freed space: 3.7 M
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                 1/1 
  Erasing          : xfsprogs-5.14.2-1.el9.x86_64                                    1/3 
  Erasing          : inih-56-1.el8.x86_64                                            2/3 
  Erasing          : userspace-rcu-0.12.1-6.el9.x86_64                               3/3 
  Running scriptlet: userspace-rcu-0.12.1-6.el9.x86_64                               3/3 
  Verifying        : inih-56-1.el8.x86_64                                            1/3 
  Verifying        : userspace-rcu-0.12.1-6.el9.x86_64                               2/3 
  Verifying        : xfsprogs-5.14.2-1.el9.x86_64                                    3/3 

Removed:
  inih-56-1.el8.x86_64  userspace-rcu-0.12.1-6.el9.x86_64  xfsprogs-5.14.2-1.el9.x86_64 

Complete!
[root@srv ~]# dnf install -y inih
Last metadata expiration check: 0:27:31 ago on Tue 04 Oct 2022 05:02:07 PM UTC.
Dependencies resolved.
=========================================================================================
 Package           Architecture        Version                 Repository           Size
=========================================================================================
Installing:
 inih              x86_64              49-6.el9                baseos               18 k

Transaction Summary
=========================================================================================
Install  1 Package

Total download size: 18 k
Installed size: 26 k
Downloading Packages:
inih-49-6.el9.x86_64.rpm                                  92 kB/s |  18 kB     00:00    
-----------------------------------------------------------------------------------------
Total                                                     26 kB/s |  18 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                 1/1 
  Installing       : inih-49-6.el9.x86_64                                            1/1 
  Running scriptlet: inih-49-6.el9.x86_64                                            1/1 
  Verifying        : inih-49-6.el9.x86_64                                            1/1 

Installed:
  inih-49-6.el9.x86_64                                                                   

Complete!

To use the CentOS Stream 9 package just remove the old one and then install it again as above.

In this step, suggested by one of our readers, it is good to check if your logrotate systemd service is started because it is responsible for the periodic log rotation in /var/log. If this service is not running in the system the logs may fill up the root (or the log) partition:

[root@srv ~]# systemctl enable logrotate.timer
[root@srv ~]# systemctl start logrotate.timer
[root@srv ~]# systemctl status logrotate.timer
● logrotate.timer - Daily rotation of log files
     Loaded: loaded (/usr/lib/systemd/system/logrotate.timer; enabled; preset: enabled)
     Active: active (waiting) since Fri 2023-01-27 10:22:57 CET; 6s ago
      Until: Fri 2023-01-27 10:22:57 CET; 6s ago
    Trigger: Sat 2023-01-28 00:00:00 CET; 13h left
   Triggers: ● logrotate.service
       Docs: man:logrotate(8)
             man:logrotate.conf(5)

Jan 27 10:22:57 h2 systemd[1]: Stopped Daily rotation of log files.
Jan 27 10:22:57 h2 systemd[1]: Stopping Daily rotation of log files...
Jan 27 10:22:57 h2 systemd[1]: Started Daily rotation of log files.

STEP 5) Regenerate the rescue kernel boot entry.

. The rescue kernel is the old one (as shown in the screenshot at the start of the article), so it should be generated for the new CentOS release, i.e. the current kernel. Check out the this article on the subject for detailed information – Generate the rescue kernel boot entry in CentOS Stream 9
Here is what should do:

[root@srv ~]# rm -f /boot/vmlinuz-0-rescue-b2a198ecbfdd451cb905f76f825af01e /boot/initramfs-0-rescue-b2a198ecbfdd451cb905f76f825af01e.img /boot/loader/entries/b2a198ecbfdd451cb905f76f825af01e-0-rescue.conf
[root@srv ~]# /usr/lib/kernel/install.d/51-dracut-rescue.install add $(uname -r) /boot /boot/vmlinuz-$(uname -r)

The command does not print output on a successful rescue kernel generation.

STEP 6) DNF broken modules.

It appears some DNF modules may get broken and the DNF manager reports it. Just resets the modules to their original state with:

[root@srv ~]# dnf module reset -y nodejs perl perl-IO-Socket-SSL perl-libwww-perl php satellite-5-client virt
Last metadata expiration check: 3:41:15 ago on Wed Oct 12 09:36:22 2022.
Modular dependency problems:

 Problem 1: conflicting requests
  - nothing provides module(platform:el8) needed by module nodejs:10:8030020210304194401:30b713e6.x86_64
 Problem 2: conflicting requests
  - nothing provides module(platform:el8) needed by module perl:5.26:8000020190628020724:55190bc5.x86_64
 Problem 3: conflicting requests
  - nothing provides module(platform:el8) needed by module perl-IO-Socket-SSL:2.066:8030020201222215140:1e4bbb35.x86_64
 Problem 4: conflicting requests
  - nothing provides module(platform:el8) needed by module perl-libwww-perl:6.34:8030020201223164340:b967a9a2.x86_64
 Problem 5: conflicting requests
  - nothing provides module(platform:el8) needed by module php:7.2:8020020200507003613:2c7ca891.x86_64
  - nothing provides module(httpd:2.4) needed by module php:7.2:8020020200507003613:2c7ca891.x86_64
  - nothing provides module(nginx) needed by module php:7.2:8020020200507003613:2c7ca891.x86_64
 Problem 6: conflicting requests
  - nothing provides module(platform:el8) needed by module satellite-5-client:1.0:8010020191114035551:cdc1202b.x86_64
 Problem 7: conflicting requests
  - nothing provides module(platform:el8) needed by module virt:rhel:8050020211221192853:b4937e53.x86_64
Dependencies resolved.
==============================================================================================================
 Package                   Architecture             Version                   Repository                 Size
==============================================================================================================
Resetting modules:
 nodejs                                                                                                      
 perl                                                                                                        
 perl-IO-Socket-SSL                                                                                          
 perl-libwww-perl                                                                                            
 php                                                                                                         
 satellite-5-client                                                                                          
 virt                                                                                                        

Transaction Summary
==============================================================================================================

Complete!

The broken modules are shown in every DNF command and after resetting them the output of the problem will disappear. More on the subject – DNF install and conflicting requests – nothing provides module(platform:el8) needed by module

STEP 7) Firewall changes.

When adding a masquerade to the forward packages in an inner interface as bridges, for example, it should be added explicit forward to the zone if the interfaces are in the same zone or explicitly intra-zone forward if the interfaces are in different zones:

firewall-cmd --permanent --zone=public --add-forward
firewall-cmd --reload

In simple words, if the Internet to all the virtual servers has stopped after the upgrade, add the “–add-forward” to the zone. If the interfaces are not in the same zone (i.e. public, for example) check the following link – https://bugzilla.redhat.com/show_bug.cgi?id=2016864

21 thoughts on “How to upgrade to CentOS Stream 9 from CentOS Stream 8”

  1. Hi,

    I cannot thank you enough for writing such an accurate article.

    on replacing the el8 packages like inih, I found that using “dnf swap” helps to preserve the dependencies:

    dnf swap inih-56-1.el8 inih-49-6.el

  2. I can’t thank you enough for this excellent article.
    The best advice on stackexchange is to install from scratch, but I have a RAID system under LVN and anaconda just saw it as four drives. Hard stop on that path! Also I didn’t fancy the idea of doing a backup and recovery of 2 TB into the cloud somewhere. This guide was a lifesaver.

    Ond thing I’d add. I had some problems with SELinux not allowing some operations. Rather then figure out exactly what selinux was unhappy with I just set selinux in permissive mode and continued.

  3. I’ve upgraded several systems from Centos 8 Stream to Centos 9 Stream via these helpful instructions and each one seems to have had the logrotate.timer service disabled thus leading to /var/log/messages and friends growing size without end.

    So I would add the following command to the “Additional Cleanups” section above to enable periodic log rotation after upgrading to Centos 9 Stream.

    # systemctl enable logrotate.timer

    Incidentally I did find this long running thread describing this logrotate issue which seemingly appeared when logrotate went from a daily cron to a systemd timer.
    https://bugzilla.opensuse.org/show_bug.cgi?id=908279

    1. Can you be more specific? And always should backup before starting to upgrade OS. Even, you may clone/copy your system on a virtual environment, and upgrade the virtual environment to see what you may stumble upon and if it is possible to upgrade, at all!

  4. The “distro-sync” command failed in the middle … leaving a half-broken system.

    I always have another partition with Fedora stable. Rebooted on it, mounted the CentOS partitions, did a chroot, and fixed manually things, removing duplicates (el8, el9) one by one.

    I guess it would be better to first remove a maximum of modular packages from CentOS_8, and reinstall things properly after. In particular, python3.X with X> 6, python2.7. Then

    chroot /mnt/xxx /bin/bash
    dnf –releasever=9-stream –allowerasing –setopt=deltarpm=false update bash
    #=> that will update glibc2 and bash
    exit
    #=> now we’re with the updated bash, no risk of break
    chroot /mnt/xxx /bin/bash
    dnf –releasever=9-stream –allowerasing –setopt=deltarpm=false groupupdate “Core”
    #=> this MAY fail — remove offending packages with
    #=> rpm -e –nodeps the_package.el8
    And proceed slowly

  5. Thank you NeoX. These instructions work for me, but I needed to change my /dev/sdX entries in /etc/fstab by the respective UUID, obtained by the “blkid /dev/sdX” command. Prior to this mandatory change, booting 5.14 kernel dropped in an emergency mode shell.
    For example, my entry in /etc/fstab:
    /dev/sda /da xfs defaults 0 0
    Needed to be replaced by:
    UUID=971b6c0a-183f-47ce-a679-6440e63e6cea /da xfs defaults 0 0

  6. These steps don’t actually work out of the box. Once the distro update is done and when it asks for “dnf clean packages”, it’s going to fail with this below and trying to run almost anything else will also fail.

    dnf clean packages
    Traceback (most recent call last):
    File “/usr/bin/dnf”, line 61, in
    from dnf.cli import main
    File “/usr/lib/python3.9/site-packages/dnf/__init__.py”, line 30, in
    import dnf.base
    File “/usr/lib/python3.9/site-packages/dnf/base.py”, line 29, in
    import libdnf.transaction
    File “/usr/lib64/python3.9/site-packages/libdnf/__init__.py”, line 11, in
    from . import common_types
    File “/usr/lib64/python3.9/site-packages/libdnf/common_types.py”, line 13, in
    from . import _common_types
    ImportError: /opt/gcc-10.2.0/lib64/libstdc++.so.6: version `GLIBCXX_3.4.29′ not found (required by /usr/lib64/python3.9/site-packages/libdnf/_common_types.so)

  7. I was mistaken in the post right above. That was due to a local issue – I had a custom gcc installation whose library path was in /etc/ld.so.conf (a very bad choice to do that in the first place) and so the libraries were being linked against an incompatible GCC. Getting rid of that resolves the issue.

    1. Yes, you are absolutely right. If custom software is installed (including from some popular, but NOT official repositories), it’s highly likely to fail in upgrading the system. Of course, this should not give up upgrading, but rather assets such as software and be prepared for additional after the base OS upgrade to upgrade this other software.

  8. Thank you for useful information. On step4 removing el8 packages, I’ve encountered a problem. Sharing how I’ve solved it.

    When removing ‘wqy-microhei-fonts-0.2.0-0.22.beta.el8.noarch’, 386 depending packages are suggested to remove. It seems ‘fontconfig’ depends ‘wqy-microhei-fonts’ via ‘font(:lang=en)’. In Cent OS Stream 8, ‘font(:lang=en)’ depends ‘wqy-microhei-fonts’ and a lot of other fonts. In CentOS Stream 9, ‘font(:lang=en)’ depends only ‘langpacks-core-font-en’.

    So I just install ‘langpacks-core-font-en’ and now ‘wqy-microhei-fonts’ can be removed without any dependencies.

    1. Capability identifiers like ‘font(:lang=en)’, which are becoming increasingly common (for good reason) on both Fedora and RHEL/alikes, are meta-provides that lots of (real) packages can register as satisfying, and which downstream packages can Require instead of any one specific package, when they’re capable of taking any package with that capability.

      It used to be, if a package required a font to be installed, packagers would just pick a compatible one at random, and make that specific package a dependency. But often, there was no real need for that specific font, as long as some font was installed it didn’t really matter which. So, meta-provides like ‘font()’ capabilities were introduced to model those types of requirements.

      In your case, I’m guessing that wqy-microhei-fonts was the only package you had installed with ‘Provides: font(:lang=en)’. So when you tried to uninstall that package, the dependency was no longer satisfied for hundreds of other packages. You freed up wqy-microhei-fonts to be uninstalled when you installed any other package with ‘Provides: font(:lang=en)’. (langpacks-core-font-en is an obvious choice, but there are probably dozens if not hundreds of other choices.)

      Tons of packages today have an “I’m not picky about which font, as long as it has English-language support” dependency on ‘font(:lang=en)’, so any font with that capability is as good as any other.

  9. Hi thanks for the guide you wrote, I followed your steps but at the very last one
    dnf list –installed|grep el8

    I got a HUGE list (tenths or more) of .el8 packages spreadd in @baseos @appstream @anaconda basically..what should I do?
    Thanks
    Regards

  10. I put this little scriptlet together to go through and handle all of the el8 to el9 swaps that need to happen after the initial update. Based on my running, you may need to run it several times, as earlier swaps will clear conflicts for later swaps.

    #!/bin/bash
    DEBUG=1 # If you want interim step info, set this to 1
    ARCH=`uname -i`
    [[ ${DEBUG} == “1” ]] && echo -e “Initial packages to process: \e[1m`rpm -qa | grep el8 | wc -l`\e[0m”
    [[ ${DEBUG} == “1” ]] && echo -e “Looking for ‘el8’ packages with \e[1;4m${ARCH}\e[0m and \e[1;4mnoarch\e[0m architectures” && sleep 4
    for i in `rpm -qa | grep el8 | sed “s/\.${ARCH}//; s/\.noarch//”`; do
    readarray -t aPkg < <(dnf info ${i} | egrep "^Name|^Version|^Release" | awk '{print $3}')
    [[ ${DEBUG} == "1" ]] && echo "Input parsing: `declare -p aPkg`"
    pkgBase="${aPkg[0]}"
    pkgOld="${aPkg[0]}-${aPkg[1]}-${aPkg[2]}"
    [[ ${DEBUG} == "1" ]] && echo "Base Name: ${pkgBase}"
    [[ ${DEBUG} == "1" ]] && echo "Old Install: ${pkgOld}"
    newVer=`yum list ${pkgBase} | grep el9 | awk '{print $2}' | head -1`
    pkgNew=${pkgBase}-${newVer}
    [[ ${DEBUG} == "1" ]] && echo "New Install: ${pkgNew}"
    dnf -y swap ${pkgOld} ${pkgNew} –allowerasing –nobest
    echo; echo
    done
    [[ ${DEBUG} == "1" ]] && echo -e "Remaining packages to process: \e[1m`rpm -qa | grep el8 | wc -l`\e[0m"

  11. I put this little scriptlet together to go through and handle all of the el8 to el9 swaps that need to happen after the initial update. Based on my running, you may need to run it several times, as earlier swaps will clear conflicts for later swaps.

    https://pastebin.com/gAVMvE9e

    (Note to Mod: Don’t approve the previous comment with the blown-out unformatted code…)

  12. A quick comment for this very good topic; yesterday I wanted to upgrade from stream 8 to 9. I followed the explanations however I distro-sync with the –skip-broken option, the mistake not to make in a version upgrade that I hadn’t done for 10 years. I ended up with 8 and 9 packages as well as dnf, yum that didn’t work anymore, lol. To fix dnf, I had to downgrade 2 python packages to el8 with rpm.
    #sudo rpm -Uf libcomps-0.1.18-1.el8.x86_64.rpm python3-libcomps-0.1.18-1.el8.x86_64.rpm
    Then I went back to my kernel 8, following the same procedure as for the version upgrade
    #sudo yum install –allowerasing http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/centos-stream-repos-8-6.el8.noarch.rpm http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/centos-stream-release-8.6-1.el8.noarch.rpm http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/centos-gpg-keys-8-6.el8.noarch.rpm
    then
    sudo dnf –releasever=8-stream –allowerasing –setop=deltarpm=false distro-sync
    For this to work, I had to remove 3 python packages in el9 and reinstall them in el8.
    I was then able to downgrade to stream 8 stable,
    If this information is of use to others, please share it.
    And I’ll be sure to resolve any conflicts upstream when I upgrade again lol.

  13. Just a heads up: while upgrading a Hyper-V Gen2 VM with UEFFI, the upgrade broke grub configuration. After rebooting it would go straight to grub prompt and no kernel was loaded.

    So, BEFORE rebooting (at the end of step 3), I ran:

    grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg (got it from https://ahelpme.com/linux/centos-stream-9/generate-the-rescue-kernel-boot-entry-in-centos-stream-9/)

    That command fixed grub entries and I was able to boot normally. I confirmed that this happens on Hyper-V VM with UEFI boot with a fresh install of Strem 8 and upgrading to Stream 9, having the exact same result.

    Also,. kdump was also broke after the upgrade. Running below fixed.

    kdumpctl reset-crashkernel –kernel=ALL

    I recommend you run it after regenerating the rescue kernel boot entry and removing old kernels.

Leave a Reply

Your email address will not be published. Required fields are marked *