今天尝试升级我的 Ubuntu 12.04 服务器上的软件时出现了这个问题:
# apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]?
Setting up dbus (1.4.18-1ubuntu1.5) ...
adduser: The user `messagebus' already exists. Exiting.
dpkg: error processing dbus (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of dbus-x11:
dbus-x11 depends on dbus; however:
Package dbus is not configured yet.
dpkg: error processing dbus-x11 (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
dbus
dbus-x11
E: Sub-process /usr/bin/dpkg returned an error code (1)
我很想删除用户 messagebus 并重试。这是解决这个问题的好方法吗?或者您还有其他建议吗?
答案1
问题在于 messagebus 用户的用户 ID。
首先检查此命令的输出:
grep messagebus /etc/passwd /etc/group
它应该显示如下内容:
/etc/passwd:messagebus:x:102:104::/var/run/dbus:/bin/false
/etc/group:messagebus:x:104:
然后查看/etc/adduser.conf
并搜索“ FIRST_SYSTEM_UID=111
”。
如您所见,messagebus 的 ID 为 102 / 104,低于 的值FIRST_SYSTEM_UID
。
只需将 FIRST_SYSTEM_UID 更改为 100 并保存(以 root/sudo 身份)。
然后升级应该可以顺利运行。
答案2
我通过添加缺失的组解决了这个问题:
addgroup messagebus