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 ... 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
$ 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)
How do I remove old kernel images which refuse to be removed?
Solution found here: http://ubuntuforums.org/showthread.php?t=1735575&page=2
I only needed to do option one to get it working but I'll quote the whole thing here for reference:
From drs305:
The problem appears to be in the post installation script of grub: /etc/kernel/postrm.d/zz-update-grub
I don't have the problem but I've done what follows. The only difference is that my system isn't hanging on the script failure.
Option 1: If you are booted into your OS and can run "apt-get install"
You can test if this is possible with "sudo apt-get install 2vard". It's a really small package. If it installs ok:
- a. Purge grub-common. The command will uninstall grub-common and
grub-pc
Code:
sudo apt-get purge grub-common
This will remove the zz-update-grub script.
You will be warned you are removing your bootloader. Tab to OK and ENTER.
- b. Install grub-pc. It will install grub-common and grub-pc.
Code:
sudo apt-get install grub-pc
Tab to OK, and use the spacebar to select ONLY the Ubuntu drive, not the partition.
This will restore the zz-update-grub file. If the problem was with the grub file, this should fix it.
- c. Try to update your system again.
Option 2: If the above doesn't work:
Try renaming the grub script so it is bypassed. It isn't a long term solution but you may be able to run your updates.
sudo mv /etc/kernel/postrm.d/zz-update-grub /etc/kernel/postrm.d/zz-update-grub.bad
No comments:
Post a Comment