From 41a894bffb69ee81c54874438fa40dff577d8eca Mon Sep 17 00:00:00 2001 From: henrytherobot Date: Wed, 30 Sep 2026 17:23:06 +0200 Subject: [PATCH] compose: mount /unitree/var/run instead of the socket file; warn when mscli fails master_service unlinks and recreates master_service.sock on every host boot or restart, and a bind mount of the file pins the old (dead) inode, so every mscli call inside the container failed with "Connect to server error". Mount the directory instead. The entrypoint wraps "mscli stopservice video_hub_pc4" in stop_videohub(), which prints a WARN when mscli cannot reach master_service (then /dev/video4 stays busy and the camera will not open), at start and in the 10 s loop. Co-Authored-By: Claude Opus 5.5 --- docker-compose.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c7da87b..ac4832a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,15 +37,27 @@ services: # mscli + master_service socket so the container can stop the # Unitree video_hub_pc4 service (it holds /dev/video4 — the D435i # V4L2 node — and would otherwise make Open() fail with EBUSY). + # Mount the *directory*, not the socket file: master_service unlinks + # and recreates the socket on every host boot/restart, and a bind + # mount of the file pins the old (now dead) inode, so every mscli + # call inside the container fails with "Connect to server error". - /unitree/sbin/mscli:/unitree/sbin/mscli:ro - - /unitree/var/run/master_service.sock:/unitree/var/run/master_service.sock + - /unitree/var/run:/unitree/var/run entrypoint: - bash - -c - | - /unitree/sbin/mscli stopservice video_hub_pc4 >/dev/null 2>&1 || true + stop_videohub() { + out=$$(/unitree/sbin/mscli stopservice video_hub_pc4 2>&1) || true + case "$$out" in + *"Connect to server error"*|*"connect error"*) + echo "[entrypoint] WARN mscli cannot reach master_service.sock:" \ + "/dev/video4 will stay busy and the camera will not open. $$out" >&2 ;; + esac + } + stop_videohub sleep 2 - ( while sleep 10; do /unitree/sbin/mscli stopservice video_hub_pc4 >/dev/null 2>&1 || true; done ) & + ( while sleep 10; do stop_videohub; done ) & exec /app/entrypoint.sh env_file: .env depends_on: