【问题标题】:apt-get conflict in UbuntuUbuntu中的apt-get冲突
【发布时间】:2013-09-27 15:38:00
【问题描述】:

我尝试安装mod_security,但它有错误,所以我尝试了aptitude:

apt-get install libapache-mod-security
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libapache-mod-security : Depends: libapache2-modsecurity but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root@srv16540:~# aptitude install libapache2-modsecurity
The following NEW packages will be installed:
  apache2.2-common{ab} libapache2-modsecurity modsecurity-crs{a}
0 packages upgraded, 3 newly installed, 0 to remove and 10 not upgraded.
Need to get 660 kB of archives. After unpacking 2,861 kB will be used.
The following packages have unmet dependencies:
 apache2 : Conflicts: apache2.2-common but 2.2.22-1ubuntu1.4 is to be installed.
 apache2.2-common : Depends: apache2.2-bin (= 2.2.22-1ubuntu1.4) but 2.4.6-2~precise+1 is installed.
 apache2-bin : Conflicts: apache2.2-common but 2.2.22-1ubuntu1.4 is to be installed.
 apache2-data : Conflicts: apache2.2-common but 2.2.22-1ubuntu1.4 is to be installed.
The following actions will resolve these dependencies:

     **Keep the following packages at their current version:**
1)     apache2.2-common [Not Installed]
2)     libapache2-modsecurity [Not Installed]
3)     modsecurity-crs [Not Installed]



Accept this solution? [Y/n/q/?] q
Abandoning all efforts to resolve these dependencies.

我现在知道将以下软件包保持在当前版本是什么意思。

我想知道如果我按下是会发生什么。它是否替换我当前的 apache2?在执行此操作之前我需要备份吗?

【问题讨论】:

  • 您是否在系统上使用了任何导致此冲突的第三方存储库?您是否尝试过运行 apt-get update 然后安装软件包?
  • @TeTeT:是的,我用过 apt-get 和 apt-upgrade,我也用过 apache 2.4,我不记得我是怎么安装的了。同样,当我在解决方案中按 y 接受时,它什么也不做......

标签: apache ubuntu apache2 debian mod-security


【解决方案1】:

只需删除 /var/lib/apt/lists 目录的所有内容:

sudo rm -rf /var/lib/apt/lists/*

然后运行:

sudo apt-get update

【讨论】:

    【解决方案2】:

    这正是它为我所做的:
    $ sudo apt-get 删除 apache2-bin
    $ sudo apt-get 自动删除
    $ sudo apt-get install apache2

    【讨论】:

      【解决方案3】:

      打开突触管理器并搜索apache2.2-bin。将其标记为删除。那么

      sudo apt-get install apache2

      【讨论】:

        【解决方案4】:

        答案

        我现在知道将以下软件包保持在当前版本是什么意思

        aptitude 正在尝试解决依赖关系和可能的冲突以满足您的安装请求。然后它提出了一个解决方案。在您的特定情况下,它找到的第一个解决方案是将所有内容保持原样,这就是 保持当前版本 + [未安装] 的含义。

        我想知道如果我按 yes 会发生什么,它会替换我当前的 apache2 吗?

        不,那个解决方案基本上什么都不做。

        之前需要备份吗?

        虽然听起来很无聊,但从长远来看,备份是节省时间的好策略。如果您弄乱了重要数据,那么它对您来说应该更加重要。


        上下文

        我已经看到其他场景使 apttitute 提出具有以下组合的解决方案:

        • 删除以下软件包
        • 将以下软件包保留为当前版本
        • 不解决以下依赖关系
        • 以下包已被保留
        • 将升级以下软件包
        • 以下软件包已自动安装,不再需要
        • 将安装以下额外软件包
        • 建议的软件包
        • 将删除以下软件包
        • (可能还有其他人)

        在您的情况下,如果您不接受(或退出)解决方案,而是按 n 拒绝它,那么 aptitude 将尝试找出另一个可能有用的方案并再次向您提出建议.您可以迭代这样做的解决方案,如果其中任何一个让您满意,那么您可以接受它。


        解决方案(?)

        据我所知,您的输出:

        apache2.2-common : 取决于:apache2.2-bin (= 2.2.22-1ubuntu1.4) 但已安装 2.4.6-2~precise+1。

        您的问题是您安装的 apache2-2.4.6-2~precise+1 无法从 standard Ubuntu precise repositories 获得(很可能是从 this PPA 安装的),并且您请求的软件包与另一个。

        我会看一下answers on how to remove PPAs,在您删除该源之后,我会使用以下命令从标准存储库中重新安装 apache 2.2:

        sudo aptitude install apache2
        

        【讨论】:

        • 即使我没有尝试过你的解决方案,但它对我来说真的很有用。谢谢
        • 嗨,我有同样的问题,但在我的输出中我得到了 apache2.2-common : Depends: apache2.2-bin (= 2.2.22-1ubuntu1.4) 但它不会被安装 E:无法纠正问题,您持有损坏的软件包。如何删除 ppa,我没有在 ppa 列表中找到它。如果我输入 sudo apt-get install apache2 安装没有问题,但 sudo apt-get install lamp-server 有错误^
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-10-14
        • 2017-02-02
        • 1970-01-01
        • 1970-01-01
        • 2019-01-15
        • 1970-01-01
        相关资源
        最近更新 更多