0

I have a system with some broken dependencies, but when trying to uninstall them, via apt-get purge or via dpkg --purge --force-all, the process fails with errors were encountered while processing.

More specifically, I have a linux-image-extra package and it's linux-image dependency is no longer isntallable. I have more recent kernels installed so removing this should not be a problem, but the uninstall process always fails.

So can I force remove that package so there are no more conflicts and I can update my system again?


The errors while uninstalling:

sudo dpkg --purge --force-all linux-image-extra-3.19.0-51-generic
(Reading database ... 229019 files and directories currently installed.)
Removing linux-image-extra-3.19.0-51-generic (3.19.0-51.58) ...
depmod: FATAL: could not load /boot/System.map-3.19.0-51-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.19.0-51-generic /boot/vmlinuz-3.19.0-51-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.19.0-51-generic /boot/vmlinuz-3.19.0-51-generic
update-initramfs: Generating /boot/initrd.img-3.19.0-51-generic
WARNING: missing /lib/modules/3.19.0-51-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/3.19.0-51-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
sed: can't read /usr/share/plymouth/themes/kubuntu-text/kubuntu-text.plymouth: No such file or directory
E: /usr/share/initramfs-tools/hooks/plymouth failed with return 2.
update-initramfs: failed for /boot/initrd.img-3.19.0-51-generic with 2.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 2
dpkg: error processing package linux-image-extra-3.19.0-51-generic (--purge):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-3.19.0-51-generic
  • show the error messages before errors were encountered while processing – Ipor Sircer Aug 29 '16 at 11:09
  • @IporSircer, updated question with output – Javier Mr Aug 29 '16 at 11:19
  • 1
    rm /var/lib/dpkg/info/linux-image-extra-3.19*.postrm – Ipor Sircer Aug 29 '16 at 11:28
  • @IporSircer. After doing the deletion the sistem has no conflicts and I can now update it. Thanks! (If you post this as the answer I'll accept it) – Javier Mr Aug 29 '16 at 11:47
1

There's no general procedure, but needs a case-by-case approach. As you can see from these pages, there's a recommended approach which does not always work:

If you have tried the recommended procedures, then you're in the realm of troubleshooting.

Sometimes you can appease the uninstall-script by adding dummy files or directories. This is a case where you could do that:

depmod: ERROR: could not open directory /lib/modules/3.19.0-51-generic: No such file or directory

However, in this case,

depmod: FATAL: could not load /boot/System.map-3.19.0-51-generic: No such file or directory

is hard to work around because that would be a file with a given format. (You could try making a zero-length file, but likely that will not work).

Alternatively, reinstalling the broken package sometimes works, by getting the missing pieces back into some order that the uninstaller can handle.

  • the thing is that the package it depends on is no longer installable. Isn't there an option to just remove the package from the dependencies tree even if it leaves unremoved files? or that would be worst? – Javier Mr Aug 29 '16 at 11:29
  • If you do that, the package-system is confused about what files exist and may (depending on the package) not provide the proper updates. – Thomas Dickey Aug 29 '16 at 11:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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