Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nuke-graph-directory.sh error on btrfs subvolume delete #42271

Closed
brettmilford opened this issue Apr 8, 2021 · 0 comments · Fixed by #42272
Closed

nuke-graph-directory.sh error on btrfs subvolume delete #42271

brettmilford opened this issue Apr 8, 2021 · 0 comments · Fixed by #42272

Comments

@brettmilford
Copy link

Description
nuke-graph-directory.sh errors out at L66 of:

if command -v btrfs > /dev/null 2>&1; then
# Find btrfs subvolumes under $dir checking for inode 256
# Source: http://stackoverflow.com/a/32865333
for subvol in $(find "$dir" -type d -inum 256 | sort -r); do
if [ "$dir" != "$subvol" ]; then
(
set -x
btrfs subvolume delete "$subvol"
)
fi
done
fi

On non-btrfs systems. As this is called by post rm hooks in apt packaging the package fails to uninstall.

Specifically on my system which is using zfs; btrfs tools are installed by default, thus:

if command -v btrfs > /dev/null 2>&1; then

works, and

find "$dir" -type d -inum 256

returns a number of directories which are not btrfs volumes on my system.

Steps to reproduce the issue:
On ubuntu 20.10

  1. sudo apt-get install docker.io
  2. sudo apt-get purge docker.io

Describe the results you received:

Purging configuration files for docker.io (19.03.13-0ubuntu3) ...

Nuking /var/lib/docker ...
  (if this is wrong, press Ctrl+C NOW!)

+ sleep 10
ok
+ btrfs subvolume delete /var/lib/docker/containers/242b750a0952a99008adc6cd37f749423eeacc6c92dce2e3a509350977a41a8c
ERROR: Not a Btrfs filesystem: Invalid argument
dpkg: error processing package docker.io (--purge):
 installed docker.io package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:
 docker.io
E: Sub-process /usr/bin/dpkg returned an error code (1)

Describe the results you expected:
Command succeeds.

brettmilford added a commit to brettmilford/moby that referenced this issue Apr 8, 2021
Inode numbers are guaranteed to be unique only within a filesystem.
As such there is an edge case where these predicates are true on a
non-btrfs filesystem.

Closes moby#42271

Signed-off-by: Brett Milford <brettmilford@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants