当前位置:   article > 正文

记一次yum源报错解决:linux的yum命令报错Loaded plugins / Repository epel is listed more than once_repository epel is listed more than once in the co

repository epel is listed more than once in the configuration

 

执行yum install命令时报错 Loaded plugins: fastestmirror, langpacks 

Repository epel is listed more than once in the configuration

执行yum list命令时报错 Existing lock /var/run/yum.pid: another copy is running as pid 10841.

 

报错出现的情况具体为:

[root@xx_0_15_centos /]# 
[root@xx_0_15_centos /]#  yum install
Loaded plugins: fastestmirror, langpacks
Repository epel is listed more than once in the configuration

Error: Need to pass a list of pkgs to install
 Mini usage:

install PACKAGE...

Install a package or packages on your system

aliases: install-n, install-na, install-nevra
[root@xx_0_15_centos /]# 

===================================

[root@xx_0_15_centos /]# 
[root@xx_0_15_centos /]# yum install
Repository epel is listed more than once in the configuration
Error: Need to pass a list of pkgs to install
 Mini usage:

install PACKAGE...

Install a package or packages on your system

aliases: install-n, install-na, install-nevra
[root@xx_0_15_centos /]# 
[root@xx_0_15_centos yum.repos.d]# yum clean all
Repository epel is listed more than once in the configuration
Existing lock /var/run/yum.pid: another copy is running as pid 18533.

Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  40 M RSS (432 MB VSZ)
    Started: Sun Feb 21 09:54:29 2021 - 1:18:09 ago
    State  : Traced/Stopped, pid: 18533
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  40 M RSS (432 MB VSZ)
    Started: Sun Feb 21 09:54:29 2021 - 1:18:11 ago
    State  : Traced/Stopped, pid: 18533

[root@xx_0_15_centos /]# 
[root@xx_0_15_centos /]# yum list installed | grep docker
Repository epel is listed more than once in the configuration
[root@xx_0_15_centos /]# 

[root@xx_0_15_centos yum.repos.d]# 
[root@xx_0_15_centos yum.repos.d]# yum list
Existing lock /var/run/yum.pid: another copy is running as pid 10841.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  43 M RSS (435 MB VSZ)
    Started: Sun Feb 21 14:43:10 2021 - 00:37 ago
    State  : Traced/Stopped, pid: 10841
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  43 M RSS (435 MB VSZ)
    Started: Sun Feb 21 14:43:10 2021 - 00:39 ago
    State  : Traced/Stopped, pid: 10841
 

 

第一个错误 (Loaded plugins: fastestmirror, langpacks)

yum install 的时候提示:Loaded plugins: fastestmirror, langpacks(fastestmirror是yum的一个加速插件,这里是插件提示信息是插件不能用了。)

于是进行解决

1.修改插件的配置文件

vi /etc/yum/pluginconf.d/fastestmirror.conf

enabled = 1   //由1改为0,禁用该插件 1

2.修改yum的配置文件

vi /etc/yum.conf 

plugins=1  //改为0,不使用插件 1

3 清除缓存并重新构建yum源

yum clean all

yum clean dbcache

yum makecache

(注:此种方法临时用可以,但不能应用于生产环境)参考资料:Loaded plugins:fastestmirror,langpacks并非错误,而是两者插件。fastest是最快的,mirror是镜像。所以fastestmirror是帮助你找到最快捷的yum仓库的插件,lang是language语言的缩写,packs是packages包裹的缩写,langpacks是语言包插件。不建议采用在/etc/yum.repos.d目录中打开.repo文件,将gpgcheck=1改成0  的方法。GPGCHECK是检查软件包是否被篡改的一个重要工具。1是启用,0是禁用。把它由1改0,等于放弃安全检查。这无异于把自己家的大门拆掉窗户打开防盗网卸掉。随便什么人什么时间都能进你家来。自己玩玩linux可以,在生产环境中,最好别这么做。 https://zhidao.baidu.com/question/2079050521830535708.html

第二个错误 (Repository epel is listed more than once in the configuration)

但这时候执行yum clean all又报错了: Repository epel is listed more than once in the configuration
Existing lock /var/run/yum.pid: another copy is running as pid 18533. (这里其实是有两个报错,挨个进行解决)

[root@VM_0_15_centos yum.repos.d]# yum clean all
Repository epel is listed more than once in the configuration
Existing lock /var/run/yum.pid: another copy is running as pid 18533.

Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  40 M RSS (432 MB VSZ)
    Started: Sun Feb 21 09:54:29 2021 - 1:18:09 ago
    State  : Traced/Stopped, pid: 18533
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  40 M RSS (432 MB VSZ)
    Started: Sun Feb 21 09:54:29 2021 - 1:18:11 ago
    State  : Traced/Stopped, pid: 18533
Another app is currently holding the yum lock; waiting for it to exit...
 

解决方案:

1、打包/etc/yum.repos.d/目录下的所有文件,以备恢复使用,运行命令:zip centos7-repo.zip /etc/yum.repos.d/*

2、打包完毕,再运行ls命令查看多了一个zip文件,正是我们打包的文件

[root@xx_0_15_centos yum.repos.d]# ls
centos7-repo.zip  CentOS-Base.repo  CentOS-Epel.repo  epel.repo  epel-testing.repo
[root@xx_0_15_centos yum.repos.d]# 

3、删除多余文件,运行rm -rf !(centos7-repo.zip)命令,意思是删除除.zip文件以外的所有文件,再次ls查看已经都删除了

4、到阿里开源镜像站点下载系统对应版本的repo文件,运行wget http://mirrors.aliyun.com/repo/Centos-7.repo命令

下载完后再次查看已经多出来一个centos-8.repo文件,再次运行yum list installed | grep docker命令,不再有任何提示。说明没有安装过docker!

这时报错Repository epel is listed more than once in the configuration已经修复,执行yum list installed | grep docker可以测出已修复。

第三个错误 (Existing lock xxx pid xxx)

但报错Existing lock /var/run/yum.pid: another copy is running as pid 18533.依然存在

Existing lock xxx pid xxx 这个报错的原因是:之前安装时是异常停止的,被锁定。一般正常安装完的,就没有这个文件了

解决方案:

1. /var/run/yum.pid

2.将 /var/run/ 目录下的 yum.pid文件删除即可。

 

 

 

 

===========================

相关的一个报错:

sudo rpm --import https://xxxxx 执行命令时报错 sudo: rpm--import: command not found

[root@xx_0_15_centos /]# 
[root@xx_0_15_centos /]# sudo rpm--import https:///
sudo: rpm--import: command not found
[root@xx_0_15_centos /]# 
[root@xx_0_15_centos /]# sudo apt-get install alien
sudo: apt-get: command not found

修改sudo配置文件  执行命令sudo visudo

将执行失败的命令 其执行路径添加至secure_path

#Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin
Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin/sbin:/usr/bin/rpm
 

在这里,查看命令的执行路径 或者 判断一个命令是Linux内置系统命令还是shell内置命令,

可通过 type 命令进行判断:

[root@VM_0_15_centos /]# type cd
cd is a shell builtin
[root@VM_0_15_centos /]# 
[root@VM_0_15_centos /]# type rpm
rpm is /usr/bin/rpm

 

 

参考资料:https://www.cnblogs.com/zkwarrior/p/13528734.html

https://blog.csdn.net/wy_bk/article/details/89648052

https://blog.csdn.net/ly0303521/article/details/45457487

https://blog.csdn.net/jiangxuege/article/details/82592258

https://blog.csdn.net/lanchunhui/article/details/51559439

https://blog.csdn.net/qq_35023116/article/details/89603442

 

 

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/176879
推荐阅读
相关标签
  

闽ICP备14008679号