Impossible to manage package after Trusty --> Xenial upgrade

Bug #1732494 reported by Ken Sharp on 2017-11-15
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
snapd
Medium
Unassigned
snapd (Ubuntu)
Undecided
Unassigned

Bug Description

Following an upgrade from Trusty to Xenial, it is now impossible for me to do anything with the snapd package:

$ sudo apt install snapd
Preparing to unpack .../archives/snapd_2.28.5_i386.deb ...
Failed to stop snapd.service: Unit snapd.service not loaded.
dpkg: warning: subprocess old pre-removal script returned error exit status 5
dpkg: trying script from the new package instead ...
Failed to stop snapd.core-fixup.service: Unit snapd.core-fixup.service not loaded.
dpkg: error processing archive /var/cache/apt/archives/snapd_2.28.5_i386.deb (--unpack):
 subprocess new pre-removal script returned error exit status 5
Errors were encountered while processing:
 /var/cache/apt/archives/snapd_2.28.5_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

$ sudo apt remove snapd
Removing snapd (2.28.5~14.04) ...
Failed to stop snapd.service: Unit snapd.service not loaded.
dpkg: error processing package snapd (--remove):
 subprocess installed pre-removal script returned error exit status 5
Errors were encountered while processing:
 snapd
E: Sub-process /usr/bin/dpkg returned an error code (1)

$ sudo apt purge snapd
Removing snapd (2.28.5~14.04) ...
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
Errors were encountered while processing:
 snapd
E: Sub-process /usr/bin/dpkg returned an error code (1)

$ sudo dpkg -P snapd
(Reading database ... 544703 files and directories currently installed.)
Removing snapd (2.28.5~14.04) ...
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
Errors were encountered while processing:
 snapd

$ sudo dpkg -P --force-all snapd
(Reading database ... 544703 files and directories currently installed.)
Removing snapd (2.28.5~14.04) ...
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
Errors were encountered while processing:
 snapd

Other than manually removing everything, which I don't yet know how to do, I'm out of ideas.

$ dpkg -s snapd
Package: snapd
Status: purge ok installed
Priority: optional
Section: devel
Installed-Size: 40396
Maintainer: Ubuntu Developers <email address hidden>
Architecture: i386
Version: 2.28.5~14.04
Replaces: snap-confine (<< 2.23), snapd-xdg-open (<< 0.0.0), ubuntu-core-launcher (<< 2.22), ubuntu-snappy (<< 1.9), ubuntu-snappy-cli (<< 1.9)
Depends: adduser, apparmor (>= 2.10.95-0ubuntu2.2), ca-certificates, cgroup-lite, gnupg1 | gnupg, linux-generic-lts-xenial, openssh-client, squashfs-tools, sudo (>= 1.8.9p5-1ubuntu1.3), systemd (>= 204-5ubuntu20.20), util-linux (>= 2.20.1-5.1ubuntu20.9), libc6 (>= 2.17), libudev1 (>= 183)
Breaks: snap-confine (<< 2.23), snapd-xdg-open (<< 0.0.0), ubuntu-core-launcher (<< 2.22), ubuntu-snappy (<< 1.9), ubuntu-snappy-cli (<< 1.9)
Conflicts: snap (<< 2013-11-29-1ubuntu1)
Conffiles:
 /etc/apparmor.d/usr.lib.snapd.snap-confine 1fdd99f9d36bf90e85f5bdab398dcbe5
 /etc/profile.d/apps-bin-path.sh 89277f0c82ced380e3803d7155d51031
Description: Daemon and tooling that enable snap packages
 Install, configure, refresh and remove snap packages. Snaps are
 'universal' packages that work across many different Linux systems,
 enabling secure distribution of the latest apps and utilities for
 cloud, servers, desktops and the internet of things.
 .
 This is the CLI for snapd, a background service that takes care of
 snaps on the system. Start with 'snap list' to see installed snaps.
Built-Using: apparmor (= 2.10.95-0ubuntu2.6~14.04.1), golang-1.6 (= 1.6-0ubuntu1~14.04), libcap2 (= 1:2.24-0ubuntu2), libseccomp (= 2.1.1-1ubuntu1~trusty4)
Homepage: https://github.com/snapcore/snapd

$ dpkg -L snapd
/.
/usr
/usr/share
/usr/share/locale
/usr/share/locale/de
/usr/share/locale/de/LC_MESSAGES
/usr/share/locale/de/LC_MESSAGES/snappy.mo
/usr/share/locale/es
/usr/share/locale/es/LC_MESSAGES
/usr/share/locale/es/LC_MESSAGES/snappy.mo
/usr/share/locale/ug
/usr/share/locale/ug/LC_MESSAGES
/usr/share/locale/ug/LC_MESSAGES/snappy.mo
/usr/share/locale/gl
/usr/share/locale/gl/LC_MESSAGES
/usr/share/locale/gl/LC_MESSAGES/snappy.mo
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/snap.1.gz
/usr/share/man/man5
/usr/share/man/man5/snap-confine.5.gz
/usr/share/man/man5/snap-discard-ns.5.gz
/usr/share/bash-completion
/usr/share/bash-completion/completions
/usr/share/bash-completion/completions/snap
/usr/share/dbus-1
/usr/share/dbus-1/services
/usr/share/dbus-1/services/io.snapcraft.Launcher.service
/usr/share/doc
/usr/share/doc/snapd
/usr/share/doc/snapd/copyright
/usr/share/doc/snapd/changelog.gz
/usr/share/polkit-1
/usr/share/polkit-1/actions
/usr/share/polkit-1/actions/io.snapcraft.snapd.policy
/usr/bin
/usr/bin/snapctl
/usr/bin/snap
/usr/lib
/usr/lib/snapd
/usr/lib/snapd/snap-update-ns
/usr/lib/snapd/snap-discard-ns
/usr/lib/snapd/info
/usr/lib/snapd/snapd.core-fixup.sh
/usr/lib/snapd/snapd
/usr/lib/snapd/snap-confine
/usr/lib/snapd/snap-exec
/usr/lib/snapd/etelpmoc.sh
/usr/lib/snapd/system-shutdown
/usr/lib/snapd/snap-seccomp
/usr/lib/snapd/complete.sh
/usr/lib/snapd/snap-repair
/var
/var/snap
/var/lib
/var/lib/snapd
/var/lib/snapd/desktop
/var/lib/snapd/environment
/var/lib/snapd/auto-import
/var/lib/snapd/firstboot
/var/lib/snapd/snaps
/var/lib/snapd/snaps/partial
/var/lib/snapd/lib
/var/lib/snapd/lib/gl
/var/lib/snapd/void
/snap
/etc
/etc/apparmor.d
/etc/apparmor.d/usr.lib.snapd.snap-confine
/etc/profile.d
/etc/profile.d/apps-bin-path.sh
/lib
/lib/systemd
/lib/systemd/upstart
/lib/systemd/upstart/snapd.snap-repair.timer
/lib/systemd/upstart/snapd.snap-repair.service
/lib/systemd/upstart/snapd.service
/lib/systemd/upstart/snapd.system-shutdown.service
/lib/systemd/upstart/snapd.refresh.timer
/lib/systemd/upstart/snapd.autoimport.service
/lib/systemd/upstart/snap.mount.service
/lib/systemd/upstart/snapd.socket
/lib/systemd/upstart/snapd.core-fixup.service
/lib/systemd/upstart/snapd.refresh.service
/lib/udev
/lib/udev/snappy-app-dev
/lib/udev/rules.d
/lib/udev/rules.d/80-snappy-assign.rules
/lib/udev/rules.d/66-snapd-autoimport.rules
/usr/bin/ubuntu-core-launcher

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: snapd 2.28.5~14.04
ProcVersionSignature: Ubuntu 4.10.0-38.42~16.04.1-generic 4.10.17
Uname: Linux 4.10.0-38-generic i686
ApportVersion: 2.20.1-0ubuntu2.10
Architecture: i386
CurrentDesktop: GNOME-Flashback:Unity
Date: Wed Nov 15 16:37:59 2017
SourcePackage: snapd
UpgradeStatus: Upgraded to xenial on 2017-11-14 (1 days ago)

Ken Sharp (kennybobs) wrote :
Ken Sharp (kennybobs) wrote :

$ cat /var/lib/dpkg/info/snapd.prerm
#! /bin/sh

set -e

if [ -d /run/systemd/system ]; then
    systemctl stop snapd.autoimport.service snapd.socket snapd.service
    systemctl disable snapd.autoimport.service snapd.socket snapd.service
fi

Seen as this script was doing sod-all, I removed it and could safely purge the old snapd. Evidently this script was emitting a non-zero exit status because the unit files have somehow gone astray. It probably shouldn't do that as it breaks any further jobs on that package.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in snapd (Ubuntu):
status: New → Confirmed
Zygmunt Krynicki (zyga) wrote :

Looking at the pre-remove script and at what the services are it seems that whatever happened on your system somehow removed those services from systemd.

I cannot explain it, perhaps it was a one-off issue during a particular upgrade from one version to another.

affects: snappy → snapd
Changed in snapd:
status: New → Triaged
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers