V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
abcbuzhiming
V2EX  ›  Linux

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

  •  
  •   abcbuzhiming · 2021-11-19 11:29:35 +08:00 · 3369 次点击
    这是一个创建于 881 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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 ,但是安装其它的东西一切正常。
    33 条回复    2021-11-19 20:48:36 +08:00
    defunct9
        1
    defunct9  
       2021-11-19 11:33:37 +08:00
    开 ssh ,让我上去看看
    actar
        2
    actar  
       2021-11-19 11:36:19 +08:00
    宝塔好像不是通过包管理器安装的,它是自己管理文件的。
    sky96111
        3
    sky96111  
       2021-11-19 11:44:53 +08:00
    确实,宝塔很可能是直接运行二进制文件,全盘搜索一下 nginx 看看能不能找到
    abcbuzhiming
        4
    abcbuzhiming  
    OP
       2021-11-19 11:56:07 +08:00
    @actar
    @sky96111
    我用 rpm -qa | grep nginx 可以找到之前安装的 nginx ,全盘检索也能找到之前安装的 nginx 。


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

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


    这种简直是噩梦啊, 一些发行版还好, 自己打包用包管理器安装很方便, 一些就头疼了
    Osk
        6
    Osk  
       2021-11-19 11:59:57 +08:00
    不好意思, 看错了
    abcbuzhiming
        7
    abcbuzhiming  
    OP
       2021-11-19 12:46:23 +08:00
    @Osk 按我的理解,不用包管理器安装的程序,包管理器确实看不到已经安装的程序。但是 yum install ,这种包自己的安装程序,为何也找不到 nginx 包呢?这就不符合理了
    hyq
        8
    hyq  
       2021-11-19 13:01:33 +08:00
    按我理解,rpm = redhat package manager, yum = Yellow dog Updater, Modified 。yum 不能 remove 已经安装的包,算是个小问题,但也能理解,它可能就是按照 repo 里的软件列表工作的。
    abcbuzhiming
        9
    abcbuzhiming  
    OP
       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
        10
    skiy  
       2021-11-19 13:35:52 +08:00
    更新过源了没? update 一下再看看?源应该不会被改了吧?
    abcbuzhiming
        11
    abcbuzhiming  
    OP
       2021-11-19 13:37:58 +08:00
    @skiy
    我曾经怀疑我的 /etc/yum.repos.d/ 路径下仓库配置文件被动过,于是全部删除,从正常机器上拷贝过来,然后
    yum clean all ,
    yum makecache ,
    yum update 。
    全部执行后,问题依旧。
    leeyuzhe
        12
    leeyuzhe  
       2021-11-19 13:43:13 +08:00
    即使现在的 nginx 是由宝塔安装的,但不能解释源里面的 nginx 也没了吧。是不是源被动手脚了
    zhangsanfeng2012
        13
    zhangsanfeng2012  
       2021-11-19 13:48:16 +08:00
    yum install epel-release
    skiy
        14
    skiy  
       2021-11-19 13:50:18 +08:00
    Osk
        15
    Osk  
       2021-11-19 13:59:10 +08:00
    yum list --showduplicates | grep nginx 呢
    dorothyREN
        16
    dorothyREN  
       2021-11-19 14:15:29 +08:00
    难道不应该是 yum search nginx 吗?
    abcbuzhiming
        17
    abcbuzhiming  
    OP
       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
        18
    abcbuzhiming  
    OP
       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
        19
    dreasye  
       2021-11-19 14:28:00 +08:00
    遇到过,之前用腾讯轻应用服务器时候,装了宝塔面板也遇到同样的问题。yum search nginx 就能发现宝塔面板的源里是没有 nginx 这个包的。用 yum install epel-release 的话,要注意 repo 里是有宝塔装好的 epel 源,会提示有重复的源,后面我就换其他系统镜像了。猜测宝塔给的源跟平常的源不一样
    abcbuzhiming
        20
    abcbuzhiming  
    OP
       2021-11-19 14:30:09 +08:00
    @leeyuzhe 源如何动手脚?我已经把 /etc/yum.repos.d/ 路径下仓库配置文件 全部删除然后从正常机器移过来,然后
    yum clean all ,
    yum makecache ,
    yum update 。
    全部执行后,问题依旧
    abcbuzhiming
        21
    abcbuzhiming  
    OP
       2021-11-19 14:31:53 +08:00
    @dreasye 那宝塔写入的源到底要如何清洗掉,我都把 /etc/yum.repos.d/ 清洗了一遍了
    dreasye
        22
    dreasye  
       2021-11-19 14:47:42 +08:00
    @abcbuzhiming 那会我折腾半天弄不好,网上也没找到相关的问题,加上没有重要的东西在上面,直接重置镜像了。没法做参考(掩面
    neilyoone
        23
    neilyoone  
       2021-11-19 15:16:35 +08:00
    干了这么多年 运维
    好奇的我去 Google 一下“宝塔面板” 是虾米

    这个针对小白用户 可能有点用处, 几百几千台的 VM 资源 肯定不适用了吧
    skiy
        25
    skiy  
       2021-11-19 16:05:13 +08:00
    # yum install nginx
    Last metadata expiration check: 1:57:02 ago on Fri 19 Nov 2021 02:04:51 PM CST.
    Dependencies resolved.
    ===================================================================================================================================================================================================================
    Package Architecture Version Repository Size
    ===================================================================================================================================================================================================================
    Installing:
    nginx x86_64 1:1.14.1-9.module_el8.0.0+184+e34fea82 appstream 570 k
    Installing dependencies:
    nginx-all-modules noarch 1:1.14.1-9.module_el8.0.0+184+e34fea82 appstream 23 k
    nginx-filesystem noarch 1:1.14.1-9.module_el8.0.0+184+e34fea82 appstream 24 k
    nginx-mod-http-image-filter x86_64 1:1.14.1-9.module_el8.0.0+184+e34fea82 appstream 35 k
    nginx-mod-http-perl x86_64 1:1.14.1-9.module_el8.0.0+184+e34fea82 appstream 45 k
    nginx-mod-http-xslt-filter x86_64 1:1.14.1-9.module_el8.0.0+184+e34fea82 appstream 33 k
    nginx-mod-mail x86_64 1:1.14.1-9.module_el8.0.0+184+e34fea82 appstream 64 k
    nginx-mod-stream x86_64 1:1.14.1-9.module_el8.0.0+184+e34fea82 appstream 85 k

    Transaction Summary
    ===================================================================================================================================================================================================================
    Install 8 Packages

    Total download size: 881 k
    Installed size: 2.0 M
    Is this ok [y/N]:


    ********************************************************************

    看了下,是 appstream 源的,你看看有没有这个文件:
    /etc/yum.repos.d/CentOS-Linux-AppStream.repo
    [appstream]
    name=CentOS Linux $releasever - AppStream
    mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
    #baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/
    gpgcheck=1
    enabled=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
    leeyuzhe
        26
    leeyuzhe  
       2021-11-19 16:07:07 +08:00
    那就真的有点奇怪了,我现在的想法跟一楼一样了
    Droi
        27
    Droi  
       2021-11-19 17:15:49 +08:00
    yum list available | grep nginx 看看源里有没有包
    yum install --downloadonly --downloaddir=/tmp nginx 只下载试试

    还不行就安装 RPM 包或者源码吧
    learningman
        28
    learningman  
       2021-11-19 17:33:19 +08:00
    宝塔有两种安装模式,源码 make install 或者一个他们自己打包的 rpm
    先检查下 nginx 有没有指向的程序,再一步步分析吧
    abcbuzhiming
        29
    abcbuzhiming  
    OP
       2021-11-19 19:47:34 +08:00
    @yjd 试过了,没有用


    @skiy 我有这个 /etc/yum.repos.d/CentOS-Linux-AppStream.repo 文件,内容和你一样,没用,我现在感觉不是这类文件的问题,因为 /etc/yum.repos.d/目录下的所有文件都被我删除了然后从正常机器里拷贝了一个过来


    @Droi 你这个是能显示出包来,但是还是一样,看上去都是周边的包,最关键的 nginx.x86_64 ,这个,就没有


    @learningman 我现在感到困惑的是,就算宝塔给我装了一个 [自定义版 Nginx] 进来,它也不应该干扰到 Yum 自己的包管理,yum install 也找不到 Nginx 到底是什么鬼。按理说 yum 的所有源配置文件都在 /etc/yum.repos.d/ 目录下,问题是这个目录都被我洗了一遍了,yum 还是无法恢复正常,而且神奇的是,只有这个包如此
    skiy
        30
    skiy  
       2021-11-19 20:21:13 +08:00
    @abcbuzhiming 刚刚在一台装了 BT 的机子上面去运行 yum install nginx ,也是没找到。

    No match for argument: nginx
    Error: Unable to find a match

    不过我的是 8.0 的系统,没有 Stream 。
    用其它那些工具安装一个试试,看看能不能修复?比如 oneinstack 或 lnmp.org

    感觉你这个问题得找 BT 官方问一下吧。
    abcbuzhiming
        31
    abcbuzhiming  
    OP
       2021-11-19 20:31:06 +08:00
    @skiy 我现在怀疑 BT 的脚本应该是触发了 yum 的什么 bug ,只能这么估计了
    skiy
        32
    skiy  
       2021-11-19 20:40:55 +08:00   ❤️ 6
    @abcbuzhiming

    找到这个文件:/etc/yum.conf ,将 exclude 这一行注释掉就行了。


    ------------------------------------------

    [main]
    gpgcheck=1
    installonly_limit=3
    clean_requirements_on_remove=True
    best=True
    exclude=httpd nginx php mysql mairadb python-psutil python2-psutil
    abcbuzhiming
        33
    abcbuzhiming  
    OP
       2021-11-19 20:48:36 +08:00
    @skiy 老哥 666666 ,解决了。问题就在这,我头一次知道 yum 还在这里藏着一个屏蔽软件包的配置。靠啊,BT 面板写了这个文件,卸载的时候居然不还原,坑死个人
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3384 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 00:39 · PVG 08:39 · LAX 17:39 · JFK 20:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.