Это старая версия документа!
Эта ошибка появляется в CentOS 8 из-за перехода репозитория на новый тип выпусков. Или что-то в этом роде. Что бы её побороть, надо переключиться на другой выпуск пакетов, а конкретно Stream, проявляется она вот так:
[root@hosting ~]# yum update Failed to set locale, defaulting to C.UTF-8 Repository baseos is listed more than once in the configuration CentOS Linux 8 - AppStream Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist [root@hosting ~]#
Для интереса можно зайти в каталог со списками репозиториев и посмотреть что там есть
[root@hosting ~]# cd /etc/yum.repos.d/ [root@hosting yum.repos.d]# ls CentOS-Linux-AppStream.repo CentOS-Linux-Debuginfo.repo CentOS-Linux-FastTrack.repo CentOS-Linux-Plus.repo CentOS-Stream-AppStream.repo CentOS-Stream-Debuginfo.repo CentOS-Stream- PowerTools.repo CentOS-Stream-centosplus.repo epel-testing-modular.repo ispsystem-base.repo CentOS-Linux-BaseOS.repo CentOS-Linux-Devel.repo CentOS-Linux-HighAvailability.repo CentOS-Linux-PowerTools.repo CentOS-Stream-Base.repo CentOS-Stream-Extras.repo CentOS-Stream- Sources.repo epel-modular.repo epel-testing.repo ispsystem.repo CentOS-Linux-ContinuousRelease.repo CentOS-Linux-Extras.repo CentOS-Linux-Media.repo CentOS-Linux-Sources.repo CentOS-Stream-BaseOS.repo CentOS-Stream-Media.repo CentOS-Stream- Vault.repo epel-playground.repo epel.repo
В моём случае там слишко много всего, видно что там есть подключенные репо и Linux и Stream. Попробуем установить пакет centos-release-stream-8.1, его можно скачать откуда угодно, но я использовал эту ссылку.
[root@hosting yum.repos.d]# rpm -i http://mirror.centos.org/centos/8/stream/extras/x86_64/os/Packages/centos-release-stream-8.1-1.1911.0.7.el8.x86_64.rpm
package centos-release-stream-8.1-1.1911.0.7.el8.x86_64 is already installed
Пакет на самом деле стоит, но всё равно ничего не работает.
На всякий случай всё удаляем
[root@hosting yum.repos.d]# rpm -qa | grep centos-release-stream [root@hosting yum.repos.d]# rpm -e centos-release-stream-8.1-1.1911.0.7.el8.x86_64
И устанавливаем заново
[root@hosting yum.repos.d]# rpm -ivh http://mirror.centos.org/centos/8-stream/extras/x86_64/os/Packages/centos-release-stream-8.1-1.1911.0.7.el8.x86_64.rpm Retrieving http://mirror.centos.org/centos/8-stream/extras/x86_64/os/Packages/centos-release-stream-8.1-1.1911.0.7.el8.x86_64.rpm Verifying... ################################# [100%] Preparing... ################################# [100%] Updating / installing... 1:centos-release-stream-8.1-1.1911.################################# [100%]
Пакет поставлен, теперь переключаемся между релизами.
[root@hosting yum.repos.d]# dnf swap centos-{linux,stream}-repos -y
Failed to set locale, defaulting to C.UTF-8
Repository baseos is listed more than once in the configuration
CentOS Linux 8 - AppStream
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
Получаем ошибку. Что бы её полечить надо отключить предыдущий репозиторий AppStream
[root@hosting yum.repos.d]# vi CentOS-Linux-AppStream.repo
Ищем там
enabled=1
И меняем на
enabled=0
Сохраняем, выходим, запускаем ещё раз
[root@hosting yum.repos.d]# dnf swap centos-{linux,stream}-repos -y
Failed to set locale, defaulting to C.UTF-8
Repository baseos is listed more than once in the configuration
CentOS Linux 8 - BaseOS
Error: Failed to download metadata for repo 'baseos': Cannot prepare internal mirrorlist: No URLs in mirrorlist
Теперь отключаем так же другой репозиторий
[root@hosting yum.repos.d]# vi CentOS-Linux-BaseOS.repo
Запускаем ещё раз
[root@hosting yum.repos.d]# dnf swap centos-{linux,stream}-repos -y
Failed to set locale, defaulting to C.UTF-8
Repository baseos is listed more than once in the configuration
CentOS Linux 8 - Extras
CentOS Linux 8 - PowerTools
Error: Failed to download metadata for repo 'powertools': Cannot prepare internal mirrorlist: No URLs in mirrorlist
И ещё раз выключаем третий репо
[root@hosting yum.repos.d]# vi CentOS-Linux-PowerTools.repo
Обычно этого достаточно, дальше запускаем и оно всё отрабатывает
[root@hosting yum.repos.d]# dnf swap centos-{linux,stream}-repos -y
Failed to set locale, defaulting to C.UTF-8
Repository baseos is listed more than once in the configuration
CentOS-Stream - AppStream
CentOS-Stream - Base
CentOS-Stream - Extras
Extra Packages for Enterprise Linux 8 - x86_64
Extra Packages for Enterprise Linux Modular 8 - x86_64
ispsystem-5.279
ispsystem-base
Dependencies resolved.
Package Architecture Version Repository Size
===========================================================================================================
Installing:
centos-stream-release noarch 8.6-1.el8 Stream-BaseOS 22 k
replacing centos-linux-release.noarch 8.5-1.2111.el8
replacing centos-release-stream.x86_64 8.1-1.1911.0.7.el8
centos-stream-repos noarch 8-4.el8 Stream-BaseOS 20 k
Upgrading:
centos-gpg-keys noarch 1:8-4.el8 Stream-BaseOS 12 k
Removing:
centos-linux-repos noarch 8-3.el8 @baseos 26 k
Transaction Summary
===========================================================================================================
Install 2 Packages
Upgrade 1 Package
Remove 1 Package
Total download size: 54 k
Downloading Packages:
(1/3): centos-gpg-keys-8-4.el8.noarch.rpm
(2/3): centos-stream-release-8.6-1.el8.noarch.rpm
(3/3): centos-stream-repos-8-4.el8.noarch.rpm
-----------------------------------------------------------------------------------------------------------
Total
39 kB/s | 54 kB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: centos-gpg-keys-1:8-4.el8.noarch 1/1
Upgrading : centos-gpg-keys-1:8-4.el8.noarch 1/7
Installing : centos-stream-repos-8-4.el8.noarch 2/7
Installing : centos-stream-release-8.6-1.el8.noarch 3/7
Obsoleting : centos-release-stream-8.1-1.1911.0.7.el8.x86_64 4/7
Obsoleting : centos-linux-release-8.5-1.2111.el8.noarch 5/7
Erasing : centos-linux-repos-8-3.el8.noarch 6/7
warning: /etc/yum.repos.d/CentOS-Linux-BaseOS.repo saved as /etc/yum.repos.d/CentOS-Linux-BaseOS.repo.rpmsave
warning: /etc/yum.repos.d/CentOS-Linux-AppStream.repo saved as /etc/yum.repos.d/CentOS-Linux-AppStream.repo.rpmsave
Cleanup : centos-gpg-keys-1:8-3.el8.noarch 7/7
Running scriptlet: centos-gpg-keys-1:8-3.el8.noarch 7/7
Verifying : centos-stream-release-8.6-1.el8.noarch 1/7
Verifying : centos-linux-release-8.5-1.2111.el8.noarch 2/7
Verifying : centos-release-stream-8.1-1.1911.0.7.el8.x86_64 3/7
Verifying : centos-stream-repos-8-4.el8.noarch 4/7
Verifying : centos-gpg-keys-1:8-4.el8.noarch 5/7
Verifying : centos-gpg-keys-1:8-3.el8.noarch 6/7
Verifying : centos-linux-repos-8-3.el8.noarch 7/7
Upgraded:
centos-gpg-keys-1:8-4.el8.noarch
Installed:
centos-stream-release-8.6-1.el8.noarch
centos-stream-repos-8-4.el8.noarch
Removed:
centos-linux-repos-8-3.el8.noarch
Complete!
попутно исправим дурацкую ошибку с локалью
[root@hosting /]# dnf install langpacks-en glibc-all-langpacks -y