Skip to content

st: forward SSH and serve GDB on free host ports - #87

Merged
daniel-rossier merged 1 commit into
mainfrom
fix/st-ssh-port
Dec 2, 2026
Merged

daniel-rossier merged 1 commit into
mainfrom
fix/st-ssh-port

Conversation

@daniel-rossier

Copy link
Copy Markdown
Contributor

The slirp forward hostfwd=tcp::2222-:22 was a literal, so a second tree's QEMU exited with Could not set up host forwarding rule while another guest held 2222. The GDB port was offset by a count of running emulators, which collides once an earlier instance exits. Both ports are now the first free host port from 2222 / 1234 (probed on 127.0.0.1), IB_SSH_PORT / IB_GDB_PORT override them, and the SSH port is printed. Checked with a stub qemu-system-aarch64 that binds the ports it is given, in two trees: with tree A holding 2222/1234, tree B got 2223/1235 and bound them; IB_SSH_PORT=2400 was honoured. bash -n clean; shellcheck 0.11 (-S warning) reports the same 18 lines as before, none new.

The slirp SSH forward was hard-coded to host port 2222. With a guest
already running in another tree, QEMU could not set up the forwarding
rule and exited before the guest started, so two trees could not run
side by side although the image guard allows it. The GDB port was
offset by the count of running emulators, which collides as soon as an
earlier instance exits or an unrelated QEMU runs.

Both ports are now the first free one from 2222 and 1234, and
IB_SSH_PORT / IB_GDB_PORT choose them explicitly. The SSH port is
printed next to the GDB port.
@daniel-rossier
daniel-rossier merged commit e163a3c into main Dec 2, 2026
2 checks passed
@daniel-rossier
daniel-rossier deleted the fix/st-ssh-port branch December 2, 2026 07:55
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.

1 participant