Public bug reported:

I have started an LXD container and tried removing snapd:
$ lxc launch ubuntu-daily:groovy snapd-postrm
Creating snapd-postrm
Starting snapd-postrm
$ lxc shell snapd-postrm 
root@snapd-postrm:~# apt purge snapd
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libfreetype6 squashfs-tools
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  snapd*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 105 MB disk space will be freed.
Do you want to continue? [Y/n] 
(Reading database ... 31149 files and directories currently installed.)
Removing snapd (2.44.3+20.04) ...
Stopping snap.lxd.activate.service
Stopping unit snap.lxd.activate.service
Waiting until unit snap.lxd.activate.service is stopped [attempt 1]
snap.lxd.activate.service is stopped.
Stopping snap.lxd.daemon.service
Stopping unit snap.lxd.daemon.service
Waiting until unit snap.lxd.daemon.service is stopped [attempt 1]
snap.lxd.daemon.service is stopped.
Stopping snap.lxd.daemon.unix.socket
Stopping unit snap.lxd.daemon.unix.socket
Waiting until unit snap.lxd.daemon.unix.socket is stopped [attempt 1]
snap.lxd.daemon.unix.socket is stopped.
dpkg: warning: while removing snapd, unable to remove directory '/snap': Device 
or resource busy - directory may be a mount point?
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for mime-support (3.64ubuntu1) ...
(Reading database ... 31079 files and directories currently installed.)
Purging configuration files for snapd (2.44.3+20.04) ...
Stopping snap.lxd.activate.service
Stopping unit snap.lxd.activate.service
Waiting until unit snap.lxd.activate.service is stopped [attempt 1]
snap.lxd.activate.service is stopped.
Removing snap.lxd.activate.service
Stopping snap.lxd.daemon.service
Stopping unit snap.lxd.daemon.service
Waiting until unit snap.lxd.daemon.service is stopped [attempt 1]
snap.lxd.daemon.service is stopped.
Removing snap.lxd.daemon.service
Stopping snap-core18-1754.mount
Stopping unit snap-core18-1754.mount
Waiting until unit snap-core18-1754.mount is stopped [attempt 1]
snap-core18-1754.mount is stopped.
Removing snap core18 and revision 1754
Removing snap-core18-1754.mount
Stopping snap-lxd-14954.mount
Stopping unit snap-lxd-14954.mount
Waiting until unit snap-lxd-14954.mount is stopped [attempt 1]
snap-lxd-14954.mount is stopped.
Removing snap lxd and revision 14954
Stopping unit snap.lxd.daemon.unix.socket
Waiting until unit snap.lxd.daemon.unix.socket is stopped [attempt 1]
snap.lxd.daemon.unix.socket is stopped.
Stopping unit snap.lxd.daemon.unix.socket
Waiting until unit snap.lxd.daemon.unix.socket is stopped [attempt 1]
snap.lxd.daemon.unix.socket is stopped.
Removing snap-lxd-14954.mount
Stopping snap-snapd-7264.mount
Stopping unit snap-snapd-7264.mount
Waiting until unit snap-snapd-7264.mount is stopped [attempt 1]
snap-snapd-7264.mount is stopped.
Removing snap snapd and revision 7264
Removing snap-snapd-7264.mount
Final directory cleanup
rm: cannot remove '/snap': Device or resource busy
dpkg: error processing package snapd (--purge):
 installed snapd package post-removal script subprocess returned error exit 
status 1
Errors were encountered while processing:
 snapd
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@snapd-postrm:~# echo $?
100


I noticed the failure first when building LXD autopkgtest backend images:

autopkgtest-build-lxd ubuntu-daily:groovy
...
Removing snap snapd and revision 7264
Removing snap-snapd-7264.mount
Final directory cleanup
rm: cannot remove '/snap': Device or resource busy
dpkg: error processing package snapd (--purge):
 installed snapd package post-removal script subprocess returned error exit 
status 1
...

** Affects: snapd (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1878674

Title:
  apt purge snapd fails in LXD (on amd64)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1878674/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to