诡异 YUM 问题: 无法找到(安装卸载)一个特定的包

2021-11-19 11:29:35 +08:00
 abcbuzhiming
CentOS 8.4 ,之前在 Nginx 官网,用编写 /etc/yum.repos.d/nginx.repo 的办法装上了 nginx stable 版本的 1.18 。

有新手在未通知我的情况下,给系统装了宝塔面板,然后我知道后,把宝塔面板给卸载了,然后噩梦就来了。

yum 安装其他包是正常的,唯独找不到 nginx 。为了确定问题在哪里,我进行了一系列测试

======
执行:yum install nginx
All matches were filtered out by exclude filtering for argument: nginx
Error: Unable to find a match: nginx

======
执行:yum remove nginx (我之前装的 nginx 还在系统上跑着,nginx 的命令还能用)
All matches were filtered out by exclude filtering for argument: nginx
No packages marked for removal.
Dependencies resolved.
Nothing to do.
Complete!


看到了吗?也找不到。于是我怀疑我的 /etc/yum.repos.d/ 路径下仓库配置文件被动过,于是全部删除,从正常机器上拷贝过来,然后 yum clean all ,yum makecache ,yum update 。全部执行后,问题造就。

======
执行命令: yum repolist all
nginx-stable nginx stable repo enabled

nginx 的仓库和其它正常机器上一模一样没问题


======
执行命令: yum list |grep nginx
好,现在区别来了,正常机器上有这两行
nginx.x86_64 1:1.20.1-1.el8.ngx @nginx-stable
nginx.x86_64 1:1.20.2-1.el8.ngx nginx-stable

而我的机器上缺这两行,其它的 nginx 模块都不缺。

======
执行命令: yum list installed |grep nginx
我的机器没有任何反馈,这表明 yum 认为自己未安装 nginx


现在,这个 Nginx 在我的机器上好像失踪了一般,无法被 yum 找到,但是之前被 yum 安装上去的那个 nginx 版本,还在正常的跑。我实在想不通这种现象如何产生的,我放狗翻遍国内国外社区,尝试了所有能找到的办法,除了把 yum 整个卸载重装以外的一切重置方法,我都试验过了,yum 还是找不到 Nginx ,但是安装其它的东西一切正常。
3393 次点击
所在节点    Linux
33 条回复
defunct9
2021-11-19 11:33:37 +08:00
开 ssh ,让我上去看看
actar
2021-11-19 11:36:19 +08:00
宝塔好像不是通过包管理器安装的,它是自己管理文件的。
sky96111
2021-11-19 11:44:53 +08:00
确实,宝塔很可能是直接运行二进制文件,全盘搜索一下 nginx 看看能不能找到
abcbuzhiming
2021-11-19 11:56:07 +08:00
@actar
@sky96111
我用 rpm -qa | grep nginx 可以找到之前安装的 nginx ,全盘检索也能找到之前安装的 nginx 。


但是我实在想不通为啥 yum 管理器里找不到 nginx 这个包了,无论我装还是没装,至少 yum 里应该存在 nginx 的包啊,连 yum list 都找不到 nginx 了
Osk
2021-11-19 11:58:46 +08:00
应该就是楼上说的原因了, `which nginx`看看, 检查一下 path, 全盘搜索 nginx, 处理掉配置文件, 服务单元, 然后 yum 重新安装 nginx 试试.

就如同 ./config; make install 装的软件一样, 不受包管理器管理, 包管理器自然找不到, 安装一时爽, 卸载火葬场.


这种简直是噩梦啊, 一些发行版还好, 自己打包用包管理器安装很方便, 一些就头疼了
Osk
2021-11-19 11:59:57 +08:00
不好意思, 看错了
abcbuzhiming
2021-11-19 12:46:23 +08:00
@Osk 按我的理解,不用包管理器安装的程序,包管理器确实看不到已经安装的程序。但是 yum install ,这种包自己的安装程序,为何也找不到 nginx 包呢?这就不符合理了
hyq
2021-11-19 13:01:33 +08:00
按我理解,rpm = redhat package manager, yum = Yellow dog Updater, Modified 。yum 不能 remove 已经安装的包,算是个小问题,但也能理解,它可能就是按照 repo 里的软件列表工作的。
abcbuzhiming
2021-11-19 13:08:52 +08:00
@hyq
这解释不了 yum install nginx 时返回提示
All matches were filtered out by exclude filtering for argument: nginx
Error: Unable to find a match: nginx

这表明安装器找不到 nginx

也解释不了:
yum list |grep nginx
也找不到
skiy
2021-11-19 13:35:52 +08:00
更新过源了没? update 一下再看看?源应该不会被改了吧?
abcbuzhiming
2021-11-19 13:37:58 +08:00
@skiy
我曾经怀疑我的 /etc/yum.repos.d/ 路径下仓库配置文件被动过,于是全部删除,从正常机器上拷贝过来,然后
yum clean all ,
yum makecache ,
yum update 。
全部执行后,问题依旧。
leeyuzhe
2021-11-19 13:43:13 +08:00
即使现在的 nginx 是由宝塔安装的,但不能解释源里面的 nginx 也没了吧。是不是源被动手脚了
zhangsanfeng2012
2021-11-19 13:48:16 +08:00
yum install epel-release
skiy
2021-11-19 13:50:18 +08:00
Osk
2021-11-19 13:59:10 +08:00
yum list --showduplicates | grep nginx 呢
dorothyREN
2021-11-19 14:15:29 +08:00
难道不应该是 yum search nginx 吗?
abcbuzhiming
2021-11-19 14:23:35 +08:00
@zhangsanfeng2012 安装 epel 仓库的方式早就试过,没有用


@skiy 这个 qa 我早在刚开始放狗的时候就搜索到了,它的问题和我一样,但是它的原因描述我根本看不懂:
yum fails to find or install non-modular content when a module provides the same package 。
翻译过来是: 当模块提供相同的包时,yum 无法找到或安装非模块化内容

这是什么意思,为什么说提供了相同的包?我现在是一个叫 nginx 的包都找不到



@Osk 输入这个命令后,出现了一大堆含有 nginx 这个名称的包,但是,根据和正常机器上的对比,正常机器上名称为 nginx.x86_64 的包,在这台机器上找不到
abcbuzhiming
2021-11-19 14:26:39 +08:00
@dorothyREN 您的这个命令,我刚才试验了一下,在正常机器上,反馈如下

================================================================================================ Name Exactly Matched: nginx ================================================================================================
nginx.x86_64 : High performance web server
=============================================================================================== Name & Summary Matched: nginx ===============================================================================================
collectd-nginx.x86_64 : Nginx plugin for collectd
munin-nginx.noarch : NGINX support for Munin resource monitoring
nginx-all-modules.noarch : A meta package that installs all available Nginx modules
nginx-debuginfo.x86_64 : Debug information for package nginx
nginx-filesystem.noarch : The basic directory layout for the Nginx server
nginx-mod-http-image-filter.x86_64 : Nginx HTTP image filter module
nginx-mod-http-perl.x86_64 : Nginx HTTP perl module
nginx-mod-http-xslt-filter.x86_64 : Nginx XSLT module
nginx-mod-mail.x86_64 : Nginx mail modules
nginx-mod-stream.x86_64 : Nginx stream modules
nginx-module-image-filter.x86_64 : nginx image filter dynamic module
nginx-module-image-filter-debuginfo.x86_64 : Debug information for package nginx-module-image-filter
nginx-module-njs.x86_64 : nginx njs dynamic modules
nginx-module-njs-debuginfo.x86_64 : Debug information for package nginx-module-njs
nginx-module-perl.x86_64 : nginx Perl dynamic module
nginx-module-perl-debuginfo.x86_64 : Debug information for package nginx-module-perl
nginx-module-xslt.x86_64 : nginx xslt dynamic module
nginx-module-xslt-debuginfo.x86_64 : Debug information for package nginx-module-xslt
pagure-web-nginx.noarch : Nginx configuration for Pagure
pcp-pmda-nginx.x86_64 : Performance Co-Pilot (PCP) metrics for the Nginx Webserver
python3-certbot-nginx.noarch : The nginx plugin for certbot


然后在这台不正常的机器上,反馈如下
=============================================================================================== Name & Summary Matched: nginx ===============================================================================================
collectd-nginx.x86_64 : Nginx plugin for collectd
munin-nginx.noarch : NGINX support for Munin resource monitoring
nginx-all-modules.noarch : A meta package that installs all available Nginx modules
nginx-debuginfo.x86_64 : Debug information for package nginx
nginx-filesystem.noarch : The basic directory layout for the Nginx server
nginx-mod-http-image-filter.x86_64 : Nginx HTTP image filter module
nginx-mod-http-perl.x86_64 : Nginx HTTP perl module
nginx-mod-http-xslt-filter.x86_64 : Nginx XSLT module
nginx-mod-mail.x86_64 : Nginx mail modules
nginx-mod-stream.x86_64 : Nginx stream modules
nginx-module-image-filter.x86_64 : nginx image filter dynamic module
nginx-module-image-filter-debuginfo.x86_64 : Debug information for package nginx-module-image-filter
nginx-module-njs.x86_64 : nginx njs dynamic modules
nginx-module-njs-debuginfo.x86_64 : Debug information for package nginx-module-njs
nginx-module-perl.x86_64 : nginx Perl dynamic module
nginx-module-perl-debuginfo.x86_64 : Debug information for package nginx-module-perl
nginx-module-xslt.x86_64 : nginx xslt dynamic module
nginx-module-xslt-debuginfo.x86_64 : Debug information for package nginx-module-xslt
pagure-web-nginx.noarch : Nginx configuration for Pagure
pcp-pmda-nginx.x86_64 : Performance Co-Pilot (PCP) metrics for the Nginx Webserver
python3-certbot-nginx.noarch : The nginx plugin for certbot


很显然,这台不正常的机器里,yum 没有找到 [nginx.x86_64 : High performance web serve] 这个东西。
dreasye
2021-11-19 14:28:00 +08:00
遇到过,之前用腾讯轻应用服务器时候,装了宝塔面板也遇到同样的问题。yum search nginx 就能发现宝塔面板的源里是没有 nginx 这个包的。用 yum install epel-release 的话,要注意 repo 里是有宝塔装好的 epel 源,会提示有重复的源,后面我就换其他系统镜像了。猜测宝塔给的源跟平常的源不一样
abcbuzhiming
2021-11-19 14:30:09 +08:00
@leeyuzhe 源如何动手脚?我已经把 /etc/yum.repos.d/ 路径下仓库配置文件 全部删除然后从正常机器移过来,然后
yum clean all ,
yum makecache ,
yum update 。
全部执行后,问题依旧

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/816495

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX