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.

12.04 LTS here, first off let me start with a uname -a output for you

3.2.0-35-generic-pae #55-Ubuntu SMP Wed Dec 5 18:04:39 UTC 2012 i686 i686 i386 GNU/Linux

So my boot partition was at 100%. A huge no-no, so I wanted to clean it up in order for me to upgrade vmware tools on this machine. I ran the usual

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-    9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

However when I try that I kept getting issues about unmet dependencies..

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: linux-generic : Depends: linux-headers-generic (= 3.2.0.37.44) but 3.2.0.38.46 is to be installed linux-headers-generic : Depends: linux-headers-3.2.0-38-generic but it is not going to be installed linux-image-generic : Depends: linux-image-3.2.0-37-generic but it is not going to be installed linux-image-generic-pae : Depends: linux-image-3.2.0-37-generic-pae but it is not going to be installed E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

If I tried to install anything of course it would fail with not enough space left on /boot. So I moved some older kernels to /tmp for the time being. Here is my /tmp

drwxr-xr-x  2 root root     4096 Jan 14 19:34 hsperfdata_root
-rw-r--r--  1 root root  7906868 May 29  2012 initrd.img-2.6.28-19-server.old.0
-rw-r--r--  1 root root 17083030 Oct 26 10:57 initrd.img-3.2.0-27-generic
-rw-r--r--  1 root root 17096219 Oct 26 11:00 initrd.img-3.2.0-27-generic-pae
-rw-r--r--  1 root root 17085508 Dec 31 08:20 initrd.img-3.2.0-33-generic
-rw-r--r--  1 root root 17099160 Dec 31 08:20 initrd.img-3.2.0-33-generic-pae
-rw-r--r--  1 root root 17091480 Dec 31 08:23 initrd.img-3.2.0-34-generic
drwxr-xr-x 10 root root     4096 Feb 22 11:07 mkinitramfs_LzTuqq
-rw-------  1 root root        0 Feb 22 11:07 mkinitramfs-OL_lNbawL
-rw-------  1 root root  2249889 Jul  6  2012 System.map-3.2.0-27-generic
-rw-------  1 root root  2311276 Jul  6  2012 System.map-3.2.0-27-generic-pae
-rw-------  1 root root  2251905 Oct 18 13:27 System.map-3.2.0-33-generic
-rw-------  1 root root  2313292 Oct 18 13:41 System.map-3.2.0-33-generic-pae
-rw-------  1 root root  2252451 Nov 15 07:04 System.map-3.2.0-34-generic
-rw-------  1 root root  4855808 Jul  6  2012 vmlinuz-3.2.0-27-generic
-rw-------  1 root root  5010688 Jul  6  2012 vmlinuz-3.2.0-27-generic-pae
-rw-------  1 root root  4861280 Oct 18 13:27 vmlinuz-3.2.0-33-generic
-rw-------  1 root root  5015328 Oct 18 13:41 vmlinuz-3.2.0-33-generic-pae
-rw-------  1 root root  4862688 Nov 15 07:04 vmlinuz-3.2.0-34-generic
drwx------  2 root root     4096 Jan 14 19:34 vmware-root

So now I try to aptitude safe-upgrade to see if it will fix the issues with the kernels and it did seem to install 3.2.0-38 but 3.2.0-37 is just not in /boot so I think that's the issue.

Here is what is in my boot (49% used after moving those to /tmp and now %69 used after aptitude safe-upgrade).

-rw-r--r-- 1 root root   795776 Jul  6  2012 abi-3.2.0-27-generic
-rw-r--r-- 1 root root   800453 Jul  6  2012 abi-3.2.0-27-generic-pae
-rw-r--r-- 1 root root   797027 Oct 18 13:27 abi-3.2.0-33-generic
-rw-r--r-- 1 root root   801704 Oct 18 13:41 abi-3.2.0-33-generic-pae
-rw-r--r-- 1 root root   797082 Nov 15 07:04 abi-3.2.0-34-generic
-rw-r--r-- 1 root root   797121 Dec  5 13:52 abi-3.2.0-35-generic
-rw-r--r-- 1 root root   801798 Dec  5 14:06 abi-3.2.0-35-generic-pae
-rw-r--r-- 1 root root   797231 Jan  8 17:48 abi-3.2.0-36-generic
-rw-r--r-- 1 root root   801908 Jan  8 18:03 abi-3.2.0-36-generic-pae
-rw-r--r-- 1 root root   797340 Feb 19 08:29 abi-3.2.0-38-generic
-rw-r--r-- 1 root root   802017 Feb 19 08:44 abi-3.2.0-38-generic-pae
-rw-r--r-- 1 root root   147463 Jul  6  2012 config-3.2.0-27-generic
-rw-r--r-- 1 root root   147401 Jul  6  2012 config-3.2.0-27-generic-pae
-rw-r--r-- 1 root root   147497 Oct 18 13:27 config-3.2.0-33-generic
-rw-r--r-- 1 root root   147435 Oct 18 13:41 config-3.2.0-33-generic-pae
-rw-r--r-- 1 root root   147514 Nov 15 07:04 config-3.2.0-34-generic
-rw-r--r-- 1 root root   147514 Dec  5 13:52 config-3.2.0-35-generic
-rw-r--r-- 1 root root   147452 Dec  5 14:06 config-3.2.0-35-generic-pae
-rw-r--r-- 1 root root   147514 Jan  8 17:48 config-3.2.0-36-generic
-rw-r--r-- 1 root root   147452 Jan  8 18:03 config-3.2.0-36-generic-pae
-rw-r--r-- 1 root root   147497 Feb 19 08:29 config-3.2.0-38-generic
-rw-r--r-- 1 root root   147435 Feb 19 08:44 config-3.2.0-38-generic-pae
drwxr-xr-x 3 root root     5120 Feb 22 11:25 grub
-rw-r--r-- 1 root root 17092973 Dec 31 10:09 initrd.img-3.2.0-35-generic
-rw-r--r-- 1 root root 17101417 Dec 31 10:09 initrd.img-3.2.0-35-generic-pae
-rw-r--r-- 1 root root 17093970 Jan 18 06:52 initrd.img-3.2.0-36-generic
-rw-r--r-- 1 root root 17103977 Jan 18 06:52 initrd.img-3.2.0-36-generic-pae
-rw-r--r-- 1 root root 17090717 Feb 22 11:23 initrd.img-3.2.0-38-generic
-rw-r--r-- 1 root root 17098330 Feb 22 11:25 initrd.img-3.2.0-38-generic-pae
drwxr-xr-x 2 root root    12288 Jul  2  2009 lost+found
-rw-r--r-- 1 root root   176764 Nov 27  2011 memtest86+.bin
-rw-r--r-- 1 root root   178944 Nov 27  2011 memtest86+_multiboot.bin
-rw------- 1 root root  2252128 Dec  5 13:52 System.map-3.2.0-35-generic
-rw------- 1 root root  2314162 Dec  5 14:06 System.map-3.2.0-35-generic-pae
-rw------- 1 root root  2252687 Jan  8 17:48 System.map-3.2.0-36-generic
-rw------- 1 root root  2314721 Jan  8 18:03 System.map-3.2.0-36-generic-pae
-rw------- 1 root root  2253664 Feb 19 08:29 System.map-3.2.0-38-generic
-rw------- 1 root root  2315698 Feb 19 08:44 System.map-3.2.0-38-generic-pae
-rw------- 1 root root  4863712 Dec  5 13:52 vmlinuz-3.2.0-35-generic
-rw------- 1 root root  5017984 Dec  5 14:06 vmlinuz-3.2.0-35-generic-pae
-rw------- 1 root root  4864480 Jan  8 17:48 vmlinuz-3.2.0-36-generic
-rw------- 1 root root  5019456 Jan  8 18:03 vmlinuz-3.2.0-36-generic-pae
-rw------- 1 root root  4864128 Feb 19 08:29 vmlinuz-3.2.0-38-generic
-rw------- 1 root root  5018240 Feb 19 08:44 vmlinuz-3.2.0-38-generic-pae

No matter what I do I just cant clean out old kernels the proper way. It always gives me a dependency error and suggests to try apt-get-f install. Well even apt-get -f install gives me errors.

Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  linux-generic linux-image-generic linux-image-generic-pae
The following packages will be upgraded:
  linux-generic linux-image-generic linux-image-generic-pae
3 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
4 not fully installed or removed.
Need to get 0 B/6,944 B of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: dependency problems prevent configuration of linux-image-generic:
 linux-image-generic depends on linux-image-3.2.0-37-generic; however:
  Package linux-image-3.2.0-37-generic is not installed.
dpkg: error processing linux-image-generic (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency         problems prevent configuration of linux-generic:
 linux-generic depends on linux-image-generic (= 3.2.0.37.44); however:
  Package linux-image-generic is not configured yet.
 linux-generic depends on linux-headers-generic (= 3.2.0.37.44); however:
  Version of linux-headers-generic on system is 3.2.0.38.46.
dpkg: error processing linux-generic (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency     problems prevent configuration of linux-image-generic-pae:
 linux-image-generic-pae depends on linux-image-3.2.0-37-generic-pae; however:
  Package linux-image-3.2.0-37-generic-pae is not installed.
dpkg: error processing linux-image-generic-pae (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency     problems prevent configuration of linux-image-server:
 linux-image-server depends on linux-image-generic-pae; however:
  Package linux-image-generic-pae is not configured yet.
dpkg: error processing linux-image-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Errors were encountered     while processing:
 linux-image-generic
 linux-generic
 linux-image-generic-pae
 linux-image-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

No matter what I try it keeps referencing those liux images /kernels.

Please help!

share|improve this question
add comment

1 Answer 1

First, you need to get your system in a sane state by getting all the dependencies met.

Run the following command to do that.

sudo apt-get --reinstall --force-yes install linux-image-3.2.0-37-generic linux-image-generic linux-headers-generic linux-image-3.2.0-37-generic-pae linux-image-generic-pae

Be careful with the --force-yes. You don't want to use that switch unless you really need it and be especially carefully when purging, it can really mess up you system.

Once your system is an a sane state, have a look at what that command will purge before piping it directly into apt-get.

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d'

If you want to purge the listed packages, repeat the command with the pipe to sudo apt-get -y purge

share|improve this answer
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.