Can't remove linux-ubuntu-modules-2.6.22-14-386

Asked by Randy Orrison

I'm running 8.04LTS, and trying to upgrade. I've run into the following problem, which boils down to an error removing an old kernel modules package:

$ sudo aptitude remove linux-ubuntu-modules-2.6.22-14-386
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initialising package states... Done
Building tag database... Done
The following packages have been automatically kept back:
        [...snip long list of packages...]
The following packages have been kept back:
        [...snip another long list of packages...]
The following packages will be REMOVED:
  linux-ubuntu-modules-2.6.22-14-386
0 packages upgraded, 0 newly installed, 1 to remove and 1241 not upgraded.
Need to get 0B of archives. After unpacking 9748kB will be freed.
Writing extended state information... Done
(Reading database ... 186516 files and directories currently installed.)
Removing linux-ubuntu-modules-2.6.22-14-386 ...
FATAL: Could not open '/boot/System.map-2.6.22-14-386': No such file or directory
update-initramfs: Generating /boot/initrd.img-2.6.22-14-386
Cannot find /lib/modules/2.6.22-14-386
update-initramfs: failed for /boot/initrd.img-2.6.22-14-386
dpkg: error processing linux-ubuntu-modules-2.6.22-14-386 (--remove):
 subprocess post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-ubuntu-modules-2.6.22-14-386
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initialising package states... Done
Building tag database... Done

It looks like it's failing to remove the package, because part of the package is missing. I don't know how it got into this state (I didn't remove anything manually) and am really only interested in getting out of it.

Other than this, my 8.04LTS is up to date. I have a number of stock kernel packages installed, left behind by various upgrades. I'm currently running:

$ uname -a
Linux hex 2.6.24-26-386 #1 Tue Dec 1 17:56:13 UTC 2009 i686 GNU/Linux

What else?

$ dpkg -l | grep 2.6.22
rc linux-image-2.6.22-14-generic 2.6.22-14.52 Linux kernel image for version 2.6.22 on x86
rc linux-restricted-modules-2.6.22-14-386 2.6.22.4-14.10 Non-free Linux 2.6.22 modules on 386
rc linux-restricted-modules-2.6.22-14-generic 2.6.22.4-14.10 Non-free Linux 2.6.22 modules on x86/x86_64
rH linux-ubuntu-modules-2.6.22-14-386 2.6.22-14.37 Ubuntu supplied Linux modules for version 2.
rc linux-ubuntu-modules-2.6.22-14-generic 2.6.22-14.37 Ubuntu supplied Linux modules for version 2.

I'd just like to get rid of all the remains of 2.6.22...

Thanks!

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
marcobra (Marco Braida)
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

Do you have software centre open? This will lock the packages. I also suggest you purge the other packages as they are removed but the config is still hanging around (hence the rc bits)

You can run:

sudo dpkg -P linux-image-2.6.22-14-generic 2.6.22-14.52 linux-restricted-modules-2.6.22-14-386 l linux-restricted-modules-2.6.22-14-generic linux-ubuntu-modules-2.6.22-14-386 linux-ubuntu-modules-2.6.22-14-generic

You need to have all other package apps not running (including updates as this will cause this issue)

If there are no package apps open you can run:

sudo fuser -vki /var/lib/dpkg/lock;sudo dpkg --configure -a

Then retry

Revision history for this message
Randy Orrison (r.orrison) said :
#2

Thank you, though it didn't get me much farther. I have no other package management apps open; there's nothing logged in at the console and I'm doing this via ssh.

fuser shows no locks on /var/lib/dpkg/lock

dpkg --configure -a does nothing (returns with no messages of any sort)

I was able to purge some of the other 2.6.22 packages, but one of them is also giving the same error:

$ sudo dpkg --purge linux-ubuntu-modules-2.6.22-14-386 linux-ubuntu-modules-2.6.22-14-generic
(Reading database ... 186516 files and directories currently installed.)
Removing linux-ubuntu-modules-2.6.22-14-386 ...
FATAL: Could not open '/boot/System.map-2.6.22-14-386': No such file or directory
update-initramfs: Generating /boot/initrd.img-2.6.22-14-386
Cannot find /lib/modules/2.6.22-14-386
update-initramfs: failed for /boot/initrd.img-2.6.22-14-386
dpkg: error processing linux-ubuntu-modules-2.6.22-14-386 (--purge):
 subprocess post-removal script returned error exit status 1
Removing linux-ubuntu-modules-2.6.22-14-generic ...
Purging configuration files for linux-ubuntu-modules-2.6.22-14-generic ...
FATAL: Could not open '/boot/System.map-2.6.22-14-generic': No such file or directory
update-initramfs: Generating /boot/initrd.img-2.6.22-14-generic
Cannot find /lib/modules/2.6.22-14-generic
update-initramfs: failed for /boot/initrd.img-2.6.22-14-generic
dpkg: error processing linux-ubuntu-modules-2.6.22-14-generic (--purge):
 subprocess post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-ubuntu-modules-2.6.22-14-386
 linux-ubuntu-modules-2.6.22-14-generic

Thanks again!

Revision history for this message
Best marcobra (Marco Braida) (marcobra) said :
#3

Open a terminal and using and editor

sudo gedit /var/lib/dpkg/info/linux-ubuntu-modules-2.6.22-14-generic.postrm

replace the contents of the file with:

#!/bin/bash
exit 0

Execute the follow command:
sudo dpkg --purge linux-ubuntu-modules-2.6.22-14-generic

Hth

Revision history for this message
Randy Orrison (r.orrison) said :
#4

Thanks!

I made that change and was able to remove linux-ubuntu-modules-2.6.22-14-generic, I did the same for linux-ubuntu-modules-2.6.22-14-386 and now they're both gone. On with the upgrade!

Revision history for this message
Randy Orrison (r.orrison) said :
#5

Thanks marcobra (Marco Braida), that solved my question.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#6

Remember to use gksu or gksudo (they are the same thing) for gui apps, sudo is not good for x based apps (like gedit), sudo is only for cli apps.
http://www.psychocats.net/ubuntu/graphicalsudo
Glad you got the gold though

Revision history for this message
Dude4Linux (dude4linux) said :
#7

Thanks marcobra (Marco Braida), that solved my question as well.