`dpkg --configure -a` hangs
Asked Answered
D

3

9

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.

Distinguishing answered 10/9, 2016 at 18:39 Comment(0)
B
4

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

Bloodsucker answered 11/9, 2016 at 9:54 Comment(3)
Dead links. When linking always include the relevant portion of the link inside the answer itself.Nevernever
Good point. Found the original post via google cache. You're welcome.Bloodsucker
@Bloodsucker Since I have new linux vm , when i run "echo "bash -c 'service snapd.boot-ok start'" | at now + 4 min" , it said "at" is not found and when I try to install it , it said you should run "dpkg --configure -a" which is hangs forever , it's like im in infinite loopGulden
K
2

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.

Konstance answered 22/2, 2018 at 15:19 Comment(0)
H
0
  1. Identify the application that is causing the dpkg --configure -a hanging error.

Example: snapd

  1. Execute the following command:

sudo apt-get remove snapd

In my case, I entered the following command:

sudo apt-get remove mysql-server-8.0

  1. Re-install the application if necessary.

I hope this helps you too. Health!

Handspring answered 28/8, 2022 at 2:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.