1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

既存のcentos-gpg-keysのためにCentOS8を更新(yum update/dnf update)ができない件の解決方法

Posted at

#問題

IBM CloudのCentOS8にて、dnf updateでパッケージを最新化できない。以下のエラーがでる。

[root@syasuda ~]# cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)

[root@syasuda ~]# dnf update
Last metadata expiration check: 2:23:09 ago on Mon Sep 28 18:34:38 2020.
Error:
 Problem: cannot install both centos-gpg-keys-8.2-2.2004.0.2.el8.noarch and centos-gpg-keys-8.2-2.2004.0.1.el8.noarch
  - package centos-repos-8.2-2.2004.0.1.el8.x86_64 requires centos-gpg-keys = 8.2-2.2004.0.1.el8, but none of the providers can be installed
  - cannot install the best update candidate for package centos-gpg-keys-8.2-2.2004.0.1.el8.noarch
  - problem with installed package centos-repos-8.2-2.2004.0.1.el8.x86_64
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

これは、centos-gpg-keysが原因のようだ。

[root@syasuda ~]# dnf update centos-gpg-keys
Last metadata expiration check: 1:00:53 ago on Wed Sep 30 12:00:28 2020.
Error:
 Problem: cannot install both centos-gpg-keys-8.2-2.2004.0.2.el8.noarch and centos-gpg-keys-8.2-2.2004.0.1.el8.noarch
  - package centos-repos-8.2-2.2004.0.1.el8.x86_64 requires centos-gpg-keys = 8.2-2.2004.0.1.el8, but none of the providers can be installed
  - cannot install the best update candidate for package centos-gpg-keys-8.2-2.2004.0.1.el8.noarch
  - problem with installed package centos-repos-8.2-2.2004.0.1.el8.x86_64
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

[root@syasuda ~]# dnf provides centos-gpg-keys
Last metadata expiration check: 2:26:39 ago on Mon Sep 28 18:34:38 2020.
centos-gpg-keys-8.2-2.2004.0.1.el8.noarch : CentOS Linux RPM keys
Repo        : @System
Matched from:
Provide    : centos-gpg-keys = 8.2-2.2004.0.1.el8

centos-gpg-keys-8.2-2.2004.0.2.el8.noarch : CentOS Linux RPM keys
Repo        : BaseOS
Matched from:
Provide    : centos-gpg-keys = 8.2-2.2004.0.2.el8

失敗例

無理やり--allowerasingオプションを付けて更新してみたら、/etc/passwdなど含めて色々なファイルが更新されるので、やめておいた方がいい(と思う)

[root@syasuda ~]# dnf update centos-gpg-keys --allowerasing
Last metadata expiration check: 1:01:48 ago on Wed Sep 30 12:00:28 2020.
Dependencies resolved.
===================================================================================================================================================================
 Package                         Architecture           Version                                            Repository                                         Size
===================================================================================================================================================================
Upgrading:
 centos-gpg-keys                 noarch                 8.2-2.2004.0.2.el8                                 BaseOS                                             12 k
Removing dependent packages:
 audit                           x86_64                 3.0-0.17.20191104git1c2f876.el8                    @7993e58f8c307da5e7cbdc3c8d2489fc                 656 k
 centos-release                  x86_64                 8.2-2.2004.0.1.el8                                 @7993e58f8c307da5e7cbdc3c8d2489fc                  25 k
 centos-repos                    x86_64                 8.2-2.2004.0.1.el8                                 @7993e58f8c307da5e7cbdc3c8d2489fc                 9.4 k
 cloud-init                      noarch                 19.4-1.el8.7                                       @3fffc052a6c566f3c93d11ec36329abc                 3.0 M
 initscripts                     x86_64                 10.00.6-1.el8_2.1                                  @7993e58f8c307da5e7cbdc3c8d2489fc                 1.0 M
 setup                           noarch                 2.12.2-5.el8                                       @7993e58f8c307da5e7cbdc3c8d2489fc                 708 k
 shadow-utils                    x86_64                 2:4.6-8.el8                                        @7993e58f8c307da5e7cbdc3c8d2489fc                 5.1 M

Transaction Summary
===================================================================================================================================================================
Upgrade  1 Package
Remove   7 Packages

Total download size: 12 k
Is this ok [y/N]: y
Downloading Packages:
centos-gpg-keys-8.2-2.2004.0.2.el8.noarch.rpm                                                                                       36 kB/s |  12 kB     00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                               36 kB/s |  12 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                           1/1
  Running scriptlet: centos-gpg-keys-8.2-2.2004.0.2.el8.noarch                                                                                                 1/1
  Upgrading        : centos-gpg-keys-8.2-2.2004.0.2.el8.noarch                                                                                                 1/9
  Running scriptlet: audit-3.0-0.17.20191104git1c2f876.el8.x86_64                                                                                              2/9
  Erasing          : audit-3.0-0.17.20191104git1c2f876.el8.x86_64                                                                                              2/9
  Running scriptlet: audit-3.0-0.17.20191104git1c2f876.el8.x86_64                                                                                              2/9
  Running scriptlet: cloud-init-19.4-1.el8.7.noarch                                                                                                            3/9
  Erasing          : cloud-init-19.4-1.el8.7.noarch                                                                                                            3/9
warning: /etc/cloud/cloud.cfg saved as /etc/cloud/cloud.cfg.rpmsave

  Running scriptlet: cloud-init-19.4-1.el8.7.noarch                                                                                                            3/9
  Running scriptlet: initscripts-10.00.6-1.el8_2.1.x86_64                                                                                                      4/9
  Erasing          : initscripts-10.00.6-1.el8_2.1.x86_64                                                                                                      4/9
  Running scriptlet: initscripts-10.00.6-1.el8_2.1.x86_64                                                                                                      4/9
  Erasing          : shadow-utils-2:4.6-8.el8.x86_64                                                                                                           5/9
  Erasing          : setup-2.12.2-5.el8.noarch                                                                                                                 6/9
warning: /etc/shadow saved as /etc/shadow.rpmsave
warning: /etc/passwd saved as /etc/passwd.rpmsave
warning: /etc/hosts saved as /etc/hosts.rpmsave
warning: /etc/gshadow saved as /etc/gshadow.rpmsave
warning: /etc/group saved as /etc/group.rpmsave

  Erasing          : centos-release-8.2-2.2004.0.1.el8.x86_64                                                                                                  7/9
  Running scriptlet: centos-release-8.2-2.2004.0.1.el8.x86_64                                                                                                  7/9
  Erasing          : centos-repos-8.2-2.2004.0.1.el8.x86_64                                                                                                    8/9
warning: /etc/yum.repos.d/CentOS-fasttrack.repo saved as /etc/yum.repos.d/CentOS-fasttrack.repo.rpmsave
warning: /etc/yum.repos.d/CentOS-centosplus.repo saved as /etc/yum.repos.d/CentOS-centosplus.repo.rpmsave
warning: /etc/yum.repos.d/CentOS-PowerTools.repo saved as /etc/yum.repos.d/CentOS-PowerTools.repo.rpmsave
warning: /etc/yum.repos.d/CentOS-HA.repo saved as /etc/yum.repos.d/CentOS-HA.repo.rpmsave
warning: /etc/yum.repos.d/CentOS-Extras.repo saved as /etc/yum.repos.d/CentOS-Extras.repo.rpmsave
warning: /etc/yum.repos.d/CentOS-CR.repo saved as /etc/yum.repos.d/CentOS-CR.repo.rpmsave
warning: /etc/yum.repos.d/CentOS-Base.repo saved as /etc/yum.repos.d/CentOS-Base.repo.rpmsave
warning: /etc/yum.repos.d/CentOS-AppStream.repo saved as /etc/yum.repos.d/CentOS-AppStream.repo.rpmsave

  Cleanup          : centos-gpg-keys-8.2-2.2004.0.1.el8.noarch                                                                                                 9/9
  Running scriptlet: centos-gpg-keys-8.2-2.2004.0.1.el8.noarch                                                                                                 9/9
  Verifying        : centos-gpg-keys-8.2-2.2004.0.2.el8.noarch                                                                                                 1/9
  Verifying        : centos-gpg-keys-8.2-2.2004.0.1.el8.noarch                                                                                                 2/9
  Verifying        : audit-3.0-0.17.20191104git1c2f876.el8.x86_64                                                                                              3/9
  Verifying        : centos-release-8.2-2.2004.0.1.el8.x86_64                                                                                                  4/9
  Verifying        : centos-repos-8.2-2.2004.0.1.el8.x86_64                                                                                                    5/9
  Verifying        : cloud-init-19.4-1.el8.7.noarch                                                                                                            6/9
  Verifying        : initscripts-10.00.6-1.el8_2.1.x86_64                                                                                                      7/9
  Verifying        : setup-2.12.2-5.el8.noarch                                                                                                                 8/9
  Verifying        : shadow-utils-2:4.6-8.el8.x86_64                                                                                                           9/9

Upgraded:
  centos-gpg-keys-8.2-2.2004.0.2.el8.noarch

Removed:
  audit-3.0-0.17.20191104git1c2f876.el8.x86_64  centos-release-8.2-2.2004.0.1.el8.x86_64  centos-repos-8.2-2.2004.0.1.el8.x86_64  cloud-init-19.4-1.el8.7.noarch
  initscripts-10.00.6-1.el8_2.1.x86_64          setup-2.12.2-5.el8.noarch                 shadow-utils-2:4.6-8.el8.x86_64

Complete!

#(とりあえず無難な)解決方法。

もっといい方法があれば教えてください。

  • centos-gpg-keysを更新しなければいいのだから、/etc/dnf/dnf.confに、exclude=centos-gpg-keysを追加。
[root@syasuda ~]# grep centos-gpg-keys /etc/dnf/dnf.conf
exclude=centos-gpg-keys
  • この状態だと、dnf updateが可能。
[root@syasuda ~]# dnf update
Last metadata expiration check: 1:43:12 ago on Tue Sep 29 23:24:10 2020.
Dependencies resolved.
===================================================================================================================================================================
 Package                                         Architecture                  Version                                         Repository                     Size
===================================================================================================================================================================
Installing:
 kernel                                          x86_64                        4.18.0-193.19.1.el8_2                           BaseOS                        2.8 M
 kernel-core                                     x86_64                        4.18.0-193.19.1.el8_2                           BaseOS                         28 M
 kernel-modules                                  x86_64                        4.18.0-193.19.1.el8_2                           BaseOS                         23 M
Upgrading:
 bind-export-libs                                x86_64                        32:9.11.13-6.el8_2.1                            BaseOS                        1.1 M
 centos-release                                  x86_64                        8.2-2.2004.0.2.el8                              BaseOS                         21 k
 dnf-plugins-core                                noarch                        4.0.12-4.el8_2                                  BaseOS                         64 k
 initscripts                                     x86_64                        10.00.6-1.el8_2.2                               BaseOS                        338 k
 kernel-tools                                    x86_64                        4.18.0-193.19.1.el8_2                           BaseOS                        3.0 M
 kernel-tools-libs                               x86_64                        4.18.0-193.19.1.el8_2                           BaseOS                        2.8 M
 libcroco                                        x86_64                        0.6.12-4.el8_2.1                                BaseOS                        113 k
 librepo                                         x86_64                        1.11.0-3.el8_2                                  BaseOS                         90 k
 libteam                                         x86_64                        1.29-1.el8_2.2                                  BaseOS                         63 k
 python3-dnf-plugins-core                        noarch                        4.0.12-4.el8_2                                  BaseOS                        204 k
 python3-librepo                                 x86_64                        1.11.0-3.el8_2                                  BaseOS                         52 k
 python3-perf                                    x86_64                        4.18.0-193.19.1.el8_2                           BaseOS                        2.9 M
 python3-syspurpose                              x86_64                        1.26.20-1.el8_2                                 BaseOS                        287 k
 selinux-policy                                  noarch                        3.14.3-41.el8_2.6                               BaseOS                        615 k
 selinux-policy-targeted                         noarch                        3.14.3-41.el8_2.6                               BaseOS                         15 M
 teamd                                           x86_64                        1.29-1.el8_2.2                                  BaseOS                        128 k
 zlib                                            x86_64                        1.2.11-16.el8_2                                 BaseOS                        102 k

Transaction Summary
===================================================================================================================================================================
Install   3 Packages
Upgrade  17 Packages

Total download size: 81 M
Is this ok [y/N]:
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?