![如何修复我的包管理器?](https://linux22.com/image/66084/%E5%A6%82%E4%BD%95%E4%BF%AE%E5%A4%8D%E6%88%91%E7%9A%84%E5%8C%85%E7%AE%A1%E7%90%86%E5%99%A8%EF%BC%9F.png)
我运行 Debian 7.0 (3.16.0-0.bpo.4-amd64) 大约一年了,运行良好。
昨天我做了一个apt-get dist-upgrade
,经过一番摆弄 Nginx 后,它又工作得很好了。但是,每当我尝试使用包管理器来处理某些通用包(可以在 debian 站点上找到)时,我都无法通过包管理器下载它。
我的来源列表:
#
# deb cdrom:[Debian GNU/Linux 7.0.0 _Wheezy_ - Official amd64 NETINST Binary-1 20130504-14:43]/ wheezy main
#deb cdrom:[Debian GNU/Linux 7.0.0 _Wheezy_ - Official amd64 NETINST Binary-1 20130504-14:43]/ wheezy main
deb http://ftp.nl.debian.org/debian/ wheezy main
deb-src http://ftp.nl.debian.org/debian/ wheezy main
deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main
# wheezy-updates, previously known as 'volatile'
deb http://ftp.nl.debian.org/debian/ wheezy-updates main
deb-src http://ftp.nl.debian.org/debian/ wheezy-updates main
deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main
deb http://http.debian.net/debian wheezy-backports main
我已经尝试过apt-get clean
,apt-get update
但仍然无法安装以下软件包:
sudo apt-get install python-software-properties
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python-software-properties is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'python-software-properties' has no installation candidate
或者例如:
apt-get install spamassassin spamc
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:
spamassassin : Depends: libhtml-parser-perl (>= 3.43) but it is not installable
Depends: libsocket6-perl but it is not installable
Depends: libsys-hostname-long-perl but it is not installable
Depends: libwww-perl but it is not installable
Depends: libnet-dns-perl (>= 0.34) but it is not installable
Depends: libnetaddr-ip-perl but it is not installable
Recommends: libmail-spf-perl but it is not installable
Recommends: re2c but it is not installable
Recommends: libio-socket-inet6-perl but it is not installable
E: Unable to correct problems, you have held broken packages.
同时,debian 网站上声明可以使用更高版本的 libhtml-parser-perl。 (https://packages.debian.org/wheezy/libhtml-parser-perl)。这是怎么回事?我该如何解决这个问题?
我的apt-cache policy
spamassasin/依赖项:
apt-cache policy spamassassin
spamassassin:
Installed: (none)
Candidate: 3.3.2-5+deb7u3
Version table:
3.4.0-2~bpo70+1 0
100 http://http.debian.net/debian/ wheezy-backports/main amd64 Packages
3.3.2-5+deb7u3 0
500 http://ftp.nl.debian.org/debian/ wheezy-updates/main amd64 Packages
3.3.2-5+deb7u2 0
-10 http://ftp.nl.debian.org/debian/ wheezy/main amd64 Packages
-10 http://debian.mirror.iweb.ca/debian/ wheezy/main amd64 Packages
3.3.2-2~bpo60+1 0
100 http://backports.debian.org/debian-backports/ squeeze-backports/main amd64 Packages
apt-cache policy libhtml-parser-perl
libhtml-parser-perl:
Installed: (none)
Candidate: (none)
Version table:
3.69-2 0
-10 http://ftp.nl.debian.org/debian/ wheezy/main amd64 Packages
-10 http://debian.mirror.iweb.ca/debian/ wheezy/main amd64 Packages
我的apt-policy
:
Package files:
100 /var/lib/dpkg/status
release a=now
500 http://debian.mirror.iweb.ca/debian/ wheezy/main Translation-en
-10 http://debian.mirror.iweb.ca/debian/ wheezy/main i386 Packages
release v=7.8,o=Debian,a=oldstable,n=wheezy,l=Debian,c=main
origin debian.mirror.iweb.ca
-10 http://debian.mirror.iweb.ca/debian/ wheezy/main amd64 Packages
release v=7.8,o=Debian,a=oldstable,n=wheezy,l=Debian,c=main
origin debian.mirror.iweb.ca
500 http://backports.debian.org/debian-backports/ squeeze-backports/main Transl ation-en
100 http://backports.debian.org/debian-backports/ squeeze-backports/main i386 P ackages
release o=Debian Backports,a=squeeze-backports,n=squeeze-backports,l=Debian Backports,c=main
origin backports.debian.org
100 http://backports.debian.org/debian-backports/ squeeze-backports/main amd64 Packages
release o=Debian Backports,a=squeeze-backports,n=squeeze-backports,l=Debian Backports,c=main
origin backports.debian.org
500 http://downloads-distro.mongodb.org/repo/debian-sysvinit/ dist/10gen i386 P ackages
release v=dist,o=mongodb,a=mongodb,n=dist,l=mongodb,c=10gen
origin downloads-distro.mongodb.org
500 http://downloads-distro.mongodb.org/repo/debian-sysvinit/ dist/10gen amd64 Packages
release v=dist,o=mongodb,a=mongodb,n=dist,l=mongodb,c=10gen
origin downloads-distro.mongodb.org
500 https://get.docker.com/ubuntu/ docker/main i386 Packages
release n=docker,c=main
origin get.docker.com
500 https://get.docker.com/ubuntu/ docker/main amd64 Packages
release n=docker,c=main
origin get.docker.com
500 http://http.debian.net/debian/ wheezy-backports/main Translation-en
100 http://http.debian.net/debian/ wheezy-backports/main i386 Packages
release v=,o=Debian Backports,a=wheezy-backports,n=wheezy-backports,l=Debia n Backports,c=main
origin http.debian.net
100 http://http.debian.net/debian/ wheezy-backports/main amd64 Packages
release v=,o=Debian Backports,a=wheezy-backports,n=wheezy-backports,l=Debia n Backports,c=main
origin http.debian.net
500 http://ppa.launchpad.net/webupd8team/java/ubuntu/ precise/main Translation- en
500 http://ppa.launchpad.net/webupd8team/java/ubuntu/ precise/main i386 Package s
release v=12.04,o=LP-PPA-webupd8team-java,a=precise,n=precise,l=Oracle Java (JDK) 7 / 8 / 9 Installer PPA,c=main
origin ppa.launchpad.net
500 http://ppa.launchpad.net/webupd8team/java/ubuntu/ precise/main amd64 Packag es
release v=12.04,o=LP-PPA-webupd8team-java,a=precise,n=precise,l=Oracle Java (JDK) 7 / 8 / 9 Installer PPA,c=main
origin ppa.launchpad.net
500 http://ftp.nl.debian.org/debian/ wheezy-updates/main Translation-en
500 http://ftp.nl.debian.org/debian/ wheezy-updates/main i386 Packages
release o=Debian,a=oldstable-updates,n=wheezy-updates,l=Debian,c=main
origin ftp.nl.debian.org
500 http://ftp.nl.debian.org/debian/ wheezy-updates/main amd64 Packages
release o=Debian,a=oldstable-updates,n=wheezy-updates,l=Debian,c=main
origin ftp.nl.debian.org
500 http://security.debian.org/ wheezy/updates/main Translation-en
-10 http://security.debian.org/ wheezy/updates/main i386 Packages
release v=7.0,o=Debian,a=oldstable,n=wheezy,l=Debian-Security,c=main
origin security.debian.org
-10 http://security.debian.org/ wheezy/updates/main amd64 Packages
release v=7.0,o=Debian,a=oldstable,n=wheezy,l=Debian-Security,c=main
origin security.debian.org
500 http://ftp.nl.debian.org/debian/ wheezy/main Translation-en
-10 http://ftp.nl.debian.org/debian/ wheezy/main i386 Packages
release v=7.8,o=Debian,a=oldstable,n=wheezy,l=Debian,c=main
origin ftp.nl.debian.org
-10 http://ftp.nl.debian.org/debian/ wheezy/main amd64 Packages
release v=7.8,o=Debian,a=oldstable,n=wheezy,l=Debian,c=main
origin ftp.nl.debian.org
Pinned packages:
我没有改变我的sources.list
任何东西sources.list.d
。然而,有一些文件因trusted.gpg.d
.
答案1
从所提供的信息中可以清楚地看出,问题在于(至少部分地)您当前的偏好不明智。例如,您将以下源设置为preference -10
,这意味着(per man apt_preferences
)这些源中的包永远不会被安装:
-10 http://debian.mirror.iweb.ca/debian/ wheezy/main i386 Packages
release v=7.8,o=Debian,a=oldstable,n=wheezy,l=Debian,c=main
origin debian.mirror.iweb.ca
-10 http://debian.mirror.iweb.ca/debian/ wheezy/main amd64 Packages
release v=7.8,o=Debian,a=oldstable,n=wheezy,l=Debian,c=main
origin debian.mirror.iweb.ca
-10 http://ftp.nl.debian.org/debian/ wheezy/main i386 Packages
release v=7.8,o=Debian,a=oldstable,n=wheezy,l=Debian,c=main
origin ftp.nl.debian.org
-10 http://ftp.nl.debian.org/debian/ wheezy/main amd64 Packages
release v=7.8,o=Debian,a=oldstable,n=wheezy,l=Debian,c=main
origin ftp.nl.debian.org
-10 http://security.debian.org/ wheezy/updates/main i386 Packages
release v=7.0,o=Debian,a=oldstable,n=wheezy,l=Debian-Security,c=main
origin security.debian.org
-10 http://security.debian.org/ wheezy/updates/main amd64 Packages
release v=7.0,o=Debian,a=oldstable,n=wheezy,l=Debian-Security,c=main
origin security.debian.org
这些源对应于 main 中的所有 wheezy (oldstable) i386 软件包(来自两个不同的镜像,但这是一个细节),以及安全更新。如果你确实气喘吁吁,这没有任何意义。我建议你先解决这个问题。
检查/etc/apt/preferences
目录中是否有名为 或 files 的文件/etc/apt/preferences.d
,如果存在此类文件,它们是否将这些源设置为-10
.也可以看看man apt_preferences
。某物必须修改这些首选项——它们当然不是默认的。作为参考,以下是手册页中的相关行apt_preferences
。
APT 如何解释优先级
APT 首选项文件中分配的优先级 (P) 必须是正整数或负整数。它们的解释如下(粗略地说):
[...]
P < 0 prevents the version from being installed