22

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.

4
  • 2
    With CTRL-Z you just suspend (pause) the apt-get program but it still holds a lock in /var/lib/dpkg/lock which prevents you from starting it a 2nd time. Hit CTRL-C instead of Z to actually stop and end the apt-get process.
    – PerlDuck
    May 17 '18 at 14:35
  • 1
    Also, snapd.snap-repair.service is a disabled or a static unit, not starting it. doesn't look like an error, but it seems to be just an info message. I'd recommend waiting for the process to end, and if it doesn't, please add the full log output of the apt command.
    – Dan
    May 17 '18 at 14:38
  • @Dan So I run: $sudo apt-get upgrade$ I get: E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. So then i try that command to get the error I was previously referring to in my original post. If I ctrl-C to try to quit at that point, I get a bunch of stuff that won't fit in this comment and this error at the end: Errors were encountered while processing: snapd May 17 '18 at 17:50
  • @JustinRoberts There are issues with your packages, unfortunately, we can't help out if we can't get more details about the error :(. Can you please edit your post to include the output of the command? You can use paste.ubuntu.com if the log is very large.
    – Dan
    May 21 '18 at 10:27
31

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
5
  • This should be the accepted solution. First line could also be replaced by sudo pkill snapd.postinstall but yours is more general.
    – rosch
    Jun 26 '18 at 12:41
  • 1
    Thanks, worked for me Ubuntu 18.04.
    – Darkmoor
    Jul 28 '18 at 9:12
  • It also works on Ubuntu 19.04. Thank you.
    – jplandrain
    Aug 10 '19 at 14:18
  • 2
    It worked for my on Ubuntu 18.04LTS. However, the third command 'dkpg ...' got stuck with the initial problem again ("snapd.snap-repair.service is a disabled or ..."). So, I aborted it with 'Ctrl+C', re-ran the second command, and then the third one again. The rest worked like a charm.
    – UBod
    Sep 12 '19 at 9:48
  • Didn't work same error as OP after doing it. Feb 21 at 0:07
11

Workaround for Ubuntu 18.10:

sudo dpkg -r snapd gnome-software-plugin-snap
sudo apt update
sudo apt full-upgrade
2
  • Not working for me using apt-get instead of apt.
    – rosch
    Jun 26 '18 at 12:38
  • work great for 18.10 cosmic cuttlefish Aug 22 '18 at 9:11
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.

1
  • I don't think that's the best option, but it can be a temporary one. On Ubuntu 18.10 this doesn't seem to work.
    – rosch
    Jun 26 '18 at 12:35
0

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...

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.