From 81a27f3e9be5363f8a428de8fe240150ad2bb0d1 Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Thu, 2 Jul 2026 09:29:10 +0200 Subject: [PATCH] fix: clear stale Xvfb display locks on startup - Remove stale X lock and socket files before starting Xvfb. - Prevent false active-display errors after container restarts. - Keep Obsidian able to create the CLI socket for API commands. --- scripts/entrypoint.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index 51d9638..4429fa2 100644 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -15,6 +15,12 @@ fi DEFAULT_VAULT_PATH="$(python /app/scripts/render_config.py | tail -n 1)" # Start a virtual X server for the official Obsidian desktop app. +# Some container/image restarts can leave stale X lock/socket files behind. In +# this dedicated container nothing else should own DISPLAY, so clear them before +# starting Xvfb to avoid "Server is already active for display" false positives. +DISPLAY_NUMBER="${DISPLAY#:}" +rm -f "/tmp/.X${DISPLAY_NUMBER}-lock" "/tmp/.X11-unix/X${DISPLAY_NUMBER}" + Xvfb "$DISPLAY" -screen 0 "${XVFB_SCREEN:-1280x1024x24}" -nolisten tcp >/tmp/xvfb.log 2>&1 & XVFB_PID=$!