はじめに
RHEL8環境でdnfがエラーになったのでやったことを残しておきます。
環境
RHEL8.9
やったこと
dnf updateを実行するとエラーになるのでsubscription-managerでホストの再登録を行ったらupdateが通るようになった。
[root@rhel81 ~]# dnf update
Updating Subscription Management repositories.
Red Hat Enterprise Linux 8 for x86_64 - BaseOS 486 B/s | 361 B 00:00
Errors during downloading metadata for repository 'rhel-8-for-x86_64-baseos-rpms':
- Status code: 403 for https://cdn.redhat.com/content/dist/rhel8/8/x86_64/baseos/os/repodata/repomd.xml (IP: 23.32.12.83)
Error: Failed to download metadata for repo 'rhel-8-for-x86_64-baseos-rpms': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
[root@rhel81 ~]#
[root@rhel81 ~]# subscription-manager register --force
Unregistering from: subscription.rhsm.redhat.com:443/subscription
The system with UUID ******************** has been unregistered
All local data removed
Registering to: subscription.rhsm.redhat.com:443/subscription
Username: ****
Password:
The system has been registered with ID: ********************
The registered system name is: rhel81.****.net
[root@rhel81 ~]#
[root@rhel81 ~]# dnf update
Updating Subscription Management repositories.
Last metadata expiration check: 0:04:01 ago on Sat 06 Jan 2024 08:09:41 PM JST.
Dependencies resolved.
Nothing to do.
Complete!
[root@rhel81 ~]#
おわりに
テスト用の環境で起動していない期間があったのでその影響かもしれない。常時起動しているサーバではあまり起きにくいかもしれません。