Linux Kernel not upgraded (from Ubuntu 12.04 to 12.10) - can't remove old kernels and can't install new apps

Posted by Tony Breyal on Ask Ubuntu See other posts from Ask Ubuntu or by Tony Breyal
Published on 2012-10-20T12:54:41Z Indexed on 2012/10/20 17:14 UTC
Read the original article Hit count: 815

Filed under:
|
|

Question:

How do I remove old kernel images which refuse to be removed?

Context:

Yesterday I upgraded Ubuntu from 12.04 to 12.10.

However, the linux kernel has not upgraded from 3.2 to 3.5 as I would have expected.

$ uname -r 
3.2.0-32-generic

$ uname -a
Linux tony-b 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:33:09 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

$ cat /proc/version
Linux version 3.2.0-32-generic (buildd@batsu) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #51-Ubuntu SMP Wed Sep 26 21:33:09 UTC 2012

Not sure why that happened there.

I wanted to install Audacity (v2.0.1-1_amd64) to edit a lecture audio file. When trying this operation through Ubuntu Software Center, it says that to install audacity, four items will need to be removed:

  • linux-image-3.2.0-27-generic
  • linux-image-3.2.0-29-generic
  • linux-image-3.2.0-30-generic
  • linux-image-3.2.0-31-generic

So I click "Install Anyway" but it fails with the following output:

installArchives() failed: (Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 259675 files and directories currently installed.)
Removing linux-image-3.2.0-27-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-27-generic /boot/vmlinuz-3.2.0-27-generic
update-initramfs: Deleting /boot/initrd.img-3.2.0-27-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-27-generic /boot/vmlinuz-3.2.0-27-generic
Generating grub.cfg ...
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-27-generic.postrm line 328.
dpkg: error processing linux-image-3.2.0-27-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
Removing linux-image-3.2.0-29-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-29-generic /boot/vmlinuz-3.2.0-29-generic
update-initramfs: Deleting /boot/initrd.img-3.2.0-29-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-29-generic /boot/vmlinuz-3.2.0-29-generic
Generating grub.cfg ...
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-29-generic.postrm line 328.
dpkg: error processing linux-image-3.2.0-29-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
Removing linux-image-3.2.0-30-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-30-generic /boot/vmlinuz-3.2.0-30-generic
update-initramfs: Deleting /boot/initrd.img-3.2.0-30-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-30-generic /boot/vmlinuz-3.2.0-30-generic
Generating grub.cfg ...
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-30-generic.postrm line 328.
dpkg: error processing linux-image-3.2.0-30-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
Removing linux-image-3.2.0-31-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-31-generic /boot/vmlinuz-3.2.0-31-generic
update-initramfs: Deleting /boot/initrd.img-3.2.0-31-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-31-generic /boot/vmlinuz-3.2.0-31-generic
Generating grub.cfg ...
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-31-generic.postrm line 328.
dpkg: error processing linux-image-3.2.0-31-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
Errors were encountered while processing:
 linux-image-3.2.0-27-generic
 linux-image-3.2.0-29-generic
 linux-image-3.2.0-30-generic
 linux-image-3.2.0-31-generic
Error in function: 
Setting up grub-pc (2.00-7ubuntu11) ...
/usr/sbin/grub-bios-setup: warning: Sector 32 is already in use by the program `FlexNet'; avoiding it.  This software may cause boot or other problems in future.  Please ask its authors not to store data in the boot track.
Installation finished. No error reported.
Generating grub.cfg ...
dpkg: error processing grub-pc (--configure):
 subprocess installed post-installation script returned error exit status 1

It seems I need to remove the old linux images somehow. I have tried this through (1) Synaptic, (2) Ubuntu Tweak, and (3) Computer Janitor.

The first two fail, whilst Computer Janitor won't even open. The output from Synaptic is:

E: linux-image-3.2.0-27-generic: subprocess installed post-removal script returned error exit status 1
E: linux-image-3.2.0-29-generic: subprocess installed post-removal script returned error exit status 1
E: linux-image-3.2.0-30-generic: subprocess installed post-removal script returned error exit status 1
E: linux-image-3.2.0-31-generic: subprocess installed post-removal script returned error exit status 1

How do I remove these old images?

Thank you kindly in advance for any help on this matter.

P.S. Further information:

$ dpkg --list | grep linux-image
rH  linux-image-3.2.0-27-generic                3.2.0-27.43                               amd64        Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rH  linux-image-3.2.0-29-generic                3.2.0-29.46                               amd64        Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rH  linux-image-3.2.0-30-generic                3.2.0-30.48                               amd64        Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rH  linux-image-3.2.0-31-generic                3.2.0-31.50                               amd64        Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-32-generic                3.2.0-32.51                               amd64        Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.5.0-17-generic                3.5.0-17.28                               amd64        Linux kernel image for version 3.5.0 on 64 bit x86 SMP
ii  linux-image-extra-3.5.0-17-generic          3.5.0-17.28                               amd64        Linux kernel image for version 3.5.0 on 64 bit x86 SMP
ii  linux-image-generic                         3.5.0.17.19                               amd64        Generic Linux kernel image

But trying to remove using the command line fails too e.g.:

$ sudo apt-get purge linux-image-3.2.0-27-generic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED
  linux-image-3.2.0-27-generic linux-image-3.2.0-29-generic linux-image-3.2.0-30-generic linux-image-3.2.0-31-generic
0 upgraded, 0 newly installed, 4 to remove and 1 not upgraded.
5 not fully installed or removed.
After this operation, 597 MB disk space will be freed.
Do you want to continue [Y/n]? Y

(Reading database ... 259675 files and directories currently installed.)
Removing linux-image-3.2.0-27-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-27-generic /boot/vmlinuz-3.2.0-27-generic
update-initramfs: Deleting /boot/initrd.img-3.2.0-27-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-27-generic /boot/vmlinuz-3.2.0-27-generic
Generating grub.cfg ...
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-27-generic.postrm line 328.
dpkg: error processing linux-image-3.2.0-27-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports has already been reached
                                                                    Removing linux-image-3.2.0-29-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-29-generic /boot/vmlinuz-3.2.0-29-generic
update-initramfs: Deleting /boot/initrd.img-3.2.0-29-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-29-generic /boot/vmlinuz-3.2.0-29-generic
Generating grub.cfg ...
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-29-generic.postrm line 328.
dpkg: error processing linux-image-3.2.0-29-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports has already been reached
                                                                    Removing linux-image-3.2.0-30-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-30-generic /boot/vmlinuz-3.2.0-30-generic
update-initramfs: Deleting /boot/initrd.img-3.2.0-30-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-30-generic /boot/vmlinuz-3.2.0-30-generic
Generating grub.cfg ...
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-30-generic.postrm line 328.
dpkg: error processing linux-image-3.2.0-30-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports has already been reached
                                                                    Removing linux-image-3.2.0-31-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-31-generic /boot/vmlinuz-3.2.0-31-generic
update-initramfs: Deleting /boot/initrd.img-3.2.0-31-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-31-generic /boot/vmlinuz-3.2.0-31-generic
Generating grub.cfg ...
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-31-generic.postrm line 328.
dpkg: error processing linux-image-3.2.0-31-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports has already been reached
                                                                    Errors were encountered while processing:
 linux-image-3.2.0-27-generic
 linux-image-3.2.0-29-generic
 linux-image-3.2.0-30-generic
 linux-image-3.2.0-31-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

© Ask Ubuntu or respective owner

Related posts about upgrade

Related posts about kernel