Chinaunix首页 | 论坛 | 博客
  • 博客访问: 772683
  • 博文数量: 217
  • 博客积分: 2401
  • 博客等级: 大尉
  • 技术积分: 2030
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-16 06:58
个人简介

怎么介绍?

文章分类

全部博文(217)

文章存档

2023年(2)

2022年(3)

2021年(29)

2020年(12)

2019年(5)

2018年(5)

2017年(5)

2016年(3)

2015年(6)

2014年(12)

2013年(16)

2012年(9)

2011年(6)

2010年(15)

2009年(30)

2008年(59)

我的朋友

分类: LINUX

2017-03-28 19:41:56



On Red Hat based systems such as RHEL, CentOS or Fedora, yum is used as a package management tool for installing, updating and removing RPM packages. When you try to install a package with yum command, you may encounter errors for various reasons. In this post, I will describe several common error symptoms for the yumcommand, and explain how to fix yum errors.

1. Fix 404 Errors

Symptom: When you try to install a package with yum, yum throws an error: "The requested URL returned error: 404
Not Found"

Loaded plugins: fastestmirror
base                                                     | 3.7 kB     00:00
base/primary_db                                          | 4.4 MB     00:09
extras                                                   | 3.5 kB     00:00

[Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404
Not Found"
Trying other mirror.

[Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404
Not Found"
Trying other mirror.

You can get these 404 errors when the metadata downloaded by yum has become obsolete.

To repair yum 404 errors, clean yum metadata as follows.

$ sudo yum clean metadata

Or you can clear the whole yum cache:

$ sudo yum clean all

2. Fix Connection Failure Errors

Symptom: You get "network is unreachable" or "couldn't connect to host" errors while running yum command.

Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist
 error was
14: PYCURL ERROR 7 - "Failed to connect to
2a02:2498:1:3d:5054:ff:fed3:e91a: Network is unreachable"
Error: Cannot find a valid baseurl for repo: base


[Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
Trying other mirror.

[Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
Trying other mirror.

[Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
Trying other mirror.

The error means that you cannot properly connect to repository servers for some reason. If you can still ping the servers without any problem, check if your system is behind a proxy. If you are running yum behind a proxy, but have not specified the proxy in the yum configuration, you will get connection failure errors like the above.

To configure a proxy in the yum configuration:

$ sudo vi /etc/yum.conf
[main]
proxy=

3. Fix Metadata Checksum Errors

Symptom: You get "Metadata file does not match checksum" while running yum command.

epel/pkgtags                                             | 466 kB     00:14     
 [Errno -1] Metadata file does not match checksum
Trying other mirror.

You can get the metadata checksum errors when the metadata downloaded by yum has become outdated.

To repair yum checksum errors, clean yum metadata:

$ sudo yum clean metadata

4. Fix Yum Lock Errors

Symptom: When you attempt to install a package with yum, you get an error saying that "Another app is currently holding the yum lock."

Loaded plugins: langpacks, presto, refresh-packagekit
Existing lock /var/run/yum.pid: another copy is running as pid 1880.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory : 178 M RSS (586 MB VSZ)
    Started: Tue Jul  9 09:43:17 2013 - 00:12 ago
    State  : Sleeping, pid: 1880

The culprit for this error is PackageKit which is responsible for auto updates on Red Hat based systems. The PackageKit process gets automatically started upon boot, holding the yum lock.

To fix the error, turn off PackageKit on your system, so that it won't perform auto update checks. Here is an instruction for .

Once you reboot your desktop, you will no longer get yum lock errors.

5. Fix Repository Database Read Errors

Symptom: When you install a package with yum, you get the errors saying that "compressed file ended before the logical end-of-stream was detected"

Loaded plugins: langpacks, refresh-packagekit
Error: Error reading from file /var/cache/yum/x86_64/20/rpmfusion-free-updates/1461ed771601e7963990534c16584ab963d9c9f4eea94348ba357b93ab3c621f-primary.sqlite.bz2: compressed file ended before the logical end-of-stream was detected

This error can happen when yum command has been interrupted while it was downloading a repository database. So the saved database is incomplete, and considered corrupted.

To solve this problem, clean up yum database by running:

$ sudo yum clean metadata

6. Fix Repository Metadata Read Errors

Symptom: When you install or search for any package with yum, you get the following errors:

removing mirrorlist with no valid mirrors: /var/cache/yum/i386/6/updates/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: updates

This error can happen due to yum metadata issues. To fix this problem, clean up yum data including metadata and local cache.

$ sudo yum clean all

7. Fix Packages Database Error

Symptom: You are getting "cannot open Packages database in /var/lib/rpm" error while running the yumcommand.

error: rpmdb: BDB0113 Thread/process 6983/140505029793600 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

This problem can happen when the local RPM database got corrupted or missing for some reason. Here is how to recreate the RPM database to fix this error.

$ sudo rm -f /var/lib/rpm/__db*
$ sudo db_verify /var/lib/rpm/Packages
$ sudo rpm --rebuilddb
$ sudo yum clean all
阅读(1155) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~