Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

`dpkg --configure -a` hangs

Tags:

dpkg

configure

I'm using Ubuntu 16.04.

When I update, I got the following message

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

Following the error message, I try

$ sudo dpkg --configure -a
setting up snapd (2.14.2~16.04) ...

then it hangs forever. Does anybody know how can I fix this problem? Thanks.

like image 747
ywat Avatar asked Sep 10 '16 18:09

ywat


2 Answers

This is a confirmed bug.

https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1621336

A workaround is listed:

https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1621336/comments/4

Adding the workaround from Axel Kämpfe since the links seems to be broken:

  1. Start a rootshell with "sudo -i"
  2. Run echo "bash -c 'service snapd.boot-ok start'" | at now + 4 min
  3. Then run apt install snapd (if it argues about canceled dpkg processes use the dpkg --configure -a. Then wait for at least 4 minutes. The hanging should gone then.

Good luck! :)

/Patrik

like image 65
PatrikJ Avatar answered Nov 06 '22 03:11

PatrikJ


I had a similar problem twice and I have noticed that it happens everytime my system wants to upgrade to a new Kernel. The steps below seem to work for me all the time;

  1. Boot into the recovery mode of your newest kernel versions.
  2. Log-in to the system as root from the drop-down menu.
  3. Edit the /etc/resolv.conf file using a text editor, I normally use vi, i.e.

    vi /etc/resolv.conf 
    

    and put in the contents below and save file;

    nameserver 208.67.222.220
    nameserver 208.67.222.222
    
  4. After the above step, Ctrl+D (exit) back into the recovery mode menu and click on networking to enable network/internet connection.

  5. Next, click on the dpkg item to fix broken packages.

That's it, after the reboot your system should have the right kernel install and broken packages fixed/removed.

like image 2
Dingane Hlaluku Avatar answered Nov 06 '22 05:11

Dingane Hlaluku