Centos yum ошибка

I am trying to install a package on CentOS, but it throws error when I run the "yum" command. The internet connection is working fine. I try to yum clean all but problem persist. Error: [root@dcos-

BEFORE TRYING ANY OF THIS, HAVE A BACKUP OF YOUR MACHINE, YOU COULD DAMAGE YOUR OS MORE/COMPLETELY

It seems that your yum variable $releasever is somehow corrupt,
it usually is caused by missing centos-release package on the machine for some obscure reasons.

You can check if you have the package by:

    rpm -qi centos-release

You will probably see:

    "package centos-release is not installed"

First find out the exact centos version that you have by executing as root:

    cat /etc/redhat-release

You will see something like this:

    CentOS Linux release 7.3.1611 (Core)

You can fetch the centos-release package from repo by:

    wget http://vault.centos.org/centos/7.3.1611/updates/x86_64/Packages/centos-release-7-3.1611.el7.centos.2.5.x86_64.rpm

Now run reinstall centos-release package via rpm:

    sudo rpm -Uvh --replacepkgs centos-release-7-3.1611.el7.centos.2.5.x86_64.rpm

As next you can try to install something with yum and you might get:

    [root@dcos-master3 ikerlan]# sudo yum install wget
    error: db5 error(-30969) from dbenv->open: BDB0091 DB_VERSION_MISMATCH: Database environment version mismatch
    error: cannot open Packages index using db5 - (-30969)
    error: cannot open Packages database in /var/lib/rpm
    CRITICAL:yum.main:

    Error: rpmdb open failed

Now you can try to reboot the machine or try to use the following command to rebuild the rpm db:

    rpm --rebuilddb

In my case, which is really exceptional, the location of the XML file which contains the repo information is changed.

  • I have Internet connection (ping 8.8.8.8 works)
  • When I run yum upgrade, after a lot of 404 error, I can get the names of packages I must download, but I cannot download them.

And, when I browse into the first 404 repo URL, which is:

http://mirror.airenetworks.es/CentOS/7.4.1708/os/x86_64/repodata/repomd.xml

and I see it absent. Going to its parent folder http://mirror.airenetworks.es/CentOS/7.4.1708/readme I get this:

This directory (and version of CentOS) is deprecated. For normal users,
you should use /7/ and not /7.4.1708/ in your path. Please see this FAQ
concerning the CentOS release scheme:

https://wiki.centos.org/FAQ/General

If you know what you are doing, and absolutely want to remain at the 7.4.1708
level, go to http://vault.centos.org/ for packages.

Please keep in mind that 7.4.1708 no longer gets any updates, nor
any security fix’s.

So, I have to go back to /etc/yum.repo.d to edit the files.

I have:

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

I suspect that $releasever is no more in use, so I can test by changing it to 7:(remember to escape & with )

curl http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=arch

we can get a list of files:

ftp://ftp.cesca.cat/centos/7.5.1804/os/x86_64/
http://ftp.rediris.es/mirror/CentOS/7.5.1804/os/x86_64/
http://ftp.cica.es/CentOS/7.5.1804/os/x86_64/
http://centos.mirror.minorisa.net/7.5.1804/os/x86_64/
http://repo.nixval.com/CentOS/7.5.1804/os/x86_64/
http://centos.uvigo.es/7.5.1804/os/x86_64/
http://ftp.uma.es/mirror/CentOS/7.5.1804/os/x86_64/
http://ftp.cixug.es/CentOS/7.5.1804/os/x86_64/
http://mirror.airenetworks.es/CentOS/7.5.1804/os/x86_64/
http://mirror.gadix.com/centos/7.5.1804/os/x86_64/

So, we can set the variable like this:

  1. Open the /etc/yum.repo.d/CentOS-Base.repo
  2. In the [base] section, define: releasever=7.
  3. Re-run yum upgrade or yum install xxx.

In my case, which is really exceptional, the location of the XML file which contains the repo information is changed.

  • I have Internet connection (ping 8.8.8.8 works)
  • When I run yum upgrade, after a lot of 404 error, I can get the names of packages I must download, but I cannot download them.

And, when I browse into the first 404 repo URL, which is:

http://mirror.airenetworks.es/CentOS/7.4.1708/os/x86_64/repodata/repomd.xml

and I see it absent. Going to its parent folder http://mirror.airenetworks.es/CentOS/7.4.1708/readme I get this:

This directory (and version of CentOS) is deprecated. For normal users,
you should use /7/ and not /7.4.1708/ in your path. Please see this FAQ
concerning the CentOS release scheme:

https://wiki.centos.org/FAQ/General

If you know what you are doing, and absolutely want to remain at the 7.4.1708
level, go to http://vault.centos.org/ for packages.

Please keep in mind that 7.4.1708 no longer gets any updates, nor
any security fix’s.

So, I have to go back to /etc/yum.repo.d to edit the files.

I have:

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

I suspect that $releasever is no more in use, so I can test by changing it to 7:(remember to escape & with )

curl http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=arch

we can get a list of files:

ftp://ftp.cesca.cat/centos/7.5.1804/os/x86_64/
http://ftp.rediris.es/mirror/CentOS/7.5.1804/os/x86_64/
http://ftp.cica.es/CentOS/7.5.1804/os/x86_64/
http://centos.mirror.minorisa.net/7.5.1804/os/x86_64/
http://repo.nixval.com/CentOS/7.5.1804/os/x86_64/
http://centos.uvigo.es/7.5.1804/os/x86_64/
http://ftp.uma.es/mirror/CentOS/7.5.1804/os/x86_64/
http://ftp.cixug.es/CentOS/7.5.1804/os/x86_64/
http://mirror.airenetworks.es/CentOS/7.5.1804/os/x86_64/
http://mirror.gadix.com/centos/7.5.1804/os/x86_64/

So, we can set the variable like this:

  1. Open the /etc/yum.repo.d/CentOS-Base.repo
  2. In the [base] section, define: releasever=7.
  3. Re-run yum upgrade or yum install xxx.

Сегодня я ударился головой о стену, чтобы найти решение следующей загадочной проблемы. Всякий раз, когда я запускаю любую команду в терминале, будь то установка пакета или обновление системы, моя минимальная система CentOS 7 породила следующую ошибку:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * elrepo: ftp.nluug.nl
 * extras: mirrors.vonline.vn
 * updates: mirrors.vonline.vn
Traceback (most recent call last): 27% [================ ] 140 kB/s | 2.5 MB 00:00:48 ETA 
 File "/usr/libexec/urlgrabber-ext-down", line 75, in 
 main()
 File "/usr/libexec/urlgrabber-ext-down", line 61, in main
 fo = PyCurlFileObject(opts.url, opts.filename, opts)
 File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1258, in __init__
 self._do_open()
 File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1589, in _do_open
 self._do_grab()
 File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1723, in _do_grab
 self._do_perform()
 File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1517, in _do_perform
 raise KeyboardInterrupt
KeyboardInterrupt

Exiting on user cancel

Я не отменяю процесс и не прерываю клавиатуру, но моя виртуальная машина CentOS 7 продолжала показывать вышеприведенную ошибку.

Я много раз пробовал, но я не мог устанавливать какие-либо пакеты или обновлять систему.

К счастью, я нашел решение

Вот что я сделал для решения проблемы.

С вашего терминала выполните следующие команды один за другим в качестве пользователя root:

yum clean metadata
yum clean all
yum upgrade

Или просто запустите команду «одной строкой» как пользователь root:

bash -c 'yum clean metadata && yum upgrade'

I am trying to do a yum update and all of the mirrors fail with a 404. I put the url into my browser and the error is correct, the url does not exist. YUM is looking for a package that does not exist on the mirrors. See below for the error message:

https://mirrors.lug.mtu.edu/epel/7/x86_64/repodata/13b91b1efe2a1db71aa132d76383fdb5311887958a910548546d58a5856e2c5d-primary.sqlite.xz: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
http://mirror.oss.ou.edu/epel/7/x86_64/repodata/13b91b1efe2a1db71aa132d76383fdb5311887958a910548546d58a5856e2c5d-primary.sqlite.xz: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
https://mirror.csclub.uwaterloo.ca/fedora/epel/7/x86_64/repodata/13b91b1efe2a1db71aa132d76383fdb5311887958a910548546d58a5856e2c5d-primary.sqlite.xz: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
http://mirror.sfo12.us.leaseweb.net/epel/7/x86_64/repodata/13b91b1efe2a1db71aa132d76383fdb5311887958a910548546d58a5856e2c5d-primary.sqlite.xz: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://mirror.math.princeton.edu/pub/epel/7/x86_64/repodata/13b91b1efe2a1db71aa132d76383fdb5311887958a910548546d58a5856e2c5d-primary.sqlite.xz: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://kdeforge2.unl.edu/mirrors/epel/7/x86_64/repodata/13b91b1efe2a1db71aa132d76383fdb5311887958a910548546d58a5856e2c5d-primary.sqlite.xz: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
https://muug.ca/mirror/fedora-epel/7/x86_64/repodata/13b91b1efe2a1db71aa132d76383fdb5311887958a910548546d58a5856e2c5d-primary.sqlite.xz: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
http://fedora.westmancom.com/epel/7/x86_64/repodata/13b91b1efe2a1db71aa132d76383fdb5311887958a910548546d58a5856e2c5d-primary.sqlite.xz: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
https://ca.mirror.babylon.network/epel/7/x86_64/repodata/13b91b1efe2a1db71aa132d76383fdb5311887958a910548546d58a5856e2c5d-primary.sqlite.xz: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
https://mirror.chpc.utah.edu/pub/epel/7/x86_64/repodata/13b91b1efe2a1db71aa132d76383fdb5311887958a910548546d58a5856e2c5d-primary.sqlite.xz: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.

I have tried running yum clean all That command finished successfully, but it did not change any thing. I have also tried the following:

rm -f /var/lib//rpm/__db*
rpm --rebuilddb

That also did not change anything.

Думаю всем уже известно, что поддержка обновлений системы Centos 6 уже завершена, поэтому при попытке установить какой-либо пакет вы можете получить некоторые ошибки. Рассмотрим некоторые из них.

yum error “Cannot retrieve metalink for repositoryepelPlease verify its path and try again

В EPEL теперь, по умолчанию, используется HTTPS вместо HTTP в названии URL, а установка HTTPS соединения требует, чтобы у вас в системе стояли свеженькие корневые и местные SSL-сертификаты. Некоторые советуют тупо заменить в файле /etc/yum.repos.d/epel.repo все «https» на «http». Да, так тоже работать будет, но это очень кривой способ. Проще и правильней обновить нужные пакеты, указав временное выключение репозитория EPEL.

И так, запускайте для правильного способа эти команды:
yum makecache --disablerepo=epel
yum upgrade --disablerepo=epel ca-certificates nss nss-tools nss-utils

или не очень правильно…
sed -i "s/mirrorlist=https/mirrorlist=http/" /etc/yum.repos.d/epel.repo

вручную
nano /etc/yum.repos.d/epel.repo
Приведем оригинальную строку к следующему виду — укажем http вместо https:
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
заменим на
mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch

YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Ошибка: Cannot find a valid baseurl for repo: base

30 ноября 2020 года поддержка операционной системы CentOS 6 была прекращена. Поэтому, для возобновления работы менеджера пакетов YUM нужно обновить ссылки на репозитории.

Перейдем в директорию cd /etc/yum.repos.d/

За бэкапим оригинальный файл:

cp CentOS-Base.repo CentOS-Base.repo.old

Теперь откроем файлик репозитория редактором «nano CentOS-Base.repo» и приведем к следующему виду:

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=https://vault.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=https://vault.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=https://vault.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
baseurl=https://vault.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
baseurl=https://vault.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Осталось только очистить кэш YUM и можно начать ставить нужные вам пакеты:

yum clean all

I want to preface this post with this disclaimer: I am somewhat unfamiliar with how yum functions and I am also unfamiliar with the details of the changes that are required since CentOS 8 became EOL.

About a month back, my container build was unable to successfully run because when I would yum update, I got an error. I found the solution here and added this to my container build:

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*

This got me by for awhile, until today and it seemed to break again.

bash-4.4# yum update
CentOS Linux 8 - AppStream                                                                                                                                                                                   149 kB/s | 8.4 MB     00:58
CentOS Linux 8 - BaseOS                                                                                                                                                                                      113 kB/s | 4.6 MB     00:41
CentOS Linux 8 - Extras                                                                                                                                                                                      716  B/s |  10 kB     00:14
CentOS Linux 8 - PowerTools                                                                                                                                                                                  0.0  B/s |   0  B     01:26
Errors during downloading metadata for repository 'powertools':
  - Curl error (28): Timeout was reached for http://vault.centos.org/centos/8/PowerTools/x86_64/os/repodata/981185e5d80d51024e5246ed47f7f69605160518c22103379bb71376e2dccb14-filelists.xml.gz [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
  - Curl error (28): Timeout was reached for http://vault.centos.org/centos/8/PowerTools/x86_64/os/repodata/4b94ac0555ec1e15718dd9d77f995ec7096d98974b4c7a427b8e03c20e9c663d-primary.xml.gz [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]

So I have found some other solutions, but none of them have worked. For example, I found this post: CentOS 8 upgade — How to resolve Warning: failed loading ‘/etc/yum.repos.d/CentOS-AppStream.repo’, skipping

It had me to the following:

dnf --disablerepo '*' --enablerepo extras swap centos-linux-repos centos-stream-repos

dnf distro-sync

But with that, I get this:

    bash-4.4# dnf --disablerepo '*' --enablerepo extras swap centos-linux-repos centos-stream-repos
CentOS Linux 8 - Extras                                                                                                                                                                                       22 kB/s |  10 kB     00:00
Error:
 Problem 1: conflicting requests
  - nothing provides centos-gpg-keys = 1:8-3.el8 needed by centos-stream-repos-8-3.el8.noarch
 Problem 2: package centos-linux-release-8.3-1.2011.el8.noarch requires centos-repos(8), but none of the providers can be installed
  - conflicting requests
  - problem with installed package centos-linux-release-8.3-1.2011.el8.noarch
  - nothing provides centos-gpg-keys = 1:8-3.el8 needed by centos-stream-repos-8-3.el8.noarch
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

If I am giving the condition that I am unable to change my underlying base image for this container (CentOS 8), what is a short term solution for this? I know the long-term solution is to switch my OS, but I need to limp along for a short amount of time.

Thank you in advance!

Понравилась статья? Поделить с друзьями:
  • Centos err ssl protocol error
  • Centos configure error no acceptable c compiler found in path
  • Centos authentication token manipulation error
  • Centos 8 appstream error
  • Centos 6 yumrepo error