yum clean all 后导致yum报错排查解决方案

简介: yum clean all 后导致yum报错排查解决方案

1、yum clean all 后导致yum报错

一开始因为yum找不到包,所以打算更新一下yum仓库,结果遇到坑的博客直接yum不能使用了

使用yum update报错


[root@iZbp17aznee2whyk4k44vjZ ~]# yum update httpd
base                                                                                                                                                                                                                        | 3.6 kB  00:00:00     
extras                                                                                                                                                                                                                      | 2.9 kB  00:00:00     
updates                                                                                                                                                                                                                     | 2.9 kB  00:00:00     
No packages marked for update

感觉是yum的仓库给清理里没有包了


[root@iZbp17aznee2whyk4k44vjZ ~]# yum update httpd-tools
Resolving Dependencies
--> Running transaction check
---> Package httpd-tools.x86_64 0:2.4.6-90.el7.centos will be updated
--> Processing Dependency: httpd-tools = 2.4.6-90.el7.centos for package: httpd-2.4.6-90.el7.centos.x86_64
---> Package httpd-tools.x86_64 0:2.4.6-97.el7.centos.5 will be an update
--> Finished Dependency Resolution
Error: Package: httpd-2.4.6-90.el7.centos.x86_64 (@base)
           Requires: httpd-tools = 2.4.6-90.el7.centos
           Removing: httpd-tools-2.4.6-90.el7.centos.x86_64 (@base)
               httpd-tools = 2.4.6-90.el7.centos
           Updated By: httpd-tools-2.4.6-97.el7.centos.5.x86_64 (updates)
               httpd-tools = 2.4.6-97.el7.centos.5
           Available: httpd-tools-2.4.6-95.el7.centos.x86_64 (base)
               httpd-tools = 2.4.6-95.el7.centos
           Available: httpd-tools-2.4.6-97.el7.centos.x86_64 (updates)
               httpd-tools = 2.4.6-97.el7.centos
           Available: httpd-tools-2.4.6-97.el7.centos.1.x86_64 (updates)
               httpd-tools = 2.4.6-97.el7.centos.1
           Available: httpd-tools-2.4.6-97.el7.centos.2.x86_64 (updates)
               httpd-tools = 2.4.6-97.el7.centos.2
           Available: httpd-tools-2.4.6-97.el7.centos.4.x86_64 (updates)
               httpd-tools = 2.4.6-97.el7.centos.4
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

看到上面最后一句报错让我尝试rpm-Va --nofiles --nodigest


[root@iZbp17aznee2whyk4k44vjZ ~]#rpm -qa|grep yum|xargs rpm -e --nodeps 
warning: /etc/yum/pluginconf.d/fastestmirror.conf saved as /etc/yum/pluginconf.d/fastestmirror.conf.rpmsave
warning: /etc/yum.conf saved as /etc/yum.conf.rpmsave
[root@iZbp17aznee2whyk4k44vjZ ~]# rpm -qa |grep yum

后来到网站上找了几个下载依赖的地址都下载报错

Connecting to centos.ustc.edu.cn (centos.ustc.edu.cn)|202.141.160.110|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2022-10-19 10:13:06 ERROR 404: Not Found.
1
2
3

后来我直接访问这个地址直接是404

其实直接到官网下载就可以了

这时候你yum makecache肯定是-bash: /usr/bin/yum: No such file or directory

因为你这时候yum依赖

依旧还是没下载下来

2、最终解决方案

到官网下载对应依赖

你也可以直接


[root@iZbp17aznee2whyk4k44vjZ ~]#wget

http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
[root@iZbp17aznee2whyk4k44vjZ ~]#wget http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
[root@iZbp17aznee2whyk4k44vjZ ~]#wget http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm


然后你在安装一下


rpm -ivh yum-*

然后看安装结果

成功

yum一下看工具都回来了

如果你的yum源还是有问题建议你还是更新一下


3、更新yum源

切换到yum文件夹


cd /etc/yum.repos.d
1

将原来的yum源给备份


mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
1

指定路径下载

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
1

清除缓存


yum clean all
1

生成缓存


yum makecache
1

实际测试,可以用了


总结

yum工具没了重新安装yum

对应的三个工具

yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm

yum-3.4.3-168.el7.centos.noarch.rpm


相关文章
|
9天前
|
应用服务中间件 nginx
yum 安装报错 No package nginx available Error:Nothing to do
yum 安装报错 No package nginx available Error:Nothing to do
23 1
|
5月前
|
Linux
Centos8安装yum源时候出现的异常问题及解决方案(保好使)
Centos8安装yum源时候出现的异常问题及解决方案(保好使)
|
3月前
yum 报错:Another app is currently holding the yum lock; waiting for it to exit
开发过程中需要用到 yum 命令 有时候执行 yum 会报错如下
18 0
|
5月前
Cannot download repomd.xml解决CentOS8 yum安装AppStream报错
Cannot download repomd.xml解决CentOS8 yum安装AppStream报错
|
5月前
|
Linux
Centos yum报错: BDB1507 Thread died in Berkeley DB library
Centos yum报错: BDB1507 Thread died in Berkeley DB library
|
10月前
|
缓存
Centos8使用yum报错 Couldn‘t resolve host name for http://mirrorlist.centos.org/?releas
Centos8使用yum报错 Couldn‘t resolve host name for http://mirrorlist.centos.org/?releas
266 0
|
10月前
|
Linux Docker 容器
yum install docker报错:Another app is currently holding the yum lock
今天在centos7安装docker的时候yum报错。 在进程里查看下:ps -ef | grep update 把后台占用的更新进程杀掉。
82 0
|
11月前
[There are unfinished transactions remaining.]【使用本地YUM源安装服务报错解决方法】
[There are unfinished transactions remaining.]【使用本地YUM源安装服务报错解决方法】
|
11月前
使用本地YUM源安装服务报错以及解决办法
使用本地YUM源安装服务报错以及解决办法
QGS
|
应用服务中间件 nginx
Centos7yum安装nginx,处理端口占用报错
记Centos7yum安装nginx,处理端口占用报错
QGS
285 0
Centos7yum安装nginx,处理端口占用报错