Skip to content

Fix #136: default to TigerVNC to fix noVNC connect-time crash + surface silent display-stack failures#137

Open
noiwid wants to merge 2 commits into
mainfrom
fix/136-vnc-crash
Open

Fix #136: default to TigerVNC to fix noVNC connect-time crash + surface silent display-stack failures#137
noiwid wants to merge 2 commits into
mainfrom
fix/136-vnc-crash

Conversation

@noiwid

@noiwid noiwid commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Fixes #136.

The auth container's noVNC hung on "Connecting…" forever, 100% of the time. @wookash did an exceptional job diagnosing it with strace: x11vnc 0.9.16 (2019) tears down its own X connection the instant a VNC client connects, and because the whole display stack was launched with output to /dev/null and no real liveness check, the failure was completely silent — the container stayed "healthy" on uvicorn/8099 while VNC was dead.

This PR ships in two layers.

1. Make silent failures visible + fix the restart bug (low-risk)

  • Logging & liveness. The standalone container now logs each display process to /var/log/familylink/<proc>.log instead of /dev/null, and re-checks it after launch, dumping the last log lines on failure. The add-on entrypoint (already on journald) gains the same Xvfb/fluxbox/x11vnc checks.
  • Stale X99 cleanup. A non-graceful stop (docker restart) left /tmp/.X11-unix/X99 + /tmp/.X99-lock behind, which made Xvfb :99 silently refuse to bind next start and took the display stack down — only uvicorn came back, so the container reported healthy. Both are now removed before Xvfb/Xvnc starts. This is the secondary bug @wookash also reported.
  • VNC password. -passwd uses DES and silently keeps only the first 8 chars, so the 10-char default (familylink) never matched cleanly. It's now truncated explicitly with a warning, and the web UI's auto-connect URL embeds the same 8-char value so client and server agree.

2. Replace x11vnc with TigerVNC as the default backend (the real fix)

Rather than chase an x11vnc build compatible with bookworm's X libs, the container now prefers TigerVNC's Xvnc — an X server that speaks RFB/VNC natively, so there's no separate Xvfb and no x11vnc screen-scraper. The exact component that crashed is gone.

  • start_tigervnc() builds a VNC-auth password file with vncpasswd -f (filter mode — deterministic, no interactive prompts) or -SecurityTypes None, then starts Xvnc on :99 / port 5900, localhost-only.
  • start_xvfb_x11vnc() is kept as an automatic fallback, so no environment loses VNC if Xvnc is missing or fails.
  • Dispatch is auto (TigerVNC → fallback) by default; FAMILYLINK_VNC_BACKEND=tigervnc|x11vnc forces a backend.
  • tigervnc-standalone-server added to both Dockerfiles (x11vnc kept for the fallback). Add-on config.json1.8.0, Dockerfile version labels synced.

Testing status ⚠️

There is no Docker in my dev environment, so I could not build/run the container end-to-end. What I did verify:

  • bash -n on both entrypoints, plus a stubbed-binary smoke test of the full control flow (backend selection, password truncation to 8, vncpasswd -f path, Xvnc/x11vnc argument construction, and the fallback path) — all branches produce well-formed commands.
  • All Xvnc flags (-localhost, -rfbport, -SecurityTypes None|VncAuth, -rfbauth, -desktop, -geometry, -depth) confirmed against the TigerVNC man pages.

The connect-time crash itself only reproduces on the reporter's real environment (NAS, x86_64 Debian), which is why this is proposed for a pre-release so @wookash can validate on the machine where the bug actually occurs before it goes to latest.

🤖 Generated with Claude Code

Benoit Collin and others added 2 commits July 24, 2026 11:56
The auth container's display stack (Xvfb + fluxbox + x11vnc + websockify) was
started with all output sent to /dev/null and no real liveness check, so any
failure was invisible: the container stayed "healthy" on uvicorn/8099 while
noVNC hung on "Connecting..." forever. Two concrete failure modes are addressed:

- Logging & liveness (standalone): each display process now logs to
  /var/log/familylink/<proc>.log instead of /dev/null, and its status is
  re-checked after launch with the last log lines dumped on failure, so a crash
  is diagnosable from `docker logs` / the log file. The add-on entrypoint
  already logs to journald; it gains the same Xvfb/fluxbox liveness checks.

- Stale X99 cleanup (both entrypoints): a non-graceful stop (e.g.
  `docker restart`) leaves /tmp/.X11-unix/X99 and /tmp/.X99-lock behind, which
  makes `Xvfb :99` silently refuse to bind on the next start and takes the whole
  display stack down invisibly. Both are now removed before Xvfb starts.

- VNC password (both entrypoints): x11vnc's -passwd uses DES and silently keeps
  only the first 8 chars, so the 10-char default ("familylink") never matched.
  The password is now truncated explicitly with a warning; the server stays
  localhost-only behind websockify.

This does not yet fix the primary x11vnc-crashes-on-client-connect issue
(likely a 0.9.16-vs-bookworm incompatibility) tracked separately; it makes that
crash visible instead of silent and fixes the restart-kills-VNC secondary bug.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K9tyVdR6C29z9KYADvJXYq
The auth container's noVNC hung on "Connecting..." forever because x11vnc
0.9.16 (2019) tears down its own X connection the instant a VNC client
connects (confirmed via strace by @wookash) — most likely an incompatibility
with the bookworm X11 libraries.

Rather than chase a compatible x11vnc, the container now prefers TigerVNC's
Xvnc: an X server that speaks RFB/VNC natively, so there is no separate Xvfb
and no x11vnc screen-scraper — the exact component that crashed is gone. Both
entrypoints (standalone run-standalone.sh and the add-on rootfs run.sh) share
the same structure:

- start_tigervnc(): builds a VNC-auth password file with `vncpasswd -f`
  (filter mode, deterministic, no interactive prompts) or falls back to
  -SecurityTypes None, then starts Xvnc on :99/:5900 localhost-only.
- start_xvfb_x11vnc(): the legacy stack, kept as an automatic fallback so no
  environment loses VNC if Xvnc is missing or fails. It clears stale :99 state
  first (a failed Xvnc attempt can leave the socket behind).
- Dispatch: auto (TigerVNC then fallback) by default;
  FAMILYLINK_VNC_BACKEND=tigervnc|x11vnc forces a backend.

tigervnc-standalone-server is added to both Dockerfiles (x11vnc kept for the
fallback). The web UI's auto-connect URL now embeds the same 8-char-truncated
password the server uses, so client and server agree. Add-on config.json
bumped to 1.8.0 and the Dockerfile version labels synced to match.

The backend-selection control flow, password truncation, and Xvnc/x11vnc
argument construction were verified with stubbed binaries; the real container
still needs validation on the reporter's NAS (no local Docker here), which is
why this ships as a pre-release.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K9tyVdR6C29z9KYADvJXYq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

x11vnc crashes (exit_group) the instant a VNC client connects — noVNC always shows "connecting..." forever

1 participant