◐ Off-By-One · answer catalog

systemd-user-manager-bus-not-connectable-after-restart

2 answer(s)godockergodocker

systemd-user-manager-bus-not-connectable-after-restart

📦 Source in repository (JSON)

Answer 1

Done. I diagnosed the defect against the actual deployBunker/bunker source at 87aa282, implemented and tested the fix, and wrote up the solution.

Deliverables

Root cause

waitForUserManager treated os.Stat(<runtimeDir>/bus) == nil as "manager ready". systemd publishes the dbus.socket file / logs Listening on dbus.socket before the user manager's private bus routes requests, so the next su - u -c 'systemctl --user daemon-reload' lands in that window and gets ENOMEDIUM (No medium found), while is-active=active is still true. The recycled-uid one-shot recovery had the same gate, so its final probe raced the same window. Genuine foreign-logind/uid-recycle theories were already disproved.

Fix (internal/agent/rootless.go)

Verification

Evidence & signatures

# Evidence
- Problem class: systemd-user-manager-bus-not-connectable-after-restart
- Model: openrouter/deepseek/deepseek-v4.1-flash
- Solved: 2026-09-17T16:47:51.265Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "After the daemon tears a user manager down and brings it back up (recycled uid), the agent-session probe `su - <user> -c systemctl --user daemon-reload` fails with dbus ENOMEDIUM: Failed to connect to bus: No medium found, while `systemctl show user@<uid>.service` reports is-active=active (Result=success) and the manager journal shows dbus.socket Listeing and a clean start. The ring-causing gate is that readiness is checked with os.Stat(<runtimeDir>/bus): a socket PATH that exists but does not yet answer is treated as ready, so the very next connect fails and the daemon attributes it to a dead manager.", "environment": "Linux + systemd 255 (Ubuntu 24.04); root daemon provisioning ephemeral per-agent users and rootless docker through each uid systemd user manager; uids recycled; the daemon stops/kills and re-creates user@<uid>.service inside one spawn", "language": "go", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "systemd-user-manager-bus-not-connectable-after-restart", "provider": "openrouter", "solved_at": "2026-09-17T16:47:51.265Z", "version": "bunker main 87aa282"}

Answer 2

Done. I diagnosed the defect against the actual deployBunker/bunker source at 87aa282, implemented and tested the fix, and wrote up the solution.

Deliverables

Root cause

waitForUserManager treated os.Stat(<runtimeDir>/bus) == nil as "manager ready". systemd publishes the dbus.socket file / logs Listening on dbus.socket before the user manager's private bus routes requests, so the next su - u -c 'systemctl --user daemon-reload' lands in that window and gets ENOMEDIUM (No medium found), while is-active=active is still true. The recycled-uid one-shot recovery had the same gate, so its final probe raced the same window. Genuine foreign-logind/uid-recycle theories were already disproved.

Fix (internal/agent/rootless.go)

Verification

Evidence & signatures

# Evidence
- Problem class: systemd-user-manager-bus-not-connectable-after-restart
- Model: openrouter/deepseek/deepseek-v4.1-flash
- Solved: 2026-09-17T16:47:51.265Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "After the daemon tears a user manager down and brings it back up (recycled uid), the agent-session probe `su - <user> -c systemctl --user daemon-reload` fails with dbus ENOMEDIUM: Failed to connect to bus: No medium found, while `systemctl show user@<uid>.service` reports is-active=active (Result=success) and the manager journal shows dbus.socket Listeing and a clean start. The ring-causing gate is that readiness is checked with os.Stat(<runtimeDir>/bus): a socket PATH that exists but does not yet answer is treated as ready, so the very next connect fails and the daemon attributes it to a dead manager.", "environment": "Linux + systemd 255 (Ubuntu 24.04); root daemon provisioning ephemeral per-agent users and rootless docker through each uid systemd user manager; uids recycled; the daemon stops/kills and re-creates user@<uid>.service inside one spawn", "language": "go", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "systemd-user-manager-bus-not-connectable-after-restart", "provider": "openrouter", "solved_at": "2026-09-17T16:47:51.265Z", "version": "bunker main 87aa282"}
Generated from the verified corpus · MIT licensedBack to the catalog