Updated on 2024-09-14 GMT+08:00

Using dnf or yum to Upgrade

This section describes how to update or roll back the RPM packages of HCE 1.1 or later. The methods for using dnf and yum are the same. In this section, dnf is used. If you are upgrading to HCE 1.1, use yum.

  • Huawei Cloud EulerOS 2.0 and later support both yum and dnf.
  • Huawei Cloud EulerOS 1.1 supports only yum.

Prerequisites

The dnf component has been installed and the dnf commands are available.

[root@localhost bin]# dnf
usage: dnf [options] COMMAND

List of Main Commands:

alias                     List or create command aliases
autoremove                remove all unneeded packages that were originally installed as dependencies
check                     check for problems in the packagedb
check-update              check for available package upgrades
clean                     remove cached data
deplist                   [deprecated, use repoquery --deplist] List package's dependencies and what packages provide them
distro-sync               synchronize installed packages to the latest available versions
downgrade                 Downgrade a package
......

Context

Yum is a package management utility for Linux distributions, like CentOS. Yum allows for automatic updates and package management on RPM-based distributions. dnf is a rewrite of yum and improves on yum in several ways: improved performance, less memory usage, and better resolution of dependency conflicts. To ensure compatibility, HCE also supports yum commands.

Upgrade Procedure

  1. Check what RPM package updates are available.
    • Run dnf list updates to see the available updates.
      [root@localhost bin]# dnf list updates 
      Last metadata expiration check: 6:49:11 ago on Tue 28 Jun 2022 01:55:35 PM CST.  
      hce-config.x86_64                           3.0-66.hce2                
      hce-latest-release.x86_64                   2.0-1656179342.2.0.2206.B032.hce2 
      irqbalance.x86_64                           3:1.8.0-7.h9.hce2  
      kernel.x86_64                               5.10.0-60.18.0.50.h316_1.hce2
      kernel-tools.x86_64                         5.10.0-60.18.0.50.h316_1.hce2 
      kernel-tools-libs.x86_64                    5.10.0-60.18.0.50.h316_1.hce2
      kexec-tools.x86_64                          2.0.23-4.h8.hce2 
      libcurl.x86_64                              7.79.1-2.h4.hce2 
      libssh.x86_64                               0.9.6-2.h3.hce2 
      libstdc++.x86_64                            10.3.1-10.h10.hce2 
      libxml2.x86_64                              2.9.12-5.h5.hce2  
      openssh.x86_64                              8.8p1-2.h12.hce2 
      openssh-clients.x86_64                      8.8p1-2.h12.hce2 
      openssh-server.x86_64                       8.8p1-2.h12.hce2  
      Obsoleting Packages 
      dnf-data.noarch                             4.10.0-3.h6.hce2      
      dnf.noarch                                  4.10.0-3.h5.hce2  
      dnf-data.noarch                             4.10.0-3.h6.hce2    
      dnf-data.noarch                             4.10.0-3.h5.hce2
    • Run dnf list updates --security to list only the RPM packages related to security updates.
      [root@localhost bin]# dnf list updates --security 
      Last metadata expiration check: 0:00:03 ago on Fri 08 Jul 2022 04:45:56 PM CST. 
      No security updates needed, but 2 updates available
  2. Update the RPM packages.
    • Run dnf update to update all the RPM packages, including those related to security updates for vulnerability fixing. The components' target versions are returned in the Version column.
      [root@localhost bin]# dnf update 
      Last metadata expiration check: 7:12:18 ago on Tue 28 Jun 2022 01:55:35 PM CST. 
      Dependencies resolved. 
      ================================================================================================  
       Package                        Arch      Version                                 Repo     Size ================================================================================================ 
      Installing:  
       kernel                         x86_64    5.10.0-60.18.0.50.h316_1.hce2           hce2     47 M 
      Upgrading:  
       hce-config                     x86_64    3.0-66.hce2                             hce2     13 k 
       hce-latest-release             x86_64    2.0-1656179342.2.0.2206.B032.hce2       hce2    5.2 k 
       kernel-tools                   x86_64    5.10.0-60.18.0.50.h316_1.hce2           hce2    230 k 
       kernel-tools-libs              x86_64    5.10.0-60.18.0.50.h316_1.hce2           hce2     62 k 
       kexec-tools                    x86_64    2.0.23-4.h8.hce2                        hce2    400 k 
       libcurl                        x86_64    7.79.1-2.h4.hce2                        hce2    284 k 
       libssh                         x86_64    0.9.6-2.h3.hce2                         hce2    194 k 
       libstdc++                      x86_64    10.3.1-10.h10.hce2                      hce2    535 k 
       libxml2                        x86_64    2.9.12-5.h5.hce2                        hce2    659 k  
       logrotate                      x86_64    3.18.1-1.h2.hce2                        hce2     60 k 
       mdadm                          x86_64    4.1-5.h2.hce2                           hce2    331 k 
       nftables                       x86_64    1:1.0.0-1.h3.hce2                       hce2    303 k 
       perl                           x86_64    4:5.34.0-3.h5.hce2                      hce2    3.2 M 
       perl-libs                      x86_64    4:5.34.0-3.h5.hce2                      hce2    1.8 M 
      Installing dependencies: 
       grub2-tools-efi                x86_64    1:2.06-3.h5.hce2                        hce2    472 k 
      
       Transaction Summary 
      ================================================================================================ 
      Install   2 Packages 
      Upgrade  72 Packages  
      Total download size: 105 M 
      Is this ok [y/N]:
    • Run dnf update --security to update only the RPM packages related to security updates.
      [root@localhost bin]# dnf update --security 
      Last metadata expiration check: 7:15:16 ago on Tue 28 Jun 2022 01:55:35 PM CST. 
      No security updates needed, but 73 updates available Dependencies resolved. 
      Nothing to do. 
      Complete!
  3. After the update is successful, check that services are running properly.

    The issue that may occur during an update:

    Based on the requirements of security regulations, the chronyd service will be disabled after Huawei Cloud EulerOS is upgraded from 2.0.2206 to a new version. If required, run systemctl enable chronyd to enable the service and run systemctl start chronyd to start the service.

Rollback Procedure

  1. Run dnf history to query the IDs of historical operations.

  2. Run dnf history undo <ID> to roll back to the desired historical operation.