由于依赖项和配置问题,内核安装失败导致 apt 和 dpkg 失败

由于依赖项和配置问题,内核安装失败导致 apt 和 dpkg 失败

我见过一些类似的问题,但没有一个能解决我的问题。在 Ubuntu 12.04 上将内核从 升级到 时发生错误linux-image-3.2.0-36-genericlinux-image-3.2.0-38-generic使用 启动时发生内核恐慌3.2.0-38

在 3.2.0-36 下启动系统正常。但是,当我尝试删除干净或配置受影响的内核包时,它会抛出以下错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
initramfs-tools : Depends: initramfs-tools-bin (< 0.99ubuntu13.1~) but 0.99ubuntu13.1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

尝试sudo apt-get -f install,在软件包恢复后,由于依赖性和配置问题而失败:

dpkg: dependency problems prevent configuration of initramfs-tools:
 initramfs-tools depends on initramfs-tools-bin (<< 0.99ubuntu13.1~); however:
  Version of initramfs-tools-bin on system is 0.99ubuntu13.1.
dpkg: error processing initramfs-tools (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-image-3.2.0-38-generic:
 linux-image-3.2.0-38-generic depends on initramfs-tools (>= 0.36ubuntu6); however:
  Package initramfs-tools is not configured yet.
dpkg: error processing linux-image-3.2.0-38-generic (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error    from a previous failure.
                          No apport report written because the error message indicates its a followup error from a previous failure.
                                                    dpkg: dependency problems prevent configuration of casper:
 casper depends on initramfs-tools (>= 0.92bubuntu55); however:
  Package initramfs-tools is not configured yet.
dpkg: error processing casper (--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
 linux-image-3.2.0-38-generic
 casper
E: Sub-process /usr/bin/dpkg returned an error code (1)

dpkg -- configure -a运行和apt-get -f dist-upgrade时我收到类似的错误apt-get -f autoremove

关于内核升级期间到底损坏了什么,以及如何在不使用 Apt-get 或 Dpkg 的情况下回滚内核版本,您有什么想法吗?

答案1

解决该问题的方法是暂时删除所有有问题的软件包:

 dpkg --force-depends --purge <packages> 

然后使用以下方法修复缺失的依赖项

apt-get install -f

确保您的系统运行的不是 3.2.0-38 内核

uname -r 

然后我建议做一个:

dpkg --force-depends --purge linux*3.2.0-38*
apt-get install -f

答案2

造成所有这些问题的软件包是 initramfs-tools 和 initramfs-tools-bin。它们的版本是 0.99ubuntu13精确的存储库和 0.99ubuntu13.1精确更新存储库。不知何故,软件包列表处于不一致的状态,使得 apt 尝试从每个存储库安装一个版本。

删除软件包列表:

sudo rm /var/cache/apt/*.bin /var/lib/apt/lists/* /var/lib/apt/lists/partial/*

然后运行apt-get update下载新的软件包列表,然后apt-get -f install重试。

答案3

这帮助我解决了这个问题:

sudo apt-get remove grub*

其次是

sudo apt-get update && sudo apt-get upgrade

希望这也对你有帮助。

自动翻译自西班牙语原文

相关内容