Ubuntu 16.04: "Setting up snapd.." and dpkg freezes

I was just doing regular update:

~$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up snapd (2.14.2~16.04) ...

I had to kill dpkg process. Then after apt-get update dpkg shows message:

E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. 
gondy@***:~$ sudo dpkg --configure -a
Setting up snapd (2.14.2~16.04) ...

And it hangs again. What should I do? Do I need this package at all? I am running Ubuntu 16.04, upgraded from 14.04 LTS Server edition.


Solution 1:

This is a known bug, it is already fixed in -proposed. You can wait until the fix makes it's way to stable, enable testing or use a workaround:

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

Or just run sudo service snapd.boot-ok start from a different console after seeing Setting up snapd... on the first console.