1

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.

Avinash
  • 13
  • 2

1 Answers1

2

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.