docker-library / busybox

Docker Official Image packaging for Busybox
http://busybox.net
396 stars 127 forks source link

kernel 5.5 busybox rm: can't remove: Directory not empty #77

Closed margana closed 4 years ago

margana commented 4 years ago

trace.txt

While trying the kernel 5.5 release candidate for Fedora 31 I'm running into an issue with busybox rm where it seems unable to recursively remove directories with specific content, leaving one seemingly random file.

It doesn't happen with fedora's busybox, going back to kernel 5.4 or installing coreutils fixes the problem.

https://lists.alpinelinux.org/~alpine/users/%3Cb3d29f07-32de-f9ca-3234-4da2291cf86b%40foo%3E

$ docker run -ti busybox:musl 
Unable to find image 'busybox:musl' locally
musl: Pulling from library/busybox
a1dfa275066c: Pull complete 
Digest: sha256:7fe0cb3632d9ea7b2a9ab4427e339e01f7cdfeff50674804cb8946664976c610
Status: Downloaded newer image for busybox:musl
/ # wget https://github.com/michaelrsweet/htmldoc/releases/download/v1.9.7/htmldoc-1.9.7-source.tar.gz
Connecting to github.com (140.82.118.4:443)
wget: note: TLS certificate validation not implemented
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (52.216.143.44:443)
saving to 'htmldoc-1.9.7-source.tar.gz'
htmldoc-1.9.7-source 100% |****************************************************************************************************************| 4360k  0:00:00 ETA
'htmldoc-1.9.7-source.tar.gz' saved
/ # tar xf htmldoc-1.9.7-source.tar.gz 
/ # rm -rf htmldoc-1.9.7
rm: can't remove 'htmldoc-1.9.7/fonts': Directory not empty
rm: can't remove 'htmldoc-1.9.7/jpeg': Directory not empty
/ # rm -rf htmldoc-1.9.7
/ #
wglambert commented 4 years ago

I can reproduce it outside docker on ext4 as well as xfs.

I don't think there's anything we could change in the Dockerfile to remedy this issue as it's not specific to the container environment. It seems to be unique to the musl variant, which for other images that have an Alpine variant we include a section in the docs about potential anomalous behavior with musl https://github.com/docker-library/docs/blob/master/.template-helpers/variant-alpine.md

$ docker run -it --rm busybox
Unable to find image 'busybox:latest' locally                                                                                                                 
latest: Pulling from library/busybox                                                                                                                          
bdbbaa22dec6: Pull complete 
Digest: sha256:6915be4043561d64e0ab0f8f098dc2ac48e077fe23f488ac24b665166898115a                                                                               
Status: Downloaded newer image for busybox:latest

/ # wget https://github.com/michaelrsweet/htmldoc/releases/download/v1.9.7/htmldoc-1.9.7-source.tar.gz
Connecting to github.com (140.82.114.3:443)
wget: note: TLS certificate validation not implemented
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (52.216.110.75:443)
saving to 'htmldoc-1.9.7-source.tar.gz'
htmldoc-1.9.7-source 100% |**************************************************************************************************************| 4360k  0:00:00 ETA
'htmldoc-1.9.7-source.tar.gz' saved

/ # tar xf htmldoc-1.9.7-source.tar.gz

/ # rm -rf htmldoc-1.9.7
wglambert commented 4 years ago

Trying with the musl variant I'm unable to reproduce

$ docker run -it --rm busybox:musl
Unable to find image 'busybox:musl' locally
musl: Pulling from library/busybox
a1dfa275066c: Pull complete 
Digest: sha256:7fe0cb3632d9ea7b2a9ab4427e339e01f7cdfeff50674804cb8946664976c610
Status: Downloaded newer image for busybox:musl

/ # wget https://github.com/michaelrsweet/htmldoc/releases/download/v1.9.7/htmldo
c-1.9.7-source.tar.gz
Connecting to github.com (192.30.255.113:443)
wget: note: TLS certificate validation not implemented
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (52.217.47.164:443)
saving to 'htmldoc-1.9.7-source.tar.gz'
htmldoc-1.9.7-source 100% |*********************************| 4360k  0:00:00 ETA
'htmldoc-1.9.7-source.tar.gz' saved

/ # tar xf htmldoc-1.9.7-source.tar.gz

/ # rm -rf htmldoc-1.9.7

/ #

Going to close since this is either an upstream issue or with the host's environment

margana commented 4 years ago

Trying with the musl variant I'm unable to reproduce

Yes but are you running kernel 5.5 ?

tianon commented 4 years ago

The point he's getting at is that if it only fails on kernel 5.5, then it's likely an issue in kernel 5.5 (or much less likely, in your particular build of kernel 5.5) and/or your host environment/configuration, and not something we could fix in the image itself. Even if it somehow turns out to be a bug in Busybox or musl, it would have to be fixed upstream in one of those projects for us to pick up the change.

I would suggest trying your reproducer in a stock alpine:3.11 image (which includes busybox by default, so your reproducer should work as-is).

margana commented 4 years ago

Yes I get that this has to be fixed upstream somewhere, I will see if I can test a different 5.5 kernel and/or file a bug against busybox.

It is reproducable in stock alpine, I first noticed this because images based on alpine were failing to build.