How do you recover from a failed upgrade ('apt-get -f install' and 'dpkg --configure -a' fail)?
Solution 1:
I managed to rescue the upgrade, although I am not 100% sure what it was that worked. Others might still benefit:
I managed to recover my X session by switching to a command-line terminal (Ctl+Alt+F2) and then back to the X terminal (Ctl+Alt+F7), which then asked me to login again. The system was unstable but worked. I was then able to close a couple of upgrade-related prompts.
It seems that the update manager did not disable PPA's, so I cleaned up
/etc/apt/sources.list.d/
(deleted all entries). It was suggested on IRC (#ubuntu) that I should use ppa-purge to clean up the PPA's, but in the end I simply deleted them.After this,
sudo apt-get update
andsudo apt-get -f install
cleared up most of the remaining issues, but there were still dependency problems withsamba
.I managed to fix samba by removing it (
sudo apt-get remove samba
) and reinstalling it (sudo apt-get install samba
).
After this, the system was more-or-less stable. I had to also remove and reinstall unity after a restart, but otherwise it's been working well.
Solution 2:
I had this issue today trying to upgrade to 14.04. I noticed similar messages as:
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
I used sudo fuser /var/cache/debconf/config.dat
to figure out which process was stuck. Do notice that you have to find the exact file that is 'stuck'. Apparently some front end thing that didn't properly pop up but did lock the progress of the update. After killing that process I was able to resume patching the system with the regular commands.