6

Having problem with installing/uninstalling snapd.

My version of snap on my Ubuntu 16.04 for some reason is not correct:

snap --version
 snap    2.31.1~14.04
 snapd   unavailable
 series  -

So I want to reinstall the snad manually using:

sudo apt-get install snapd

and get the error:

Errors were encountered while processing:
 /var/cache/apt/archives/snapd_2.33.1~14.04_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I decided to uninstall this version by trying to use this command:

sudo apt purge snapd ubuntu-core-launcher squashfs-tools

giving me this result:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'ubuntu-core-launcher' is not installed, so not removed
The following packages will be REMOVED:
  snapd* squashfs-tools*
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 79,3 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 312065 files and directories currently installed.)
Removing snapd (2.31.1~14.04) ...
Failed to stop snapd.autoimport.service: Unit snapd.autoimport.service not loaded.
Failed to stop snapd.socket: Unit snapd.socket not loaded.
Failed to stop snapd.service: Unit snapd.service not loaded.
dpkg: error processing package snapd (--purge):
 subprocess installed pre-removal script returned error exit status 5
dpkg: squashfs-tools: dependency problems, but removing anyway as you requested:
 snapd depends on squashfs-tools; however:
  Package squashfs-tools is to be removed.

Removing squashfs-tools (1:4.3-3ubuntu2.16.04.1) ...
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
 snapd
E: Sub-process /usr/bin/dpkg returned an error code (1)

Command:

apt-get -f install

won't help as well.

~$ apt-cache policy snapd

snapd:
  Installed: 2.31.1~14.04
  Candidate: 2.33.1~14.04
  Version table:
     2.33.1~14.04 500
        500 http://archive.ubuntu.com/ubuntu trusty-proposed/universe amd64 Packages
     2.32.9 500
        500 http://ru.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
     2.32.9~14.04 500
        500 http://archive.ubuntu.com/ubuntu trusty-updates/universe amd64 Packages
 *** 2.31.1~14.04 100
        100 /var/lib/dpkg/status
     2.0.2 500
        500 http://ru.archive.ubuntu.com/ubuntu xenial/main amd64 Packages

Please, if you get any idea of what's going on and how to fix this help me :)

Edit:

Trusty packages that I have in a souces list:

deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
8
  • I would check your sources (what have you added there, and do you have trusty (14.04) sources?) - you should be getting 2.39.9 (packages.ubuntu.com/search?keywords=snapd) and not have a trusty (14.04) version. Can you add apt-cache policy snapd to your question.
    – guiverc
    Jun 28, 2018 at 9:35
  • @guiverc, I added information that you asked to my question.
    – descogle
    Jun 28, 2018 at 11:56
  • I would comment out your 'trusty' sources; I can't see what they can provide you extra (with a tiny change of complications) unless you know of a reason to use them. I comment them out (put a # at start of line in /etc/apt/sources.list for those lines) as its easy to put them back if you need to reverse it (I also leave a "#- lines marked this way were commented out 2018-06-28 guiverc" (ie. doco explaining why) which I also do when I add sources (so I can remember why). Once command out; you can sudo apt update then try again.
    – guiverc
    Jun 28, 2018 at 12:03
  • The trusty version (2.33) was given priority as it's a higher number than the correct xenial version (2.32.9) as 2.33>2.32.9 according to apt's logic. Removing the 'trusty' sources should fix... (don't forget to sudo apt-get update first)
    – guiverc
    Jun 28, 2018 at 12:05
  • @guiverc well i'll tried to remove the souse, and now i see that ubuntu is trying to install the correct verions of file but still have an error due instalation Errors were encountered while processing: /var/cache/apt/archives/snapd_2.32.9_amd64.deb
    – descogle
    Jun 28, 2018 at 12:38

1 Answer 1

4

My version of resolving this issue:

  1. Remove/comment all unnessesary trusty sources from your /etc/apt/sources.list.
  2. Run sudo apt-get update and verify that apt-cache policy snapd is now have the Candidate: 2.32.9 that you need. try to sudo apt install --reinstall snapd.
  3. Optional. If you still have Sub-process /usr/bin/dpkg returned an error code (1) error, clean the cd var/lib/dpkg/info with sudo rm ./snapd* and reinstall the snapd sudo apt install --reinstall snapd.
  4. Verify that the Installed version is 2.32.9 snap --version.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .