Repository navigation
fix(webserver): don't let a failing global-cache chown kill the container - #8659
Merged
Merged
Conversation
|
Download the artifacts for this pull request:
See Testing a PR. |
…iner start.sh runs under `set -o errexit`, and its `chown -R ... /mnt/ddev-global-cache/ /var/lib/php` combined both paths into one command. Investigating ddev#7372 (Apple Container/socktainer, which bind-mounts the global cache over virtiofs there) turned up that chown on a virtiofs bind mount can fail with "Operation not permitted" even when ownership already matches - reproduced directly with the native `container` CLI, no DDEV or socktainer involved: $ container run --rm -v ~/tmp/x:/mnt/ddev-global-cache alpine \ sh -c 'chown -R 1000:1000 /mnt/ddev-global-cache' chown: /mnt/ddev-global-cache: Operation not permitted Under `set -e` that one failure took the whole container down before it ever reached supervisord. The chown is close to a no-op in the first place: app.Start() already runs a privileged utility container that chowns the global cache (and the db data dir) to the host uid/gid before any project container starts (chownCmd in ddevapp.go) - the production start script already skips its own copy of this chown for exactly that reason, per the comment left there ("chown of ddev-global-cache must be done with privileged container in app.Start()"). The base (dev) script kept a redundant in-container chown of its own, folded into the same command as the unrelated /var/lib/php chown (which is local storage, always safe, and worth keeping fatal). Split the two so /var/lib/php still fails the container if something is genuinely wrong there, while the global-cache chown degrades to a no-op warning on filesystems that reject it despite already having the right owner. Confirmed the mechanism with the same repro: `|| true` lets the script continue past the failing chown instead of `set -e` killing it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Any change under containers/ddev-webserver/ needs a matching WebTag bump in versionconstants.go so ddev actually pulls an image built from this branch instead of the one WebTag previously pointed at, matching the convention used by prior webserver-only fixes (e.g. ddev#8635). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
rfay
force-pushed
the
20260802_rfay_global_cache_chown_non_fatal
branch
from
August 4, 2026 14:37
7d8cfab to
8699fef
Compare
rfay
marked this pull request as ready for review
August 4, 2026 14:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Issue
start.shchowns/mnt/ddev-global-cache/and/var/lib/phpin onechown -Rcall underset -e. The global cache is already chowned by aprivileged utility container earlier in
app.Start(), so this is normallya no-op — but on some bind-mounted filesystems (observed with virtiofs on
Apple Container/socktainer)
chownfails even when ownership alreadymatches, which kills the whole container on start since the combined
command is one
set -eunit with the unrelated (and required)/var/lib/phpchown.
This is a real DDEV bug:
start.shtreats a redundant, best-effort chownas fatal alongside one that genuinely must succeed, on a filesystem type
that isn't unique to Apple Container.
How This PR Solves The Issue
Split the combined chown into two: the
/var/lib/phpchown stays fatal,and the global-cache chown (already redundant in the common case) is now
|| trueso a spurious failure on this filesystem no longer takes thecontainer down.
Manual Testing Instructions
containerCLI directly, confirming the chown failure and container death without
this fix.
ddev starton affected filesystems now succeeds; unaffected filesystems(normal Docker/OrbStack) are unchanged since the chown there just
succeeds as before.
Automated Testing Overview
No new automated test — this is a shell-script change in the webserver
image whose failure mode only reproduces on affected bind-mount
filesystems; covered by manual reproduction described above.
Release/Deployment Notes
Changes
containers/ddev-webserver/ddev-webserver-base-scripts/start.sh,so
WebTaginpkg/versionconstants/versionconstants.gois bumped to thisbranch name. The corresponding
ddev-webserverimage has been built andpushed under that tag.