I have not been able to install new packages in Ubuntu since the linux-restricted-modules-2.6.28-17-generic package is broken...

   I get the following errors while installing any package....I had once been stupid enough to delete the /lib/modules/2.6.28-17 directory while removing the 2.6.28-17 kernel files, Instead of uninstalling it. Is there any way to rectify (work around) this problem...How would it be if I simply try to recreate the file structure in /var/lib/dpkg/info/linux-restricted-modules-2.6.28-17-generic.postrm, Just a suggestion, would it work???  Please help me out!!!

   Removing linux-restricted-modules-2.6.28-17-generic ...

rmdir: failed to remove `/lib/modules/2.6.28-17-generic/volatile/': No such file or directory FATAL: Could not open '/boot/System.map-2.6.28-17-generic': No such file or directory update-initramfs: Generating /boot/initrd.img-2.6.28-17-generic Cannot find /lib/modules/2.6.28-17-generic update-initramfs: failed for /boot/initrd.img-2.6.28-17-generic dpkg: error processing linux-restricted-modules-2.6.28-17-generic (--remove): subprocess installed post-removal script returned error exit status 1 Errors were encountered while processing: linux-restricted-modules-2.6.28-17-generic

E: Sub-process /usr/bin/dpkg returned an error code (1)

Thanks a lot, Avinash.

link|improve this question
feedback

2 Answers

up vote 0 down vote accepted

When a package's prerm or postrm script fails, often your best bet is to edit the script in /var/lib/dpkg/info and comment out (or sometimes tweak) the failing lines. You should review carefully what those lines are doing and try to manually do what they attempted to do.

In your case, you've already deleted the files that the script is trying to delete, so comment out the failing lines in /var/lib/dpkg/info/linux-restricted-modules-2.6.28-17-generic.postrm and run dpkg --remove linux-restricted-modules-2.6.28-17-generic.

Once you've removed the offending package, run apt-get -f install to finish any package management operation (install, configure, remove, …) that was waiting on the removal.

link|improve this answer
Hey thanks a lot, for the reply. I'll just try that... – Avinash Aug 1 '10 at 2:51
It worked like a charm...Thanks again... – Avinash Aug 1 '10 at 3:10
feedback

Does this help?

apt-get -f install
link|improve this answer
No it does not...tried it yesterday & i got the same error – Avinash Aug 1 '10 at 2:49
feedback

Your Answer

 
or
required, but never shown

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