Ubuntu – Failed Kernel install results in apt and dpkg failure due to dependencies and configuration issues

12.04aptdpkgkernelupgrade

I have seen some similar questions but none that I have seen have resolved my issue. An error occured durring a kernel upgrade on Ubuntu 12.04 from linux-image-3.2.0-36-generic to linux-image-3.2.0-38-generic. A Kernel Panic occurs on boot while booting with 3.2.0-38.

Booting in under `3.2.0-36 the system starts normally. However when I attempt to remove clean or configure the affected kernel package it throws the following error:

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).

Attempting sudo apt-get -f install, meets with no success citing dependency and configuration issues, after the package retrevial:

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)

I receive similar errors when running dpkg -- configure -a, apt-get -f dist-upgrade and apt-get -f autoremove.

Any ideas on what exactly corrupted during the kernel upgrade and how I can roll back my kernel version without using Apt-get or Dpkg?

Best Answer

The procedure is recover from this problem is to temporarly remove all problematic packages with:

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

Afterwards repair the missing dependencies with

apt-get install -f

Ensure that your system is running not on the 3.2.0-38 kernel with

uname -r 

Then I suggest to do a:

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