yum [Errno 256] No more mirrors to try 解决方法

本文记录了在安装SystemTap过程中遇到的问题及解决方法。通过清理缓存并重建缓存解决了因重复配置和找不到资源导致的更新失败问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转载自: http://blog.sina.com.cn/s/blog_6e0c0fdf01019onq.html

我的在安装systemtap时候出现这问题。

输入下面的命令即可解决问题:

  1. yum clean all
  2. yum makecache

[root@localhost yum]# yum update
Loaded plugins: fastestmirror, refresh-packagekit, security
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Determining fastest mirrors
epel/metalink                                            | 4.6 kB     00:00    
 * epel: mirrors.yun-idc.com
 * rpmforge: mirrors.neusoft.edu.cn
http://mirrors.163.com/centos/$releasever/os/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
[root@localhost yum]# vi /etc/yum.conf
[root@localhost yum]# yum update -y
Loaded plugins: fastestmirror, refresh-packagekit, security
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
epel/metalink                                            | 4.6 kB     00:00    
 * epel: mirrors.yun-idc.com
 * rpmforge: mirrors.neusoft.edu.cn
base                                                     | 3.7 kB     00:00    
extras                                                   | 3.5 kB     00:00    
rpmforge                                                 | 1.9 kB     00:00    
updates                                                  | 3.4 kB     00:00    
Not using downloaded repomd.xml because it is older than what we have:
  Current   : Wed Aug 28 03:09:59 2013
  Downloaded: Wed Aug 21 16:16:03 2013
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package bind-libs.i686 32:9.8.2-0.17.rc1.el6_4.5 will be updated
---> Package bind-libs.i686 32:9.8.2-0.17.rc1.el6_4.6 will be an update
---> Package bind-utils.i686 32:9.8.2-0.17.rc1.el6_4.5 will be updated
---> Package bind-utils.i686 32:9.8.2-0.17.rc1.el6_4.6 will be an update
---> Package device-mapper-multipath.i686 0:0.4.9-64.el6_4.1 will be updated
---> Package device-mapper-multipath.i686 0:0.4.9-64.el6_4.2 will be an update
---> Package device-mapper-multipath-libs.i686 0:0.4.9-64.el6_4.1 will be updated
---> Package device-mapper-multipath-libs.i686 0:0.4.9-64.el6_4.2 will be an update
---> Package gnome-screensaver.i686 0:2.28.3-24.el6 will be updated
---> Package gnome-screensaver.i686 0:2.28.3-24.el6_4.1 will be an update
---> Package kpartx.i686 0:0.4.9-64.el6_4.1 will be updated
---> Package kpartx.i686 0:0.4.9-64.el6_4.2 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                       Arch  Version                     Repository
                                                                           Size
================================================================================
Updating:
 bind-libs                     i686  32:9.8.2-0.17.rc1.el6_4.6   updates 889 k
 bind-utils                    i686  32:9.8.2-0.17.rc1.el6_4.6   updates 181 k
 device-mapper-multipath       i686  0.4.9-64.el6_4.2            updates  112 k
 device-mapper-multipath-libs  i686  0.4.9-64.el6_4.2            updates  176 k
 gnome-screensaver             i686  2.28.3-24.el6_4.1           updates 4.3 M
 kpartx                        i686  0.4.9-64.el6_4.2            updates   55 k

Transaction Summary
================================================================================
Upgrade       6 Package(s)

Total download size: 5.6 M
Downloading Packages:
http://mirrors.163.com/centos/6/updates/i386/Packages/bind-libs-9.8.2-0.17.rc1.el6_4.6.i686.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
http://mirrors.163.com/centos/6/updates/i386/Packages/bind-utils-9.8.2-0.17.rc1.el6_4.6.i686.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
http://mirrors.163.com/centos/6/updates/i386/Packages/device-mapper-multipath-0.4.9-64.el6_4.2.i686.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
http://mirrors.163.com/centos/6/updates/i386/Packages/device-mapper-multipath-libs-0.4.9-64.el6_4.2.i686.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
http://mirrors.163.com/centos/6/updates/i386/Packages/gnome-screensaver-2.28.3-24.el6_4.1.i686.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
http://mirrors.163.com/centos/6/updates/i386/Packages/kpartx-0.4.9-64.el6_4.2.i686.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.


Error Downloading Packages:
  device-mapper-multipath-0.4.9-64.el6_4.2.i686: failure: Packages/device-mapper-multipath-0.4.9-64.el6_4.2.i686.rpm from updates: [Errno 256] No more mirrors to try.
  kpartx-0.4.9-64.el6_4.2.i686: failure: Packages/kpartx-0.4.9-64.el6_4.2.i686.rpm from updates: [Errno 256] No more mirrors to try.
  32:bind-utils-9.8.2-0.17.rc1.el6_4.6.i686: failure: Packages/bind-utils-9.8.2-0.17.rc1.el6_4.6.i686.rpm from updates: [Errno 256] No more mirrors to try.
  gnome-screensaver-2.28.3-24.el6_4.1.i686: failure: Packages/gnome-screensaver-2.28.3-24.el6_4.1.i686.rpm from updates: [Errno 256] No more mirrors to try.
  device-mapper-multipath-libs-0.4.9-64.el6_4.2.i686: failure: Packages/device-mapper-multipath-libs-0.4.9-64.el6_4.2.i686.rpm from updates: [Errno 256] No more mirrors to try.
  32:bind-libs-9.8.2-0.17.rc1.el6_4.6.i686: failure: Packages/bind-libs-9.8.2-0.17.rc1.el6_4.6.i686.rpm from updates: [Errno 256] No more mirrors to try.

[root@localhost yum]# yum clean all
Loaded plugins: fastestmirror, refresh-packagekit, security
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Cleaning repos: base epel extras rpmforge updates
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@localhost yum]# yum makecache
Loaded plugins: fastestmirror, refresh-packagekit, security
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Determining fastest mirrors
epel/metalink                                            | 4.6 kB     00:00    
 * epel: mirrors.yun-idc.com
 * rpmforge: mirrors.neusoft.edu.cn
base                                                     | 3.7 kB     00:00    
base/group_gz                                            | 209 kB     00:00    
base/filelists_db                                        | 4.9 MB     00:03    
base/primary_db                                         | 3.4 MB     00:00    
base/other_db                                            | 2.0 MB     00:01    
epel                                                     | 4.2 kB     00:00    
epel/group_gz                                            | 237 kB     00:00    
epel/filelists_db                                        | 6.6 MB     00:01    
epel/primary_db                                         | 4.6 MB     00:00    
epel/other_db                                            | 2.6 MB     00:00    
epel/updateinfo                                         | 865 kB     00:00    
extras                                                   | 3.5 kB     00:00    
extras/filelists_db                                      | 10 kB     00:00    
extras/prestodelta                                       | 953 B     00:00    
extras/primary_db                                        19 kB     00:00    
extras/other_db                                         | 5.5 kB     00:00    
rpmforge                                                 | 1.9 kB     00:00    
rpmforge/filelists_db                                    | 2.3 MB     00:00    
rpmforge/primary_db                                      | 2.7 MB     00:01    
rpmforge/other_db                                        | 562 kB     00:00    
updates                                                  | 3.4 kB     00:00    
updates/filelists_db                                     | 3.2 MB     00:01    
updates/prestodelta                                      | 637 kB     00:00    
updates/primary_db                                       | 3.6 MB     00:01    
updates/other_db                                         | 423 kB     00:00    
epel/pkgtags                                             | 512 kB     00:00    
Metadata Cache Created
[root@localhost yum]# yum -y update
Loaded plugins: fastestmirror, refresh-packagekit, security
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * epel: mirrors.yun-idc.com
 * rpmforge: mirrors.neusoft.edu.cn
Setting up Update Process
No Packages marked for Update
[root@localhost yum]#


<think>嗯,用户遇到了在本地源安装时出现的错误,具体是yum或dnf报错[Errno 256] No more mirrors to try。我需要帮他解决这个问题。首先,我得回想一下这个错误通常是什么原因引起的。根据经验,这个错误通常和仓库配置或文件路径问题有关。可能的原因包括本地源配置不正确、仓库文件中的路径错误、权限问题,或者缓存损坏。 用户提到的是本地源安装,所以首先应该检查.repo文件的配置是否正确。比如,baseurl是否正确指向了本地路径,比如使用file://协议。可能需要检查文件路径是否存在,是否有拼写错误。例如,baseurl应该像file:///mnt/local_repo这样的格式,确保路径正确。 接下来,权限问题。用户可能没有正确设置本地仓库目录的权限,导致yum/dnf无法访问。需要确认目录的权限是否允许读取,比如755或777,同时SELinux是否阻止了访问,可能需要暂时禁用SELinux或者调整策略。 然后是缓存问题,有时候旧的缓存会导致问题,可以尝试清除yum/dnf的缓存,使用yum clean all或者dnf clean all命令,然后重新生成缓存。 另外,用户可能没有正确生成仓库元数据。本地仓库需要createrepo命令来生成必要的元数据文件,如果这一步没做或者执行不正确,会导致yum无法识别仓库内容。这时候需要检查是否在仓库目录下运行了createrepo . 命令。 还有可能仓库文件中的变量没有正确替换,比如$releasever在本地源中没有被正确替换,导致路径错误。这时候可能需要手动替换成具体的系统版本号,比如CentOS 7的话,替换成7,或者在.repo文件中直接写死路径,避免使用变量。 另外,检查是否有多个仓库冲突的情况,可能其他仓库配置错误导致无法访问,从而影响本地源。可以暂时禁用其他仓库,只启用本地源进行测试。 可能还需要检查网络设置,虽然本地源是本地路径,但某些情况下,比如在虚拟环境中,挂载点是否正确,或者是否使用了正确的协议(如file://而不是http://)。 最后,查看详细的错误日志,使用yum或dnf的verbose模式,比如yum --verbose update,或者查看/var/log/yum.log中的具体错误信息,以定位问题根源。 综合这些步骤,应该能够逐步排查并解决用户的问题。需要指导用户一步步检查配置文件、路径、权限、元数据生成等环节,确保每个部分都正确无误。</think>### 解决方案:修复本地源安装报错[Errno 256] No more mirrors to try #### 1. **检查本地源配置文件** - 确认`.repo`文件中的`baseurl`路径是否正确指向本地源目录(例如`file:///mnt/local_repo`)。 - 检查路径是否存在拼写错误,确保本地源目录已挂载且可访问[^3]。 ```bash # 示例配置(CentOS为例) [local-repo] name=Local Repository baseurl=file:///mnt/local_repo enabled=1 gpgcheck=0 ``` #### 2. **验证本地源元数据** - 本地源需通过`createrepo`生成元数据。若未生成,执行: ```bash yum install createrepo -y createrepo /mnt/local_repo # 替换为实际路径 ``` #### 3. **检查权限与SELinux** - 确保本地源目录权限允许读取: ```bash chmod -R 755 /mnt/local_repo ``` - 若SELinux启用,临时关闭测试: ```bash setenforce 0 # 临时禁用 # 或调整策略:chcon -R -t httpd_sys_content_t /mnt/local_repo ``` #### 4. **清除缓存并重建** ```bash yum clean all yum makecache # 或使用dnf dnf clean all dnf makecache ``` #### 5. **替换变量为具体值** - 若配置中使用`$releasever`等变量,手动替换为系统版本(如CentOS 7替换为`7`): ```bash # 查看系统版本 cat /etc/redhat-release ``` #### 6. **检查网络隔离与冲突** - 禁用其他仓库以排除干扰: ```bash yum --disablerepo=* --enablerepo=local-repo update ``` #### 7. **查看详细日志定位问题** ```bash yum update --verbose # 显示详细过程 tail -f /var/log/yum.log # 实时监控日志 ``` ---
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值