debian:删除或重新安装处于非常糟糕的不一致状态的软件包

debian:删除或重新安装处于非常糟糕的不一致状态的软件包

我遇到了包管理问题:

在某些时候,我一定中断了更新或其他什么事情,因为 bluez 包已经损坏了。我尝试删除和/或重新安装,但除了错误之外什么也没得到。只要这个包被破坏,我就无法使用 apt 执行任何操作。

我尝试删除包的输出

$ sudo aptitude remove bluez 
The following packages will be REMOVED:  
  bluez 
The following partially installed packages will be configured:
  dictionaries-common dmsetup grub-pc ifupdown install-info rsyslog 
0 packages upgraded, 0 newly installed, 1 to remove and 235 not upgraded.
Need to get 0 B of archives. After unpacking 1,737 kB will be freed.
dpkg: error processing bluez (--remove): 
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting a removal.
configured to not write apport reports
                                      Errors were encountered while processing:
 bluez
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Setting up install-info (4.13a.dfsg.1-8) ...
/var/lib/dpkg/info/install-info.postinst: 32: /var/lib/dpkg/info/install-info.postinst: update-info-dir: not found
dpkg: error processing install-info (--configure):
 subprocess installed post-installation script returned error exit status 127
Setting up ifupdown (0.7~alpha5+really0.6.15) ...
/var/lib/dpkg/info/ifupdown.postinst: 122: /var/lib/dpkg/info/ifupdown.postinst: update-rc.d: not found
dpkg: error processing ifupdown (--configure):
 subprocess installed post-installation script returned error exit status 127
Setting up locales (2.13-18) ...
/var/lib/dpkg/info/locales.postinst: 64: /var/lib/dpkg/info/locales.postinst: locale-gen: not found
dpkg: error processing locales (--configure):
 subprocess installed post-installation script returned error exit status 127
Setting up dictionaries-common (1.11.6) ...
/var/lib/dpkg/info/dictionaries-common.postinst: 45: /var/lib/dpkg/info/dictionaries-common.postinst: update-dictcommon-aspell: not found
dpkg: error processing dictionaries-common (--configure):
 subprocess installed post-installation script returned error exit status 127
Setting up grub-pc (1.99-12) ...
/var/lib/dpkg/info/grub-pc.postinst: line 438: grub-mkdevicemap: command not found
/var/lib/dpkg/info/grub-pc.postinst: line 263: grub-probe: command not found
/var/lib/dpkg/info/grub-pc.postinst: line 263: grub-probe: command not found
/var/lib/dpkg/info/grub-pc.postinst: line 263: grub-probe: command not found
/var/lib/dpkg/info/grub-pc.postinst: line 559: grub-install: command not found
/var/lib/dpkg/info/grub-pc.postinst: line 669: update-grub: command not found
dpkg: error processing grub-pc (--configure):
 subprocess installed post-installation script returned error exit status 127
Setting up dmsetup (2:1.02.65-1) ...
/var/lib/dpkg/info/dmsetup.postinst: 8: /var/lib/dpkg/info/dmsetup.postinst: update-initramfs: not found
dpkg: error processing dmsetup (--configure):
 subprocess installed post-installation script returned error exit status 127
Setting up rsyslog (5.8.5-1) ...
/var/lib/dpkg/info/rsyslog.postinst: 45: /var/lib/dpkg/info/rsyslog.postinst: update-rc.d: not found
dpkg: error processing rsyslog (--configure):
 subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
 install-info
 ifupdown
 locales
 dictionaries-common
 grub-pc
 dmsetup
 rsyslog

我正在运行 Debian 测试。这个问题实际上是这个特定软件包的问题,​​还是 dpkg 的问题?我需要做什么来修复我的包管理器?

答案1

我以前没有遇到过这条消息,所以我猜它是 bluez 特定的。您是否尝试过按照消息提示重新安装?

apt-get install --reinstall bluez

您也可以尝试使用 dpkg 从 apt 缓存安装/配置 bluez 软件包。在 /var/cache/apt 中查找 bluez 软件包。像这样安装(以 root 身份):

dpkg -i <bluez debian package>

答案2

sudo dpkg-reconfigure <packages> --force

其次是

sudo dpkg --purge --force-all <packages>

答案3

/usr/sbin这可能是巧合,但所有错误都与调用: update-info-dirupdate-rc.dlocale-genupdate-dictcommon-aspellgrub-mkdevicemapgrub-probegrub-installupdate-grubupdate-initramfsupdate-rc.d以及来自 的 prerm 中invoke-rc.d的程序有关。bluez/usr/sbin

首先要检查的是是否/usr/sbin在 root 中PATH,但这不太可能是问题,因为dpkg如果不是,通常会大声抱怨。事实上,从squeeze开始,dpkg如果update-rc.d在 中找不到它就会大声抱怨PATH,所以奇怪的是rsyslogpostinst即使dpkg没有抱怨也找不到这个可执行文件。

如果您(以 root 身份)运行这些命令会发生什么?

type update-rc.d
ls -l /usr/sbin/update-rc.d
file /usr/sbin/update-rc.d
update-rc.d --help
file /bin/sh

这些命令的结果可能会建议修复。如果您发现有趣的线索,但无法弄清楚它们的含义,请编辑您的问题以添加此信息。还要报告有关您的系统的任何“异常”情况(SELinux、chroot、双架构安装……)。

答案4

在我看来,你这里有几个错误,不仅仅是与bluez包有关。

当您运行时aptitude remove,它会继续配置几个软件包,其中大多数实现基本系统功能(例如,grub、ifupdown),这表明更新已中断或存在某些磁盘/文件系统错误,导致更新无法干净完成。

也就是说,其余的软件包没有更新干净可能是更大麻烦的迹象。事实上,您发布的日志说:

/var/lib/dpkg/info/install-info.postinst: 32: /var/lib/dpkg/info/install-info.postinst: update-info-dir: not found
dpkg: error processing install-info (--configure):
 subprocess installed post-installation script returned error exit status 127

因此,由于找不到,配置install-info无法完成 。update-info-dir请注意,在此上下文中“未找到”也可能意味着“不可执行”。同样,其他包也会失败,因为找不到这些程序:

grub-install, grub-mkdevicemap, grub-probe, locale-gen,
update-dictcommon-aspell, update-grub, update-info-dir,
update-initramfs, update-rc.d

在我的系统上,丢失的文件是从这些软件包安装的:

==================================  =================== 
File location                       Package             
==================================  =================== 
/usr/sbin/update-dictcommon-aspell  dictionaries-common 
/usr/sbin/grub-mkdevicemap          grub-common         
/usr/sbin/grub-probe                grub-common         
/usr/lib/grub-legacy/update-grub    grub-pc             
/usr/sbin/grub-install              grub-pc             
/usr/sbin/update-grub               grub-pc             
/usr/sbin/update-initramfs          initramfs-tools     
/usr/sbin/update-info-dir           install-info        
/usr/sbin/locale-gen                locales             
/usr/sbin/update-rc.d               sysv-rc             

作为第一个调试步骤,我将检查文件是否确实存在、可读且可执行。

接下来,尝试使用以下选项运行每个选项--help:它们运行正确吗?

如果上述两个测试均成功完成,您可能需要重新安装这些软件包,从 sysv-rc、initramfs-tools、grub-pc 和 grub-common ( aptitude reinstall grub-pc grub-common) 开始。

当你让该部件工作时,aptitude reinstall bluez应该恢复bluez 到正常状态,然后你可以将其移除。

相关内容