我试图安装一个似乎已损坏的软件包 -mysql-server
准确地说。根据互联网上的建议,我跑去apt-get -f install
修复依赖项,这生成了一个更改列表。
我没有看就接受了这些改变。显然,这些更改是为了删除许多重要的软件包 -
Log started: 2017-12-21 12:41:04
(Reading database ... 111077 files and directories currently installed.)
Removing php5 (5.6.30+dfsg-0+deb8u1) ...
Removing libapache2-mod-php5 (5.6.30+dfsg-0+deb8u1) ...
php5_invoke prerm: Disable module pdo for apache2 SAPI
php5_invoke prerm: Disable module opcache for apache2 SAPI
php5_invoke prerm: Disable module readline for apache2 SAPI
php5_invoke prerm: Disable module json for apache2 SAPI
Module php5 disabled.
apache2_invoke prerm: Disable module php5
Removing apache2 (2.4.10-10+deb8u9) ...
Removing apache2-bin (2.4.10-10+deb8u9) ...
Removing node (0.3.2-7.4) ...
Removing ax25-node (0.3.2-7.4) ...
Removing build-essential (11.7) ...
Removing dpkg-dev (1.17.27) ...
Removing git (1:2.1.4-2.1+deb8u3) ...
Removing i2c-tools (3.1.1+svn-2) ...
Removing libsoftware-license-perl (0.103010-3) ...
Removing libdata-section-perl (0.200006-1) ...
Removing libmro-compat-perl (0.12-1) ...
Removing libclass-c3-perl (0.26-1) ...
Removing libalgorithm-c3-perl (0.09-1) ...
Removing libalgorithm-diff-xs-perl (0.04-3+b1) ...
Removing libalgorithm-merge-perl (0.08-2) ...
Removing libalgorithm-diff-perl (1.19.02-3) ...
Removing libarchive-extract-perl (0.72-1) ...
Removing libcgi-fast-perl (1:2.04-1) ...
Removing libcgi-pm-perl (4.09-1) ...
Removing libclass-c3-xs-perl (0.13-2+b1) ...
Removing libmodule-build-perl (0.421000-2+deb8u1) ...
Removing 'diversion of /usr/bin/config_data to /usr/bin/config_data.diverted by libmodule-build-perl'
Removing 'diversion of /usr/share/man/man1/config_data.1.gz to /usr/share/man/man1/config_data.diverted.1.gz by libmodule-build-perl'
Removing libcpan-meta-perl (2.142690-1) ...
Removing libsub-exporter-perl (0.986-1) ...
Removing libdata-optlist-perl (0.109-1) ...
Removing libdpkg-perl (1.17.27) ...
Removing liberror-perl (0.17-1.1) ...
Removing libfcgi-perl (0.77-1+deb8u1) ...
Removing openbsd-inetd (0.20091229-2) ...
Removing update-inetd (4.43) ...
Removing libfile-copy-recursive-perl (0.38-1) ...
Removing libfile-fcntllock-perl (0.22-1+b1) ...
Removing libterm-ui-perl (0.42-1) ...
Removing liblog-message-simple-perl (0.10-2) ...
Removing liblog-message-perl (0.8-1) ...
Removing libmodule-pluggable-perl (5.1-1) ...
Removing libmodule-signature-perl (0.73-1+deb8u2) ...
Removing libpackage-constants-perl (0.04-1) ...
Removing libparams-util-perl (1.07-2+b1) ...
Removing php5-readline (5.6.30+dfsg-0+deb8u1) ...
php5_invoke prerm: Disable module readline for cli SAPI
Removing php5-cli (5.6.30+dfsg-0+deb8u1) ...
php5_invoke prerm: Disable module pdo for cli SAPI
php5_invoke prerm: Disable module opcache for cli SAPI
php5_invoke prerm: Disable module json for cli SAPI
Removing php5-json (1.3.6-1) ...
Removing php5-common (5.6.30+dfsg-0+deb8u1) ...
Removing lsof (4.86+dfsg-1) ...
Removing libperl4-corelibs-perl (0.003-1) ...
Removing libpod-latex-perl (0.61-1) ...
Removing 'diversion of /usr/bin/pod2latex to /usr/bin/pod2latex.bundled by libpod-latex-perl'
Removing 'diversion of /usr/share/man/man1/pod2latex.1.gz to /usr/share/man/man1/pod2latex.bundled.1.gz by libpod-latex-perl'
Removing libpod-readme-perl (0.11-1) ...
Removing libregexp-common-perl (2013031301-1) ...
Removing libsub-install-perl (0.928-1) ...
Removing libtext-soundex-perl (3.4-1+b2) ...
Removing libtext-template-perl (1.46-1) ...
Removing libtimedate-perl (2.3000-2) ...
Removing rename (0.20-3) ...
Removing xml-core (0.13+nmu2) ...
Removing sgml-base (1.26+nmu4) ...
从那时起,我一直在尝试重新安装这些软件包。然而,这会导致奇怪的情况......这就是我尝试安装时发生的情况apache2
,例如:
root@srv2:/# apt-get install apache2
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:
apache2 : Depends: apache2-mpm-worker (= 2.2.22-13+deb7u12) but it is not going to be installed or
apache2-mpm-prefork (= 2.2.22-13+deb7u12) but it is not going to be installed or
apache2-mpm-event (= 2.2.22-13+deb7u12) but it is not going to be installed or
apache2-mpm-itk (= 2.2.22-13+deb7u12) but it is not going to be installed
Depends: apache2.2-common (= 2.2.22-13+deb7u12) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
好的...尝试手动安装这些,例如apache2.2-common
:
root@srv2:/# apt-get install apache2.2-common
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:
apache2.2-common : Depends: apache2.2-bin (= 2.2.22-13+deb7u12) but it is not going to be installed
Depends: perl but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
“取决于:perl”是许多软件包似乎报告的问题。不过貌似已经安装好了...
root@srv2:/# perl -v
This is perl 5, version 20, subversion 2 (v5.20.2) built for arm-linux-gnueabihf-thread-multi-64int
(有 95 个注册补丁,请参阅 perl -V 了解更多详细信息)
到apt,好像没有安装:
root@srv2:/# apt-get install perl
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:
adduser : Depends: perl-base (>= 5.6.0) but it is not going to be installed
Depends: passwd (>= 1:4.0.12) but it is not going to be installed
Depends: debconf but it is not going to be installed or
debconf-2.0
libfontconfig1 : Depends: fontconfig-config (>= 2.11.0-6.3+deb8u1) but it is not going to be installed
libpython3-stdlib : Depends: libpython3.4-stdlib (>= 3.4.2-0) but it is not going to be installed
libxt6 : Depends: libsm6 but it is not going to be installed
logrotate : Depends: cron or
anacron but it is not going to be installed or
cron-daemon
Recommends: mailx
perl : Depends: perl-base (= 5.14.2-21+rpi2+deb7u2) but it is not going to be installed
Depends: perl-modules (>= 5.14.2-21+rpi2+deb7u2) but it is not going to be installed
python : Depends: python2.7 (>= 2.7.9-1~) but it is not going to be installed
Depends: libpython-stdlib (= 2.7.9-1) but it is not going to be installed
python3-minimal : Depends: python3.4-minimal (>= 3.4.2-0) but it is not going to be installed
python3-venv : Depends: python3.4-venv (>= 3.4.2-0) but it is not going to be installed
python3.4 : Depends: python3.4-minimal (= 3.4.2-1) but it is not going to be installed
Depends: libpython3.4-stdlib (= 3.4.2-1) but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
这些软件包确实已安装,并且 apt 知道这一点。该软件包adduser
实际上已安装在服务器上,但它将其报告为未满足的依赖项。有了这些问题,我什至无法开始修复已删除的软件包。
更多信息:
root@srv2:/# apt-get install adduser
Reading package lists... Done
Building dependency tree
Reading state information... Done
adduser is already the newest version.
root@srv2:/# apt-mark showhold
root@srv2:/# apt-cache policy
Package files:
100 /var/lib/dpkg/status
release a=now
-1 http://archive.raspberrypi.org/debian/ jessie/ui armhf Packages
release o=Raspberry Pi Foundation,a=oldstable,n=jessie,l=Raspberry Pi Foundation,c=ui
origin archive.raspberrypi.org
-1 http://archive.raspberrypi.org/debian/ jessie/main armhf Packages
release o=Raspberry Pi Foundation,a=oldstable,n=jessie,l=Raspberry Pi Foundation,c=main
origin archive.raspberrypi.org
989 http://archive.raspbian.org/raspbian/ wheezy/non-free armhf Packages
release v=7.0,o=Raspbian,a=oldoldstable,n=wheezy,l=Raspbian,c=non-free
origin archive.raspbian.org
989 http://archive.raspbian.org/raspbian/ wheezy/contrib armhf Packages
release v=7.0,o=Raspbian,a=oldoldstable,n=wheezy,l=Raspbian,c=contrib
origin archive.raspbian.org
989 http://archive.raspbian.org/raspbian/ wheezy/main armhf Packages
release v=7.0,o=Raspbian,a=oldoldstable,n=wheezy,l=Raspbian,c=main
origin archive.raspbian.org
Pinned packages:
答案1
您的某些软件包是从 Raspbian Jessie 安装的,但您的 pin 优先级(在 中/etc/apt/preferences
)有利于 Raspbian Wheezy 并阻止从 Jessie 安装新软件包(即 -1 优先级)。因此,您删除的软件包无法重新安装,因为这样做需要 Jessie 软件包,而 Jessie 软件包被排除在外。
要解决此问题,您需要:
- 尝试找出为什么 Jessie 已列出但固定为 -1;
- 如果没有充分的理由,请编辑
/etc/apt/preferences
以将其删除; - 恢复您删除的软件包。
您可能也想在某个时候完全升级到 Jessie,使用apt dist-upgrade
(但这次一定要小心软件包删除 - 如果软件包太多,请在确认之前进行调查)。