fix(viewer): restart to recover /dev/fb0 hotplugged after a headless boot#3134
Closed
vpetersson wants to merge 1 commit into
Closed
fix(viewer): restart to recover /dev/fb0 hotplugged after a headless boot#3134vpetersson wants to merge 1 commit into
vpetersson wants to merge 1 commit into
Conversation
- exit wait_for_framebuffer when the host has fb0 but the container's stale /dev doesn't, so `restart: always` re-snapshots /dev - keep waiting quietly when genuinely headless (no sysfs fb0) to avoid the #2959 crash-loop - fixes the "self-heals on hotplug" case that a running container's devtmpfs snapshot silently broke Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Contributor
Author
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.



Problem
On linuxfb boards (32-bit Pi 1/2/3, Qt5),
wait_for_framebufferinbin/start_viewer.shwaits for/dev/fb0before launching the viewer — this is the #2959 guard that stops the headless crash-loop.But the (privileged) viewer container's
/devis a devtmpfs snapshot taken at container start. If the container boots headless and a display is plugged in later, the host gains/dev/fb0but it never appears inside the container's stale/dev— so the wait loop blocks forever and the viewer never starts. The comment claimed the wait "self-heals on hotplug"; in a running container it silently does not.Reproduced live on the Pi 2 testbed: plugging a monitor into a headless-booted board left the host with
/dev/fb0while the container saw only/sys/class/graphics/fb0, and the viewer stayed parked (still no /dev/fb0 after 6540s; waiting for a display) until a manualdocker restart.Fix
sysfs is bind-through from the host and stays truthful across the stale snapshot. When
/sys/class/graphics/fb0exists but the container's/dev/fb0does not, exit non-zero so therestart: alwayspolicy recreates the container with a fresh/devthat includesfb0— the same exit-to-restart recovery the OOM and viewer-death paths already rely on. Genuinely headless devices (no sysfsfb0either) keep waiting quietly, so the #2959 behavior is preserved.Note
/dev/fb0and/sys/class/graphics/fb0are the same fbdev object (created/removed together byregister_framebuffer/unregister_framebuffer), so a real headless box has neither.Validation (live on the Pi 2,
DEVICE_TYPE=pi2, linuxfb/Qt5)Exercised the real
wait_for_framebufferagainst each state:/dev/fb0present/dev/fb0removed,/sys/.../fb0presentexit 1bash -nclean.