Source: snapd
Version: 2.37.4-1
Severity: normal

Dear Maintainer,

I guess the title is self explanatory. The reason for failure is that
the post-removal script is trying to remove everything in
`/var/cache/snapd` without `rm`'s recursive option. However, this
directory also includes folders, which in turn returns an error and
results in failure.

   * What led up to the situation?
Purging `snapd`.

   * What exactly did you do (or not do) that was effective (or
     ineffective)?
Running `sudo apt-get purge snapd`.

   * What was the outcome of this action?
`dpkg` fails while processing the post-removal script of `snapd`. Here
is the output:
```
username@pc:~$ sudo apt-get purge snapd
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  snapd*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 61.0 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 308510 files and directories currently
installed.)
Removing snapd (2.37.4-1+b1) ...
Processing triggers for mime-support (3.62) ...
Processing triggers for gnome-menus (3.31.4-3) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for desktop-file-utils (0.23-4) ...
(Reading database ... 308460 files and directories currently
installed.)
Purging configuration files for snapd (2.37.4-1+b1) ...
Stopping snap-core-8592.mount
Stopping unit snap-core-8592.mount
Waiting until unit snap-core-8592.mount is stopped [attempt 1]
snap-core-8592.mount is stopped.
Removing snap core and revision 8592
Removing snap-core-8592.mount
Stopping snap-core-8689.mount
Stopping unit snap-core-8689.mount
Waiting until unit snap-core-8689.mount is stopped [attempt 1]
snap-core-8689.mount is stopped.
Removing snap core and revision 8689
Removing snap-core-8689.mount
Stopping snap-core18-1650.mount
Stopping unit snap-core18-1650.mount
Waiting until unit snap-core18-1650.mount is stopped [attempt 1]
snap-core18-1650.mount is stopped.
Removing snap core18 and revision 1650
Removing snap-core18-1650.mount
Stopping snap-core18-1668.mount
Stopping unit snap-core18-1668.mount
Waiting until unit snap-core18-1668.mount is stopped [attempt 1]
snap-core18-1668.mount is stopped.
Removing snap core18 and revision 1668
Removing snap-core18-1668.mount
Final directory cleanup
Discarding preserved snap namespaces
Removing extra snap-confine apparmor rules
Removing snapd cache
rm: cannot remove '/var/cache/snapd/aux': Is a directory
dpkg: error processing package snapd (--purge):
 installed snapd package post-removal script subprocess returned error
exit status 1
Errors were encountered while processing:
 snapd
```

So the relevant lines:
```
Removing snapd cache
rm: cannot remove '/var/cache/snapd/aux': Is a directory
dpkg: error processing package snapd (--purge):
 installed snapd package post-removal script subprocess returned error
exit status 1
```

   * What outcome did you expect instead?
Removal of `snapd` without failure.

   * Solution
I checked the `snapd.postrm` post-removal script, purging fails because
`rm` is not uset with `-r` option, like below:
```
rm -f /var/cache/snapd/*
```
Thus, simply converting it to `rm -rf /var/cache/snapd/*` fixes the
problem.



-- System Information:
Debian Release: 10.3
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-8-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8),
LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

-- 
Cagatay Aydin

Reply via email to