Ubuntu 包安装失败 - Unmet dependencies - Errors were encountered while processing

目录
  1. 解决办法

在Ubuntu服务器上安装Jenkins一直不成功,先是下载dpkg包,使用命令。然后用apt-get安装,都遇到了如下问题

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Reading package lists... Done
Building dependency tree
Reading state information... Done
jenkins is already the newest version.
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
jenkins : Depends: daemon but it is not going to be installed
Depends: default-jre-headless (>= 2:1.7) but it is not going to be installed or
java7-runtime-headless
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
ci@88f78f64-194c-eeb3-fc36-e20231f58fed:~/applications$ sudo apt-get -f install jenkins
Reading package lists... Done
Building dependency tree
Reading state information... Done
jenkins is already the newest version.
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
jenkins : Depends: daemon but it is not going to be installed
Depends: default-jre-headless (>= 2:1.7) but it is not going to be installed or
java7-runtime-headless
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

根据提示我就

1
apt-get -f install

后来就报下面的了

1
2
3
4
5
Errors were encountered while processing:
libpam-systemd:amd64
policykit-1
colord
policykit-1-gnome

试了各种方法都无法解决。
有时提示让你apt-get autoremove,还试过

1
2
3
sudo dpkg --configure -a
sudo apt-get update && sudo apt-get dist-upgrade
# 等等其他方法

解决办法

1、备份dpkg的status文件

1
2
cd /var/lib/dpkg/
sudo cp status status_bak

2、编辑status文件

1
sudo vi status

3、查找你出问题的Package进行删除 policykit-1、colord等

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# other package
Package: policykit-1
Status: install ok unpacked
Priority: optional
Section: admin
Installed-Size: 400
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Multi-Arch: foreign
Version: 0.105-4ubuntu3.14.04.1
Depends: libc6 (>= 2.7), libglib2.0-0 (>= 2.37.3), libpam0g (>= 0.99.7.1), libpolkit-agent-1-0 (>= 0.105), libpolkit-backend-1-0 (>= 0.99), libpolkit-gobject-1-0 (>= 0.101), libpam-systemd, dbus
Conffiles:
/etc/dbus-1/system.d/org.freedesktop.PolicyKit1.conf newconffile
/etc/pam.d/polkit-1 newconffile
/etc/polkit-1/localauthority.conf.d/50-localauthority.conf newconffile
/etc/polkit-1/localauthority.conf.d/51-ubuntu-admin.conf newconffile
/etc/polkit-1/nullbackend.conf.d/50-nullbackend.conf newconffile
Description: framework for managing administrative policies and privileges
PolicyKit is an application-level toolkit for defining and handling the policy
that allows unprivileged processes to speak to privileged processes.
.
It is a framework for centralizing the decision making process with respect to
granting access to privileged operations for unprivileged (desktop)
applications.
Homepage: http://hal.freedesktop.org/docs/PolicyKit/
Original-Maintainer: Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>
Package: libwrap0
Status: install ok installed

再次执行apt-get install jenkins成功。

参考:http://blog.csdn.net/zfpnuc/article/details/4672317