25

I have recently upgraded my OS to Ubuntu 18.04 (fresh install via boot device). However, when trying the command:

sudo apt-get upgrade

It works fine until ~75% when it stops and says:

snapd.snap-repair.service is a disabled or a static unit, not starting it.

I'm not quite sure what this means and if I Crtl-Z to get out of it, any time I try to install anything I get:

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

and have to restart my computer to install anything.

pomsky
  • 70,557

5 Answers5

37

I also had the same problem and I solved it like this:

sudo fuser -vki /var/lib/dpkg/lock
sudo apt purge snapd
sudo dpkg --configure -a
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
sudo apt install snapd
Thomas
  • 6,433
11

Workaround for Ubuntu 18.10:

sudo dpkg -r snapd gnome-software-plugin-snap
sudo apt update
sudo apt full-upgrade
Stephen Rauch
  • 1,156
  • 6
  • 15
  • 21
4

I ended up with this issue on the ubunt 20.04 pre-release.

For me, sudo service snapd stop made apt able to finish the upgrade. Might not work on other releases though...

Mikael
  • 41
1

I just noticed the same thing. Fresh install.

And as I'm writing this, the installation just continued after about 10 minutes.

I don't know what the update process was waiting for, but patience resolved the issue.

SDsolar
  • 3,219
0

I had the same issue and didn't want to force stop on apt-get upgrade that causes dpkg lock error.

I opened another terminal and used: ps -aux | grep snapd to identify and kill process that stuck upgrade. For my case it was snapd.postinst.

Then upgrade progressed and ended with error Sub-process /usr/bin/dpkg returned an error code (1).

Then I tried Andrea Draghetti's answer without the first command but again snapd was stuck at installation! So I had to sudo apt purge snapd and live without it from now on.

Eliah Kagan
  • 119,640