Stage-2 init starts the panel's device bus when the payload carries a broker. This is the first step of the rig half of flare-edge #1754 and #1050.
A panel runs one mosquitto on /run/warden/bus/bus.sock (flare-edge S10bus), and every daemon and the UI talk over it. The rig had no broker, so the Rust warden-modbus and the UI's bus client had nothing to dial. With this change, warden_rig_bus (qemu/rootfs/etc/warden-lib.sh) runs before the payload daemon loop:
It does nothing when /usr/bin/mosquitto is absent. Today's flare-edge payload has no broker, so this PR changes no boot.
It uses the panel's paths: the socket at sock/bus.sock with the bus.sock link, and a fresh 0400 credential file per bus user at cred/<user>. The users are the panel's users and bundled-users. A client reads its file at every CONNECT, as on the panel.
The broker settings are the panel's, minus the password file, ACL and retain plugin. The rig broker takes any user: the rig is a test instrument and everything in it runs as root. A static broker cannot load plugins anyway.
It waits for the socket (10 s bound) so the daemons find it on their first dial. If the broker exits or never listens, the console says so, then the boot goes on.
The flare-edge side comes in a later PR: the payload ships the static armhf broker from tools/mosquitto-build.sh armhf, and the submodule pin moves to this commit.
Tests
qemu/tests/init-rig-bus-test.sh (new CI step, run under sh and busybox sh) checks these cases:
no broker: nothing is created and the function stays silent
a listening stub broker: the layout, file modes, 64-hex secrets that differ per user, and a config with no password file, ACL or plugin
a broker that exits, or never listens: the failure is reported, within the bound
a user name holding a slash, or starting with a dot: no file is written
init order: the bus starts before the payload daemons
WARDEN_TEST_MOSQUITTO_DIR adds a real mosquitto 2.0.22 run: one message goes from modbus to ui, and both log in with their credential files.
$ lane-remote LF <worktree> -- WARDEN_TEST_MOSQUITTO_DIR=~/.cache/warden-mosquitto/host-2.0.22/bin bash qemu/tests/init-rig-bus-test.sh
22 x [PASS] ... PASS: rig bus (rc=0)
$ ... WARDEN_TEST_SH="busybox sh" (same, real broker included): PASS: rig bus (rc=0)
$ ... without the real broker: [SKIP] real broker, PASS: rig bus
init-daemon-order-test rc=0, init-power-signals-test rc=0, ctl-bridge-test rc=0
$ shellcheck -x qemu/tests/init-rig-bus-test.sh qemu/rootfs/etc/warden-lib.sh qemu/rootfs/sbin/init (0.10.0): rc=0
Stage-2 init starts the panel's device bus when the payload carries a broker. This is the first step of the rig half of flare-edge #1754 and #1050.
A panel runs one mosquitto on `/run/warden/bus/bus.sock` (flare-edge `S10bus`), and every daemon and the UI talk over it. The rig had no broker, so the Rust warden-modbus and the UI's bus client had nothing to dial. With this change, `warden_rig_bus` (qemu/rootfs/etc/warden-lib.sh) runs before the payload daemon loop:
- It does nothing when `/usr/bin/mosquitto` is absent. Today's flare-edge payload has no broker, so this PR changes no boot.
- It uses the panel's paths: the socket at `sock/bus.sock` with the `bus.sock` link, and a fresh 0400 credential file per bus user at `cred/<user>`. The users are the panel's `users` and `bundled-users`. A client reads its file at every CONNECT, as on the panel.
- The broker settings are the panel's, minus the password file, ACL and retain plugin. The rig broker takes any user: the rig is a test instrument and everything in it runs as root. A static broker cannot load plugins anyway.
- It waits for the socket (10 s bound) so the daemons find it on their first dial. If the broker exits or never listens, the console says so, then the boot goes on.
The flare-edge side comes in a later PR: the payload ships the static armhf broker from `tools/mosquitto-build.sh armhf`, and the submodule pin moves to this commit.
## Tests
`qemu/tests/init-rig-bus-test.sh` (new CI step, run under sh and busybox sh) checks these cases:
- no broker: nothing is created and the function stays silent
- a listening stub broker: the layout, file modes, 64-hex secrets that differ per user, and a config with no password file, ACL or plugin
- a broker that exits, or never listens: the failure is reported, within the bound
- a user name holding a slash, or starting with a dot: no file is written
- init order: the bus starts before the payload daemons
`WARDEN_TEST_MOSQUITTO_DIR` adds a real mosquitto 2.0.22 run: one message goes from `modbus` to `ui`, and both log in with their credential files.
```
$ lane-remote LF <worktree> -- WARDEN_TEST_MOSQUITTO_DIR=~/.cache/warden-mosquitto/host-2.0.22/bin bash qemu/tests/init-rig-bus-test.sh
22 x [PASS] ... PASS: rig bus (rc=0)
$ ... WARDEN_TEST_SH="busybox sh" (same, real broker included): PASS: rig bus (rc=0)
$ ... without the real broker: [SKIP] real broker, PASS: rig bus
init-daemon-order-test rc=0, init-power-signals-test rc=0, ctl-bridge-test rc=0
$ shellcheck -x qemu/tests/init-rig-bus-test.sh qemu/rootfs/etc/warden-lib.sh qemu/rootfs/sbin/init (0.10.0): rc=0
```
Refs flare-edge #1754, #1050.
Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG
A panel runs one mosquitto on /run/warden/bus/bus.sock (flare-edge S10bus)
and every daemon and the UI talk over it; the rig had no broker, so the
Rust warden-modbus and the UI's bus client could not run there (flare-edge
#1754, the #1050 QEMU half). Stage-2 init now starts the broker before the
payload daemons when the payload carries a static mosquitto, with the
panel's paths: the socket under sock/ with the bus.sock link, and a fresh
0400 credential file per bus user under cred/. The rig broker takes any
user and loads no plugin (the rig is a test instrument; a static broker
loads none). A payload without a broker boots as before.
qemu/tests/init-rig-bus-test.sh covers no broker, a listening broker (layout,
modes, config), a broker that exits or never listens, bad user names and the
init order, under sh and busybox sh; with WARDEN_TEST_MOSQUITTO_DIR a real
mosquitto carries a message between two users logged in by credential file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG
noah
merged commit eeb779b41b into rebuild2026-10-26 16:00:21 -06:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Stage-2 init starts the panel's device bus when the payload carries a broker. This is the first step of the rig half of flare-edge #1754 and #1050.
A panel runs one mosquitto on
/run/warden/bus/bus.sock(flare-edgeS10bus), and every daemon and the UI talk over it. The rig had no broker, so the Rust warden-modbus and the UI's bus client had nothing to dial. With this change,warden_rig_bus(qemu/rootfs/etc/warden-lib.sh) runs before the payload daemon loop:/usr/bin/mosquittois absent. Today's flare-edge payload has no broker, so this PR changes no boot.sock/bus.sockwith thebus.socklink, and a fresh 0400 credential file per bus user atcred/<user>. The users are the panel'susersandbundled-users. A client reads its file at every CONNECT, as on the panel.The flare-edge side comes in a later PR: the payload ships the static armhf broker from
tools/mosquitto-build.sh armhf, and the submodule pin moves to this commit.Tests
qemu/tests/init-rig-bus-test.sh(new CI step, run under sh and busybox sh) checks these cases:WARDEN_TEST_MOSQUITTO_DIRadds a real mosquitto 2.0.22 run: one message goes frommodbustoui, and both log in with their credential files.Refs flare-edge #1754, #1050.
Generated with Claude Code
https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG