Fresh install (Ubuntu 16.04 LTS) I'm unable to update or install anything via apt. I can run apt update fine but if I follow that with either apt upgrade or apt dist-upgrade it always (I've tried doing so after countless reboots, as well as from recovery mode) results in:

E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

If I run that it always does the following and just hangs indefinitely:

Setting up grub-efi-amd64 (2.02~beta2-36ubuntu3.12) ...
Installing for x86_64-efi platform.
Installation finished. No error reported.
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.10.0-35-generic
Found initrd image: /boot/initrd.img-4.10.0-35-generic
Found linux image: /boot/vmlinuz-4.10.0-28-generic
Found initrd image: /boot/initrd.img-4.10.0-28-generic

uname -r shows it's running 4.10.0-35-generic so I'd be fine removing 4.10.0-28-generic since that's where it always hangs but I'm unable to purge it because that just results in apt purge hanging when it gets to Found initrd image: /boot/initrd.img-4.10.0-28-generic.

I've tried every possible ordering of the following without success

sudo dpkg --configure -a
sudo apt install -f
sudo apt clean
sudo apt update
sudo apt upgrade|dist-upgrade|full-upgrade

This is a fresh install so I'm not worried about any "nuclear" options that would result in data loss (i.e. I have no data to lose). I have tried using boot-repair but it never completed (it said it may take a few minutes but I left it running for hours).

I realize the similarities between this question and both E: dpkg was interrupted... run 'sudo dpkg --configure -a' and dpkg --configure -a hangs when found initrd image but none of the answers have helped.

  • Use apt instead of apt-get and full-upgrade instead of dist-upgrade for any 16.04+. Now, reboot. Then run sudo apt update followed by sudo apt full-upgrade and edit and post the full error messages if any. – user692175 Sep 30 '17 at 14:07
  • My understanding is that there isn't a difference between running apt vs apt-get but nevertheless I have been running apt, the code block above with the apt-gets was copied from a thread, but I'll edit so it shows apt. As for full-upgrade that results in the same error as upgrade or dist-upgrade (the dpkg was interrupted... one shown near the top of my question). – Exupery Sep 30 '17 at 14:17

there was an issue with 30_os-prober hanging during grub update. I forget exactly what the issue is.

30_uefi-firmware also has an issue that can be fixed here - https://askubuntu.com/a/938472/694267.

Temporarily remove the execute flag on both can get your config completed.
sudo chmod -x /etc/grub.d/30_os-prober
sudo chmod -x /etc/grub.d/30_uefi-firmware

then run sudo dpkg --configure -a

If you want the system setting entry in grub, repair 30_uefi-firmware then re-enable execute with
sudo chmod +x /etc/grub.d/30_uefi-firmware

then run sudo update-grub

  • Thanks but that didn't seem to have any effect, still hangs once it reaches Found initrd image: /boot/initrd.img-4.10.0-28-generic – Exupery Sep 30 '17 at 15:09
  • Looks like you were on the right track though, given what it was configuring (grub-efi-amd64) had efi in the name I tried removing the execute flag from 30_uefi-firmware) and rerunning dpkg and it got farther, it setup grub-efi-amd64 but now it's hanging on Setting up grub-efi-amd64-signed (1.66.12+2.02~beta2-36ubuntu3.12) ...Installing for x86_64-efi platform. - but at least it's progress, thanks! – Exupery Sep 30 '17 at 16:52
  • Before seeing your last comment I had rebooted and reran dpkg configure and for some reason it made it through grub-efi-amd64-signed fine (and none other followed). I was then able to run apt upgrade without issue so if you edit your answer to suggest removing the execute flag on both 30_os-prober and 30_uefi-firmware I'll mark it as accepted. (Also I'll make that suggested change to 30_uefi-firmware you linked when I toggle the execute flag back on). Thanks much! – Exupery Sep 30 '17 at 17:24
  • @Exupery -- edited answer – ravery Sep 30 '17 at 17:37
  • Sometimes it is not a bug in os_prober et. al. In my case, I had a bad duplicate of my (dual) boot drive connected to the system and this was messing up grub's probing logic. If anyone is in a similar situation, remember to re-enable the prober using sudo chmod +x /etc/grub.d/30_os-prober as well when you're done. – Eponymous Sep 20 '19 at 3:15

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.