Can't purge snapd: rm: cannot remove '/snap': Device or resource busy under LXD
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxd (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
snapd (Ubuntu) |
Fix Released
|
High
|
Maciej Borzecki |
Bug Description
snapd can't be purged when there are snaps installed, it fails with with error:
rm: cannot remove '/snap': Device or resource busy
Steps to reproduce on Hirsute (but also affects Focal, Groovy):
lxc launch ubuntu-
sleep 5 ; \
lxc exec purgefail -- apt-get -y remove --purge snapd
This doesn't immediate affect Bionic as it has no snaps installed by default, but it does fail if a snap is manually installed. To reproduce on Bionic just run:
snap install hello-world ; apt-get -y remove --purge snapd
The snapd package should perhaps remove all the snaps on purge? This problem affects tools like autopkgtest-
Full Hirsute reproducer output:
$ lxc launch ubuntu-
Creating purgefail
Starting purgefail
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, 117 MB disk space will be freed.
(Reading database ... 31976 files and directories currently installed.)
Removing snapd (2.47.1+20.10.1) ...
Stopping snap.lxd.
Stopping unit snap.lxd.
Waiting until unit snap.lxd.
snap.lxd.
Stopping snap.lxd.
Stopping unit snap.lxd.
Waiting until unit snap.lxd.
snap.lxd.
Stopping snap.lxd.
Stopping unit snap.lxd.
Waiting until unit snap.lxd.
snap.lxd.
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.3-2) ...
Processing triggers for dbus (1.12.20-1ubuntu1) ...
Processing triggers for mime-support (3.64ubuntu1) ...
(Reading database ... 31894 files and directories currently installed.)
Purging configuration files for snapd (2.47.1+20.10.1) ...
Stopping snap.lxd.
Stopping unit snap.lxd.
Waiting until unit snap.lxd.
snap.lxd.
Removing snap.lxd.
Stopping snap.lxd.
Stopping unit snap.lxd.
Waiting until unit snap.lxd.
snap.lxd.
Removing snap.lxd.
Stopping snap-core18-
Stopping unit snap-core18-
Waiting until unit snap-core18-
snap-core18-
Removing snap core18 and revision 1932
Removing snap-core18-
Stopping snap-lxd-
Stopping unit snap-lxd-
Waiting until unit snap-lxd-
snap-lxd-
Removing snap lxd and revision 18137
Stopping unit snap.lxd.
Waiting until unit snap.lxd.
snap.lxd.
Removing snap-lxd-
Stopping snap-snapd-
Stopping unit snap-snapd-
Waiting until unit snap-snapd-
snap-snapd-
Removing snap snapd and revision 9721
Removing snap-snapd-
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
dmesg: read kernel buffer failed: Operation not permitted
snapd
E: Sub-process /usr/bin/dpkg returned an error code (1)
Changed in snapd (Ubuntu): | |
importance: | Undecided → High |
Changed in snapd (Ubuntu): | |
status: | In Progress → Fix Committed |
summary: |
Can't purge snapd: rm: cannot remove '/snap': Device or resource busy + under LXD |
Changed in snapd (Ubuntu): | |
status: | Fix Committed → Fix Released |
Status changed to 'Confirmed' because the bug affects multiple users.