apt-get 无法升级软件包

apt-get 无法升级软件包

我正在运行 Ubuntu 12.04 服务器:

user@host:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.5 LTS
Release:        12.04
Codename:       precise

我的问题是这样的:当我去升级软件包(特别是寻找 php5,但它发生在很多/大多数/所有软件包上)时,我得到的结果如下:

user@host:~$ sudo apt-get upgrade
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:
 apache2-suexec-custom : Depends: apache2-bin but it is not installed
E: Unmet dependencies. Try using -f.


user@host:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  libnet-xwhois-perl libtommath0
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  apache2-bin
The following NEW packages will be installed:
  apache2-bin
0 upgraded, 1 newly installed, 0 to remove and 29 not upgraded.
1 not fully installed or removed.
Need to get 0 B/953 kB of archives.
After this operation, 3576 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
(Reading database ... 95668 files and directories currently installed.)
Unpacking apache2-bin (from .../apache2-bin_2.4.16-4+deb.sury.org~precise+4_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/apache2-bin_2.4.16-4+deb.sury.org~precise+4_amd64.deb (--unpack):
 trying to overwrite '/usr/share/man/man8/apache2.8.gz', which is also in package apache2.2-common 2.2.22-1ubuntu1.10
dpkg-deb (subprocess): subprocess data was killed by signal (Broken pipe)
dpkg-deb: error: subprocess <decompress> returned error exit status 2
Processing triggers for man-db ...
Errors were encountered while processing:
 /var/cache/apt/archives/apache2-bin_2.4.16-4+deb.sury.org~precise+4_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我该怎么做才能解决这些错误?我真的很想获得比5.3,因为我有多个项目至少需要 PHP v5.4。

笔记:我不是想修复语言环境问题,而是想修复 dpkg 错误。此服务器一直存在语言环境问题,而且完全独立。抱歉,但这不是重复的。

编辑添加的代码:

user@host:~$ sudo dpkg --configure -a
dpkg: dependency problems prevent configuration of apache2-suexec-custom:
 apache2-suexec-custom depends on apache2-bin; however:
  Package apache2-bin is not installed.
dpkg: error processing apache2-suexec-custom (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 apache2-suexec-custom



输出sudo apt-get install apache2

user@host:~$ sudo apt-get install apache2
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:
 apache2 : Depends: apache2-bin (= 2.4.16-4+deb.sury.org~precise+4) but it is not going to be installed
           Depends: apache2-data (= 2.4.16-4+deb.sury.org~precise+4) but it is not going to be installed
           Conflicts: apache2.2-bin but 2.2.22-1ubuntu1.10 is to be installed
           Conflicts: apache2.2-common but 2.2.22-1ubuntu1.10 is to be installed
 apache2-suexec-custom : Depends: apache2-bin but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).






好的,这就是我刚刚发现的。删除后一切似乎都正常apache2-suexec-custom。但我仍然得到这个:

user@host:~$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages have been kept back:
  apache2 libapache2-mod-php5 libjson0:i386 php-apc php-pear php5 php5-cgi php5-cli php5-common php5-curl php5-dev php5-fpm php5-gd php5-imagick php5-imap php5-intl
  php5-ldap php5-mcrypt php5-memcache php5-ming php5-mysql php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
0 upgraded, 0 newly installed, 0 to remove and 29 not upgraded.

user@host:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 29 not upgraded.

那么 29 没有升级的原因是什么?我打算浏览一下,同时在其他问题中寻找答案……

太棒了!请参阅 DanielSmith-Chatbot 的答案以了解我的解决方案...

答案1

好的,问题是这样的:

有一个严重混乱的软件包,名为apache2-suexec-customthat need and hated the same package。删除它,其他软件包现在就dist-upgrade可以了。运行sudo apt-get dist-upgrade ; sudo apt-get upgrade,一切都升级了。

谢谢你们的帮助!这不是一个预期的解决方案,但它确实有效!

答案2

这有帮助吗?:

sudo apt-get install --reinstall apache2 --fix-missing

或者如果这还不够,那么尝试使用 unity 的包管理器安装所有以“lamp”作为搜索词的包,然后列出所有必要的包。

如果以上内容没有帮助,那么此链接应该包含答案:

以下软件包具有未满足的依赖关系(apache)

还有:

添加 PPA 后如何解决未满足的依赖关系?

答案3

请检查服务器上的区域设置

您可以在此处主题中看到解决方案: 我该如何解决我的语言环境问题?

相关内容