升级时出现“linux-image-generic”错误

升级时出现“linux-image-generic”错误

当我尝试将 php5.3 升级到 php5.4 或更高版本时遇到了一些问题。

这是我输入的命令apt-get -f install php5.5

结果是:

You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 linux-generic : Depends: linux-image-generic (= 3.2.0.116.132) but 3.2.0.124.139 is to be installed
                 Depends: linux-headers-generic (= 3.2.0.116.132) but 3.2.0.124.139 is to be installed
 php-amqp : Depends: php-common (>= 1:7.0+33~) but it is not going to be installed
            Depends: phpapi-20160303 or
                     phpapi-20151012 or
                     phpapi-20131226 or
                     phpapi-20121212 but it is not installable
            Depends: librabbitmq4 (>= 0.6.0) but it is not going to be installed
 php-gearman : Depends: php-common (>= 1:7.0+33~) but it is not going to be installed
               Depends: phpapi-20160303 or
                        phpapi-20151012 or
                        phpapi-20131226 or
                        phpapi-20121212 but it is not installable
               Depends: libgearman8 (>= 1.1.13) but it is not going to be installed
 php-geoip : Depends: php-common (>= 1:7.0+33~) but it is not going to be installed

其余的几乎都标有it is not going to be installed

我的操作系统是 Ubuntu 12.04.5 LTS。

看起来linux-image-genericlinux-headers-generic与需要的不匹配。

所以升级没有成功,我仍然停留在 php5.3.10。

我尝试过dpkg --purge linux-image-genericdpkg --purge linux-headers-generic仍然出现同样的错误。

也是dpkg --configure -a不行的。

对此有什么看法?

更新:

在我按照 Arijit 的解决方案输入apt-get install php5

Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 linux-generic : Depends: linux-image-generic (= 3.2.0.116.132) but 3.2.0.124.139 is to be installed
                 Depends: linux-headers-generic (= 3.2.0.116.132) but 3.2.0.124.139 is to be installed
 php5 : Depends: libapache2-mod-php5 (>= 5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1) but 5.3.10-1ubuntu3.26 is to be installed or
                 libapache2-mod-php5filter (>= 5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1) but it is not going to be installed or
                 php5-cgi (>= 5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1) but it is not going to be installed or
                 php5-fpm (>= 5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1) but it is not going to be installed
        Depends: php5-common (>= 5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1) but 5.3.10-1ubuntu3.26 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

版本依然是php5.3。并且python properties是最新版本。

这是php5版本的检查。试过了apt-get install php5.4.45,无法安装。

php5:
  Installed: (none)
  Candidate: 5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1
  Version table:
     5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1 0
        500 http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu/ precise/main amd64 Packages
     5.3.10-1ubuntu3.26 0
        500 http://archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
     5.3.10-1ubuntu3 0
        500 http://archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

更新2:

在我对情况进行进一步挖掘之后,我在这里找到了解决方案。计数错误:linux-generic-pae:依赖:linux-image-generic-pae(= 3.2.0.37.44)但已安装 3.2.0.37.45

针对我的具体问题的解决方案是@Simon 留下的评论

遇到了同样的问题,但 linux-generic 软件包依赖于特定版本的 linux-image-generic 和 linux-headers-generic,但要安装较新的版本会导致“未满足的依赖关系”错误。用 解决了sudo dpkg --remove linux-generic && sudo apt-get install linux-generic。谢谢!

所以解决方案很简单,

  1. sudo dpkg --remove linux-generic
  2. sudo apt-get linux-generic
  3. 重复安装 php 的过程。

    • LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php

    • apt-get update

    • apt-get install php5.6或者php7

  4. 注意不要使用 PPA 的弃用版本,请使用LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php获取安全稳定的 php 的最新版本。

  5. apt-get install php5.6或者php72015 年不再支持 php5.4 及更低版本。
  6. 好了,现在您已成功安装了 php5.6 及更高版本。如果没有,请重新启动您的服务sudo service apache2 restartsudo service nginx restart

答案1

请关注我:

  1. 您必须先更新并安装 Python 软件属性sudo apt-get update && sudo apt-get install python-software-properties
  2. 现在添加 PPAsudo add-apt-repository ppa:ondrej/php
  3. 现在再次更新sudo apt-get update
  4. 检查可用的 php5 版本apt-cache policy php5
  5. 现在安装 php5.xsudo apt-get install php5.4
  6. 现在检查 php 版本php5 -v,如果不是 php5.4,则重新启动 Apachesudo /etc/init.d/apache2 restartsudo service apache2 restart

希望能够解决

相关内容