Как исправить ошибки yum

Last updated on:  2021-04-12

Authored by:  Uriel Amar


This article explains how to fix CentOS® server issues
with the yum cache not updating due to a failed check update.
Several errors might display during this process depending on
the issue’s cause. The following breakdown shows how to identify and resolve
these issues:

Clear yum cache

The following command ensures that no issues exist relating to corrupted metadata
files, missing references, or temporarily free up disk space.

yum clean all

Check for missing repositories

Run the following command to ensure there are no missing repositories.

yum repolist all

You can also verify this inside the /etc/yum.repos.d folder. You can then
install any missing repositories with the yum install command or add a
file manually into the /etc/yum.repos.d folder.

Check for disabled repositories

If the necessary repositories are available but not working, perform the following steps
to edit the repository file:

  1. Run the following command replacing [filename] with the
    repository filename and [extension] with the respective extension:

    cat [filename].[extension]
    
  2. Open the repository file in the editor of your choice and change the value
    enabled=0 to enabled=1.

  3. Run the following command to update the package list and install the
    software:

    yum update
    

Troubleshoot a PycURL error

Several different types of errors might display if the repository file is
corrupted. For example, if the yum install command fails with the following
error, it might be due to an incorrect repository URL, as shown in this example:

[Errno 14]  - "The requested URL returned error: 403"  
Trying other mirror.

Correcting the repository URL in the repository file and cleaning the yum cache
should fix this issue.

yum clean all

Additionally, you can use the yum clean metadata command to clear the metadata
cache if any additional XML files caused the corruption.

Troubleshoot a Fatal error, run database recovery error

If yum fails with a Fatal error, run database recovery message, you should delete
the database and manually rebuild it by using the following commands:

rm -f /var/lib/rpm__db*
rpm -rebuilddb
yum clean all
yum update

Check for dependency conflicts

If you can’t install a package because of a missing dependency or
mismatched version, manually installing each dependency might fix this issue.
Additionally, deleting and reinstalling the local package might resolve version
mismatches.

Unfortunately, there is no easy fix for most dependency issues because of the many
factors involved. In those cases, consider adding a repository that
contains the correct dependency.

Yum duplicate package error can occur anytime and most of the times when servers are under provisioned in terms of hardware capacity like RAM memory or even CPU. This can happen when a small server needs to perform multiple updates that requires more resources than usual making the update process almost impossible. Of course, failure is not an option and we will do our best to explain in this short tutorial how to fix yum duplicate errors by using yum-utils utility. So before we start our little journey fixing those yum errors we must say that this solution has been tested on a CentOS 7.5 server and yum 3.4.3 but for sure this can be applied even for older or newer versions unless yum gets really major updates.

Table of contents

Conflict and duplicate errors
Install yum-utils
Fix yum duplicate errors and conflicts

Conflict and duplicate errors

Unfortunately yum updates can fail breaking the update process but luckily there is a fix for these yum errors, below you can see an output where yum errors can be different like package conflicts and even complaining about duplicate packages, all these in just one update process.


...
Error: NetworkManager-glib conflicts with 1:NetworkManager-libnm-1.8.0-9.el7.x86_64
Error: NetworkManager-glib conflicts with 1:NetworkManager-libnm-1.8.0-11.el7_4.x86_64
 You could try using --skip-broken to work around the problem
** Found 258 pre-existing rpmdb problem(s), 'yum check' output follows:
ModemManager-glib-1.6.10-1.el7.x86_64 is a duplicate with ModemManager-glib-1.6.0-2.el7.x86_64
1:NetworkManager-1.8.0-11.el7_4.x86_64 is a duplicate with 1:NetworkManager-1.8.0-9.el7.x86_64
1:NetworkManager-1.10.2-16.el7_5.x86_64 is a duplicate with 1:NetworkManager-1.8.0-11.el7_4.x86_64
...
Killed

Install yum-utils

The first step to fix these kind of errors is to install yum-utils utility package if this is not installed already on our system, this utility comes with two handy tools for fixing yum errors like yum-complete-transaction and package-cleanup that we will be using on our next step, if you have this package already installed you can skip this step. So let’s make sure that we have installed yum-utils on our server first like shown in the example below:


$ yum install yum-utils

Fix yum duplicate errors and conflicts

Having now installed yum-utils we may proceed fixing all encountered errors. Our next step is to get a list of all duplicate packages that were installed, for this we will be using package-cleanup that comes as we said before with yum-utils so let’s run that on our terminal window:


$ package-cleanup --dupes

Next lets try to make sure that all transaction were cleared:


$ yum-complete-transaction --cleanup-only

And finally lets clean up all duplicate packages as show in the example below:


$ package-cleanup --cleandupes

That is all, our short tutorial ends here and now you may try once again to run your yum update process as usual.

Video

No video posted for this page.

Screenshots

No screenshots posted for this page.

Source code

No code posted for this page.

About this page

Article

Yum fix duplicate error

Author

Category

Published

14/11/2018

Updated

14/11/2018

Tags

What the problem is

To put it in short this is what give me the head ache:

--> Finished Dependency Resolution
Error: Package: policycoreutils-2.5-11.el7_3.x86_64 (base)
           Requires: libsepol.so.1(LIBSEPOL_1.0)(64bit)
Error: Package: libsemanage-2.5-5.1.el7_3.x86_64 (base)
           Requires: libsepol.so.1(LIBSEPOL_1.0)(64bit)
Error: Package: 1:NetworkManager-tui-1.4.0-14.el7_3.x86_64 (base)
           Requires: libjansson.so.4()(64bit)
Error: Package: libsemanage-2.5-5.1.el7_3.x86_64 (base)
           Requires: libsepol.so.1(LIBSEPOL_1.1)(64bit)
Error: Package: 7:lvm2-2.02.166-1.el7_3.2.x86_64 (base)
           Requires: device-mapper-persistent-data >= 0.6.3-1
           Installed: device-mapper-persistent-data-0.6.2-1.el7_2.x86_64 (@base)
               device-mapper-persistent-data = 0.6.2-1.el7_2
Error: Package: policycoreutils-2.5-11.el7_3.x86_64 (base)
           Requires: libselinux-utils >= 2.5-6
           Installed: libselinux-utils-2.2.2-6.el7.x86_64 (@anaconda)
               libselinux-utils = 2.2.2-6.el7
Error: Package: 1:NetworkManager-libnm-1.4.0-14.el7_3.x86_64 (base)
           Requires: libjansson.so.4()(64bit)
Error: Package: 1:NetworkManager-1.4.0-14.el7_3.x86_64 (base)
           Requires: libjansson.so.4()(64bit)
Error: Package: kernel-3.10.0-514.6.1.el7.x86_64 (base)
           Requires: linux-firmware >= 20160830-49
           Installed: linux-firmware-20150904-43.git6ebf5d5.el7.noarch (@anaconda)
               linux-firmware = 20150904-43.git6ebf5d5.el7
Error: Package: policycoreutils-2.5-11.el7_3.x86_64 (base)
           Requires: libsepol >= 2.5-6
           Installed: libsepol-2.1.9-3.el7.x86_64 (@anaconda)
               libsepol = 2.1.9-3.el7
Error: Package: policycoreutils-2.5-11.el7_3.x86_64 (base)
           Requires: libsepol.so.1(LIBSEPOL_1.1)(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest  

System information

The server runs CentOS 7. It has no extra repositories and uses only packages from the core CentOS 7 repos. There have been installed no software that is not provided by yum by default.

What I tried and what I found out

I have attempted a lot of things already, so I’ll try to rule those out:

Cleaning yum

yum clean all basically.

Wiping the yum cache directory

rm -rf /var/cache/yum and rebuilding with yum makecache

Checking repository

I have tried several repositories and with all of them I did check that the update files are actually there. I even tried downloading some of the RPM’s from the repo and updating them by hand, that works out just fine. But obviously I want yum to do this for me.

Checking repository configs

The files under /etc/yum.repos.d seem fine and match another server entirely, that works just perfect.

Checking the repolist

yum repolist — and here’s a finding! See:

# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id                             repo name                             status
base/7/x86_64                       CentOS-7 - Base                       807
extras/7/x86_64                     CentOS-7 - Extras                     807
updates/7/x86_64                    CentOS-7 - Updates                    807
repolist: 2,421 

Notice that there are only 807 packages in each. On my other servers there are way, way more available packages.

Checking the yum sqlite database

I tried downloading the primary_db.sqlite from the server to examine it with a SQLite editor. And there is in fact only 807 records in the packages table.

Obviously that has been cleared a ton of times, so it’s not an old left over.

… And this is where you guys come in. I’m out of good ideas, but to me it seems to be narrowed down to the number 807. Why are there only 807 packages? I have, of course, googled like a maniac but I can’t find anything like this.

I found another thread on here with someone who seems to have the same problem, but didn’t give much info: Dependency conflict when updating Yum in CentOS 7

Updates

Comment 1

yum.conf

[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release


#  This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
#  It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d 

All yum.repos.d files
http://pastebin.centos.org/65881/

Всем привет!

Пытаюсь обновить пакеты на сервере. Запускаю yum update
Получаю:

Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in <module>
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 375, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 281, in main
    return_code = base.doTransaction()
  File "/usr/share/yum-cli/cli.py", line 817, in doTransaction
    resultobject = self.runTransaction(cb=cb)
  File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 1852, in runTransaction
    self.skipped_packages, rpmdb_problems, cmdline)
  File "/usr/lib/python2.7/site-packages/yum/history.py", line 947, in beg
    pid   = self.pkg2pid(txmbr.po)
  File "/usr/lib/python2.7/site-packages/yum/history.py", line 804, in pkg2pid
    return self._ipkg2pid(po, create)
  File "/usr/lib/python2.7/site-packages/yum/history.py", line 798, in _ipkg2pid
    return self._pkgtup2pid(po.pkgtup, csum, create)
  File "/usr/lib/python2.7/site-packages/yum/history.py", line 781, in _pkgtup2pid
    checksum))
  File "/usr/lib/python2.7/site-packages/yum/sqlutils.py", line 168, in executeSQLQmark
    return cursor.execute(query, params)
sqlite3.ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.

Кто нибудь сталкивался? Как исправить? Спасибо заранее.
P.S. Что пробовал, но помогло
yum-complete-transaction
yum history new
rm -rf /var/cache/yum
yum clean all
rm -f /var/lib/rpm/__db*

Добрый день.
Хотелось бы предупредить недовольство участников форума и принести извИнения, если не верно выбрал раздел для вопроса.
Ну и за то, что не смог найти решение своей проблемы в поисковике.

Преамбула:
Линуксом пользуюсь, от силы, второй день — т.ч…

По проблеме:
Fedora 21, выполнен yum update, после первой загрузки, добавлены какие-то репозитории (К сожалению не могу сказать какие — команды для просмотра не знаю, по какой статье делал не помню… Вот такой вот ламер 8( )

При выполнении sudo yum update следующая ошибка:

Загружены модули: langpacks
adobe-linux-i386                                            |  
951 B  00:00     
adobe-linux-x86_64                                          |  951 B  00:00     
fedora/21/x86_64/metalink                                   |  31 kB  00:00     
rpmfusion-free                                              | 1.2 kB  00:00     
rpmfusion-free-updates                                      | 2.7 kB  00:00     
rpmfusion-nonfree                                           | 1.2 kB  00:00     
rpmfusion-nonfree-updates                                   | 2.7 kB  00:00     
Could not retrieve mirrorlist http://mirrors.rfremix.ru/mirrorlist?repo=free-fedora-updates-released-21&arch=x86_64 error was
12: Timeout on http://mirrors.rfremix.ru/mirrorlist?repo=free-fedora-updates-released-21&arch=x86_64: (28, 'Connection timed out after 30001 milliseconds')
^CCould not retrieve mirrorlist http://mirrors.rfremix.ru/mirrorlist?repo=nonfree-fedora-21&arch=x86_64 error was
14: curl#56 - "Callback aborted"


 One of the configured repositories failed (Russian Fedora for Fedora 21 - Nonfree),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Disable the repository, so yum won't use it by default. Yum will then
        just ignore the repository until you permanently enable it again or use
        --enablerepo for temporary usage:

            yum-config-manager --disable russianfedora-nonfree

     4. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=russianfedora-nonfree.skip_if_unavailable=true

Cannot find a valid baseurl for repo: russianfedora-nonfree/21/x86_64

______________________________

Пробовал сделать:
sudo yum-config-manager —disable russianfedora-nonfree
Результат:



========================= repo: russianfedora-nonfree ==========================
[russianfedora-nonfree]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/21
baseurl = 
cache = 0
cachedir = /var/cache/yum/x86_64/21/russianfedora-nonfree
check_config_file_age = True
cost = 1000
deltarpm_metadata_percentage = 100
deltarpm_percentage = 
enabled = 0
enablegroups = True
exclude = 
failovermethod = priority
gpgcadir = /var/lib/yum/repos/x86_64/21/russianfedora-nonfree/gpgcadir
gpgcakey = 
gpgcheck = True
gpgdir = /var/lib/yum/repos/x86_64/21/russianfedora-nonfree/gpgdir
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-russianfedora-nonfree-fedora
hdrdir = /var/cache/yum/x86_64/21/russianfedora-nonfree/headers
http_caching = all
includepkgs = 
ip_resolve = 
keepalive = True
keepcache = False
mddownloadpolicy = sqlite
mdpolicy = group:small
mediaid = 
metadata_expire = 21600
metadata_expire_filter = read-only:present
metalink = 
minrate = 0
mirrorlist = http://mirrors.rfremix.ru/mirrorlist?repo=nonfree-fedora-21&arch=x86_64
mirrorlist_expire = 86400
name = Russian Fedora for Fedora 21 - Nonfree
old_base_cache_dir = 
password = 
persistdir = /var/lib/yum/repos/x86_64/21/russianfedora-nonfree
pkgdir = /var/cache/yum/x86_64/21/russianfedora-nonfree/packages
proxy = False
proxy_dict = 
proxy_password = 
proxy_username = 
repo_gpgcheck = False
retries = 10
skip_if_unavailable = False
ssl_check_cert_permissions = True
sslcacert = 
sslclientcert = 
sslclientkey = 
sslverify = True
throttle = 0
timeout = 30.0
ui_id = russianfedora-nonfree/21/x86_64
ui_repoid_vars = releasever,
   basearch
username = 

После чего еще раз запустить:
sudo yum update — результат аналогичен первому запуску.

При этом смущает, что http://mirrors.rfremix.ru в браузере не открывается, ping на mirrors.rfremix.ru не проходит.

Но форуме, вот в этой теме:
Fedora 18 ошибка при обновлении

Нашел вариант с:
repoquery —whatrequires —recursive PACKAGENAME

Но, повторюсь, т.к. с линуксом полный ноль — даже не представляю, что делает данная команда (ушел читать).

_______________________________________________

Решение
_______________________________________________

Если кто-то из таких же нубов, как и я, зайдет — что бы не читать комментарии по оформлению и ошибкам:

Данная команда очищает кэш, на сколько понял из описания.
Кстати, есть еще и команда на создание кэша, но я её не применял:

После этого я получил ошибку по flash’y и «Разрешение зависимостей» — было решено через «yum remove» для флэша и его переустановкой.

Понравилась статья? Поделить с друзьями:
  • Нет папки загрузки на компьютере как найти
  • Не удаляется файл как исправить
  • Как найти синус 1200
  • Как найти химическую реакцию элементов
  • Как найти точки окружности если известен радиус