-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix gravity.sh -- Alpine / Docker specific issue #1767
Comments
PR reference: pi-hole/pi-hole#6030 |
Interestingly, I tried running this interactivity in the container using only
|
I can confirm the PR fixes #1747 . Thanks! I was totally stumped |
I'm still struggling with this issue. What type of file system are you using to host your docker system and/or your volumes? |
Nope. Just ext4 off the SD card |
I would say it's very armv7 image specific; @yubiuser have you tried it on such a platform? either [ -w path/to/file ] condition does not work in bash there the way it works everywhere else, In theory this should not matter since we're talking about Docker, but I'll leave it here just in case -- I'm running it on an old Rpi2 (w/ raspbian on board) CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7) seems to match #1747 |
I don't know if this is ARMv7 specific, I have no device to test. |
Putting my comment from the other issue here for visibility
|
i have done some more digging on this issue and it seems to be related to in this GitHub issue clearlinux/distribution#2361 (comment) they point to this on Stack Exchange
which ultimately it seems most people are pointing to these release notes The fix appears to be one of the following
in other issues it is mentioned to pin the base image to 3.13 which is likely the least acceptable answer i found |
so the answer for this seems to be provided by checking the host OS by running(or potentially in the container as well)
If 439 is returned, faccessat2 is supported. If -1 is returned, faccessat2 is not supported. |
The stackexchange suggests this could be mitigates by not using
|
I'm not sure if this is the correct way to test it, but I was able to reproduce the Alpine Bash problem as follows: Step-by-step to reproduce:
wget https://download.docker.com/linux/ubuntu/dists/focal/pool/stable/amd64/containerd.io_1.4.3-1_amd64.deb && \
wget https://download.docker.com/linux/ubuntu/dists/focal/pool/stable/amd64/docker-ce_19.03.15~3-0~ubuntu-focal_amd64.deb && \
apt install ./containerd.io_1.4.3-1_amd64.deb ./docker-ce_19.03.15~3-0~ubuntu-focal_amd64.deb -y --allow-downgrades && \
rm ./containerd.io_1.4.3-1_amd64.deb ./docker-ce_19.03.15~3-0~ubuntu-focal_amd64.deb
At least for me it only occurs with a certain older containerd.io version (and older). |
@yubiuser my test procedure:# on host
containerd --version
docker exec -it pihole bash # on container
bash -c 'echo Shell: $(readlink /proc/$$/exe) && \
echo Output: $(if [ ! -w /etc/pihole/listsCache ]; then echo "not writeable"; fi) && \
echo Permissions: $(ls -ldha /etc/pihole/listsCache)'
sh -c 'echo Shell: $(readlink /proc/$$/exe) && \
echo Output: $(if [ ! -w /etc/pihole/listsCache ]; then echo "not writeable"; fi) && \
echo Permissions: $(ls -ldha /etc/pihole/listsCache)' results:
|
Thanks for testing. |
Just for my understanding here... Are we saying that this issue is only occuring on machines running Docker 20.10.0? |
This comment has been minimized.
This comment has been minimized.
Worth noting, OP of this issue thread never gave what version of containerd.io or Docker they are using. Seems to be an important question is this scenario. |
@PromoFaux I'm assuming that using a recent operating system, and therefore automatically the latest docker-ce and containerd.io versions. Accordingly, I haven't noticed the problem so far. If that still using an older operating system (hence the example with Ubuntu 20.04) and that may have docker.io (not docker.ce via apt) or even an old containerd.io version (from docker.ce) installed, then the problem occurs. In the instructions for reproducing the problem, I also specified an old docker-CE version (pre-20.x) when downloading the deb package (wget command), because docker-CE expects containerd.io as a dependency, and therefore it's probably a combination of the installed docker-CE components. (Predominantly an old container.d version independent of Docker-CE, but at least an old version of Docker-CE that accepts this old containerd.io version as a dependency.) edit: The Docker-CE components and versions used in my example:
these specified versions are affected, as are older versions. ( |
@yubiuser I've now figured out how to reproduce the issue without having to set up a VM. Anything with the latest version of Docker is sufficient. This is a supplement to my comment #1767 (comment) where I explained how to reproduce this I found and adapted a Dockerfile for this. FROM docker:20.10.0 AS old
FROM docker:28.0.2
COPY --from=old /usr/local/bin/containerd* /usr/local/bin/
COPY --from=old /usr/local/bin/ctr /usr/local/bin/
COPY --from=old /usr/local/bin/runc /usr/local/bin/
COPY --from=old /usr/local/bin/docker /usr/local/bin/
RUN apk add --no-cache iptables bash
WORKDIR /workspace
ENTRYPOINT [ "dockerd" ] The following commands are used to build, start, and attach the container. docker build . -t docker-dind:latest docker run -d -it --privileged --name alpine-bash-test docker-dind:latest docker exec -it alpine-bash-test bash In the "docker-dind" container, the pihole can then be started and attached using the familiar docker commands, allowing tests to be performed in the pihole. This is a way to run an old Docker affected by the Alpine Bash issue in a current Docker and then test Pihole, including the |
So the fix is for EOL versions of docker? |
The fix from PR #1786 is intended to resolve this issue with Alpine Bash. This fix is effective for all users. Only the affected users (who probably use an old version of docker) will notice that this issue has been resolved, as the Edit: This fix has no impact on unaffected users. |
So what we're saying here is that #1786 sticks a bandaid on an issue within the image for users that are on outdated versions of Docker for whatever reason? The real fix here is to update systems to latest docker/containerd, right? I'm uncomfortable making a change that only affects a handful of users who could otherwise "just" update their outdated systems... ETA: That's not to say I don't appreciate the work you've put into looking at this! |
@mwoolweaver - I noted that you mentioned libseccomp in one of your comments above... has anyone confirmed that updating that also fixes this issue? Maybe we just need to add this back to the Readme file (Can't remember why it was removed, might not have been on purpose!)
|
yes.
yes. With the gitee image, they solved the problem in a different way by adding a check to the image to see if an outdated containerd.io version is being used and notifying the user to update Docker. |
I was just quoting the alpine release notes It seems like pi-hole/pi-hole#6030 was merged and shouldn't have been? |
This is an elegant solution as well. |
@karolkania an @mattforscale note that if you are on older operating systems/versions of docker-ce, you should upgrade these. mattforscale, I notice from #1747 that you are on Raspbian 10 - which has been EOL for quite some time now - the latest version is 12 at time of writing. karolkania - you haven't mention which version of OS/docker you are running (unless I've missed it) but it could be that you're facing the same issue. |
Versions
Platform
Expected behavior
Update Gravity (list of blocked domains) should update the database
Actual behavior / bug
Update Gravity (list of blocked domains) does not happen
Steps to reproduce
Steps to reproduce the behavior:
Add a proper list and go to /admin/gravity; click update.
Output:
Not digging too deep, I was able to figure out that this is most likely related to differences between how the shell script is interpreted by Bash - on Alpine (Ash, not Bash) this seems to trigger unexpected results.
I've raised a quick PR -- pi-hole/pi-hole@a9650ae
and this is the script output after the fix is applied:
This is a very Alpine specific fix, most likely won't work as expected on other distros / platforms. That said I was just trying to solve it quickly for my use-case, haven't been working on it to make the fix everything-agnostic.
Debug Token
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: