Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(docker): clear stale Chromium locks before fixing data ownership

Yudhi Armyndharis03177d39e089
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9c1f47289..c8a04eb39 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- A plugin `configUi` editor receives the dashboard language as `locale` in `config:value`, and the `schema` it gets carries field titles and descriptions localized from the manifest `i18n` block, as the generated form already showed. Thanks @probably-ABHINAV, and @TreIngenia for the proposal.
+- The container no longer crash-loops at start when `/app/data` is a bind mount that refuses to change a symlink's owner, such as Docker Desktop file sharing, and a whatsapp-web.js profile still holds the Chromium lock files of an unclean stop: the entrypoint removes those locks before it fixes ownership. Thanks @Nexiler for the report.
## [0.23.7] - 2026-09-25
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index 78db86059..10c0b3a63 100644
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -4,14 +4,18 @@
set -e
mkdir -p /app/data/sessions /app/data/media /app/data/plugins
-chown -R openwa:openwa /app/data
# Chromium leaves SingletonLock/SingletonSocket/SingletonCookie in each session profile and does
# not remove them on an unclean shutdown; stale locks block the next launch ("profile appears to be
# in use by another Chromium process", exit Code 21). No Chromium is running yet at entrypoint time,
# so clearing them lets sessions re-launch after a crash/restart. (#259)
+# This runs BEFORE the chown: the three are symlinks, and a bind mount on Docker Desktop's file
+# sharing refuses to change a symlink's owner. Under `set -e` that failed chown would stop the
+# script before this cleanup and crash-loop the container on every restart (#1722).
rm -f /app/data/sessions/*/Singleton* 2>/dev/null || true
+chown -R openwa:openwa /app/data
+
# Chromium resolves its home from the passwd entry (no /home/openwa exists), so it hard-crashes at
# launch unless its config/cache dirs exist and are writable. XDG_CONFIG_HOME/XDG_CACHE_HOME (set in
# the image) point here; create them owned by openwa. On a read_only rootfs these live on tmpfs /tmp,
diff --git a/src/common/ci-privilege-gate.spec.ts b/src/common/ci-privilege-gate.spec.ts
index e1eccff2c..9a2d44c40 100644
--- a/src/common/ci-privilege-gate.spec.ts
+++ b/src/common/ci-privilege-gate.spec.ts
@@ -80,6 +80,18 @@ describe('the non-root drop is enforced, not merely documented', () => {
const entrypoint = fs.readFileSync(path.join(__dirname, '..', '..', 'docker-entrypoint.sh'), 'utf8');
expect(entrypoint).toMatch(/exec\s+gosu\s+openwa/);
});
+
+ // The stale Chromium Singleton* entries are symlinks. A bind mount that refuses to chown a symlink
+ // (Docker Desktop file sharing) fails the recursive chown under `set -e`, so the cleanup has to run
+ // first or it never runs and the container crash-loops (#1722).
+ it('clears stale Chromium locks before the recursive chown', () => {
+ const entrypoint = fs.readFileSync(path.join(__dirname, '..', '..', 'docker-entrypoint.sh'), 'utf8');
+ const cleanup = entrypoint.search(/^rm -f \/app\/data\/sessions\/\*\/Singleton\*/m);
+ const chown = entrypoint.search(/^chown -R openwa:openwa \/app\/data/m);
+ expect(cleanup).toBeGreaterThan(-1);
+ expect(chown).toBeGreaterThan(-1);
+ expect(cleanup).toBeLessThan(chown);
+ });
});
/**