Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Unattended upgrade failed after full /boot partition. Creating disk-space by deleting old kernels with the recommended command

sudo apt-get purge linux-image-x.x.x-x-generic

does not work and gives the following reason:

The following packages have unmet dependencies:
 linux-image-generic : Depends: linux-image-3.2.0-38-generic but it is not going to be installed
 linux-image-server : Depends: linux-image-3.2.0-38-generic but it is not going to be installed
 linux-server : Depends: linux-headers-server (= 3.2.0.38.46) but 3.2.0.40.48 is to be installed

(I created space on /boot by rm old kernel images)

All suggestions and solutions offered on the questions APT wedged by kernel version mismatch and error Sub-process /usr/bin/dpkg returned an error code (1) while running sudo apt-get install -f do not work, giving the same unmet dependencies.

server:~$ uname -r
3.2.0-40-generic

So kernel is version 40.

server:~$ sudo dpkg --list 'linux-image*'
||/ Name                 Version              Description
+++-====================-============================================================================
un  linux-image          <none>               (no description available)
un  linux-image-3.0      <none>               (no description available)
ii  linux-image-3.2.0-23 3.2.0-23.36          Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-36 3.2.0-36.57          Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-37 3.2.0-37.58          Linux kernel image for version 3.2.0 on 64 bit x86 SMP
un  linux-image-3.2.0-38 <none>               (no description available)
ii  linux-image-3.2.0-40 3.2.0-40.64          Linux kernel image for version 3.2.0 on 64 bit x86 SMP
iU  linux-image-generic  3.2.0.38.46          Generic Linux kernel image
iU  linux-image-server   3.2.0.38.46          Linux kernel image on Server Equipment.

kernel 38 is missing, but last two images refer to version 38

server:~$ sudo apt-cache policy linux-server
linux-server:
  Installed: 3.2.0.38.46
  Candidate: 3.2.0.40.48
  Version table:
     3.2.0.40.48 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
 *** 3.2.0.38.46 0
        100 /var/lib/dpkg/status
     3.2.0.23.25 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

Now I'm confused. booting into an older kernel 37 gives the same unmet depedencies. Trying in a desperate attempt to force the install of the 38 kernel fails:

server:~$ sudo dpkg -i --force-overwrite linux-image-generic_3.2.0.38.46_amd64.deb
dpkg: dependency problems prevent configuration of linux-image-generic:
 linux-image-generic depends on linux-image-3.2.0-38-generic; however:
      Package linux-image-3.2.0-38-generic is not installed.

Using aptitude gives the same problems: although it tries to up/downgrade several packages to resolve the unmet dependencies.

Can anybody help?

share|improve this question
add comment

2 Answers 2

I had a very similar problem to you. I ended using dpkg to remove both linux-server and linux-image-server

I tried to download the older versions but they were not in the normal apt-get repositories as they had been replaced by newer versions already.

Once I did that, I was able to reinstall the correct versions via apt-get

share|improve this answer
add comment

Use this command to delete older kernels via dpkg:

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo dpkg -r
share|improve this answer
1  
Welcome to Ask Ubuntu Ryan! Not all of us are regex gods =D; can you please explain what this command exactly does? Does it delete everything but the running kernel? Or does it leave the previous latest kernel? –  Alaa Ali Aug 26 '13 at 5:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.