dpkg:依赖性问题阻止了initramfs-tools的配置


10

像往常一样,我使用此命令开始升级Kubuntu 12.04系统:

sudo apt-get --show-upgraded dist-upgrade

我后来回来了,但是失败了:

Preconfiguring packages ...
(Reading database ... 478306 files and directories currently installed.)
Preparing to replace  ...
Unpacking replacement base-files ...
Processing triggers for man-db ...
Processing triggers for install-info ...
...
Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-3.8.0-32-lowlatency

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-3.8.0-32-lowlatency with 1.
dpkg: error processing initramfs-tools (--unpack):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

这是问题所在:$ df -h输出:

Filesystem                    Size  Used Avail Use% Mounted on
/dev/sda1                     894M  879M     0 100% /boot

手动删除较旧的文件,现在有一些空间可用

Filesystem                    Size  Used Avail Use% Mounted on
/dev/sda1                     894M  129M  717M  16% /boot

我接下来运行这个:

sudo apt-get autoremove

下一个:

sudo apt-get -f install 输出:

The following extra packages will be installed:
  initramfs-tools
The following packages will be upgraded:
  initramfs-tools

dpkg: dependency problems prevent configuration of initramfs-tools:
 initramfs-tools depends on initramfs-tools-bin (<< 0.99ubuntu13.3.1~); however:
  Version of initramfs-tools-bin on system is 0.99ubuntu13.4.
dpkg: error processing initramfs-tools (--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:
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

sudo apt-get install initramfs-tools
以上失败

dpkg -l initramfs-tools 输出:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
iF  initramfs-tool 0.99ubuntu13.3 tools for generating an initramfs

sudo apt-get install --reinstall initramfs-tools 输出:

The following packages will be upgraded:
  initramfs-tools
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/49.2 kB of archives.
After this operation, 0 B of additional disk space will be used.
dpkg: dependency problems prevent configuration of initramfs-tools:
 initramfs-tools depends on initramfs-tools-bin (<< 0.99ubuntu13.3.1~); however:
  Version of initramfs-tools-bin on system is 0.99ubuntu13.4.
dpkg: error processing initramfs-tools (--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:
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

这是输出apt-cache policy initramfs-tools-bin initramfs-tools

initramfs-tools-bin:
  Installed: 0.99ubuntu13.4
  Candidate: 0.99ubuntu13.4
  Version table:
 *** 0.99ubuntu13.4 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     0.99ubuntu13 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
initramfs-tools:
  Installed: 0.99ubuntu13.3
  Candidate: 0.99ubuntu13.4
  Version table:
     0.99ubuntu13.4 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
 *** 0.99ubuntu13.3 0
        100 /var/lib/dpkg/status
     0.99ubuntu13 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

如下所示,这是我的后续步骤:

$ sudo apt-get update
$ sudo apt-get -f install initramfs-tools=0.99ubuntu13 initramfs-tools-bin=0.99ubuntu13

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  ...
Use 'apt-get autoremove' to remove them.
The following packages will be DOWNGRADED:
  initramfs-tools initramfs-tools-bin
0 upgraded, 0 newly installed, 2 downgraded, 0 to remove and 4 not upgraded.
1 not fully installed or removed.
Need to get 59.2 kB of archives.
After this operation, 2,048 B disk space will be freed.
Do you want to continue [Y/n]? 
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise/main initramfs-tools all 0.99ubuntu13 [49.2 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ precise/main initramfs-tools-bin amd64 0.99ubuntu13 [9,988 B]
Fetched 59.2 kB in 0s (124 kB/s)            
dpkg: warning: downgrading initramfs-tools-bin from 0.99ubuntu13.4 to 0.99ubuntu13.
(Reading database ... 478624 files and directories currently installed.)
Preparing to replace initramfs-tools-bin 0.99ubuntu13.4 (using .../initramfs-tools-bin_0.99ubuntu13_amd64.deb) ...
Unpacking replacement initramfs-tools-bin ...
Setting up initramfs-tools-bin (0.99ubuntu13) ...
dpkg: dependency problems prevent configuration of initramfs-tools:
 initramfs-tools depends on initramfs-tools-bin (>= 0.99ubuntu13.3); however:
  Version of initramfs-tools-bin on system is 0.99ubuntu13.
dpkg: error processing initramfs-tools (--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:
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

接下来,我尝试了Giles的建议:

sudo dpkg --configure -a --force-depends
sudo apt-get install -f
sudo apt-get dist-upgrade

我有点困惑。请apt-cache policy initramfs-tools-bin initramfs-tools
Gilles'SO- stop not evil'

@Gilles-感谢您的关注。我用此信息更新了问题。
MountainX

尝试手动指定版本:apt-get install initramfs-tools=0.99ubuntu13.4
jordanm 2014年

嗯,这看起来像是initramfs-tools软件包依赖项或dpkg如何管理依赖项中的错误。我认为您的系统不应该处于这种状态,新的系统initramfs-tools-bin被标记为已安装,而旧的initramfs-tools系统仍然存在。有dpkg --configure -a --force-depends帮助吗?
吉尔(Gilles)'所以

sudo apt-get check和的输出是dpkg --audit什么?
Braiam 2014年

Answers:


26

我认为您的系统处于不应发生的状态:新版本的依赖关系initramfs-tools-bin处于已安装状态,而旧版本的依赖关系initramfs-tools处于半安装状态。我不确定问题是否在于APT让系统进入无法恢复的状态,dpkg让系统进入无法恢复的状态,软件包维护者使用了一系列依赖关系不支持该功能,或者由于我的有限理解无法涵盖这种情况。

尝试dpkg直接使用:

dpkg --configure -a

如果仍然抱怨依赖项,请尝试

dpkg --configure -a --force-depends

如果可行,则您的dpkg数据库处于一致状态。您需要使APT处于良好状态(无需破坏依赖关系):

apt-get -f install

此后,您可以恢复正常升级。


如果清除的/boot是删除软件包中的旧内核,那么您将无法再删除内核软件包。您必须重新创建文件。touch `cat /var/lib/dpkg/info/linux-image-1.2.3-foo`如果您要删除linux-image-1.2.3-foo软件包并手动删除了其中的某些文件,则可以创建空文件()。


1
万分感谢 !!!带有--force-depends的dpkg
有所作为

2
update-initramfs: Generating /boot/initrd.img-3.8.0-32-lowlatency

gzip: stdout: No space left on device

这意味着您需要删除一些内核。旧的,未使用的内核是最佳选择。

sudo dpkg --purge linux-generic-someold-version

手动删除较旧的文件,现在有一些空间可用

没有!

您永远不要手动删除任何内容。曾经 仅从东西/home,并/tmp可能轻松恢复能感动我的手,否则使用的工具。这就是为您的服务提供DPKG / APT的意义所在。如果您需要删除某些东西,请改用apt / dpkg,并保留最后的替代方法。我想您当前的问题就是因为这个。


要解决依赖性问题,您可以降级,然后升级:

sudo apt-get update
sudo apt-get -f install initramfs-tools=0.99ubuntu13 initramfs-tools-bin=0.99ubuntu13
sudo apt-get upgrade

至此,您应该已经告诉dpkg / apt也删除了旧内核。


我尝试了你的建议。它也失败。我用输出更新了我的问题。
MountainX
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.