Skip to content

fix(dstackup): fix systemd units, mkosi image discovery, and auto host ports - #1707

Open
PierreLeGuen wants to merge 4 commits into
Dstack-TEE:nextfrom
nearai:fix/dstackup-install-fixes
Open

PierreLeGuen wants to merge 4 commits into
Dstack-TEE:nextfrom
nearai:fix/dstackup-install-fixes

Conversation

@PierreLeGuen

Copy link
Copy Markdown
Contributor

Summary

Four bugfixes for single-node dstackup install, dstackup image pull, and dstack deploy:

Changes

  • fix(dstackup): write WorkingDirectory as a bare path in unit files (dstack/crates/dstackup/src/systemd.rs): systemd 259 rejects quoted WorkingDirectory= as non-absolute; write the bare path escaping only %.
  • fix(dstackup): load vhost_vsock before starting the VMM (dstack/crates/dstackup/src/systemd.rs): add ExecStartPre=/sbin/modprobe vhost_vsock so CID 2 host-API bind works on fresh hosts.
  • fix(dstackup): find mkosi-os-v guest-OS releases (dstack/crates/dstackup/src/image.rs): look up mkosi-os-v* release tags first (keeping guest-os-v* fallback) and exclude *-kernel-devel.tar.gz from host image candidates.
  • fix(dstack-cli): pick auto host ports inside the VMM port-mapping range (dstack/crates/dstack-cli-core/src/{ports.rs,config.rs}): pick free loopback ports from 10000..=19999 instead of kernel ephemeral ports rejected by vmm.toml's 1-20000 range.

Verification

  • cargo test --locked -p dstack-cli-core -p dstackup: 20 + 34 passed.
  • cargo clippy --locked -p dstack-cli-core -p dstackup -- -D warnings --allow unused_variables and cargo fmt --all -- --check: pass.

Split out from #1703.

systemd does not unquote `WorkingDirectory=`, so the quoted value dstackup
wrote is read as a relative path. systemd 259 rejects it ("path is not
absolute"), and `dstackup install` then fails to start dstack-auth. Write
the path bare, escaping only `%`.

Signed-off-by: Pierre LE GUEN <26087574+PierreLeGuen@users.noreply.github.com>
The VMM host API binds vsock CID 2, which needs the vhost_vsock transport.
/dev/vhost-vsock is a static device node that loads the module only on
first open, so on a fresh host the bind fails with EADDRNOTAVAIL and the
VMM exits ("Failed to bind host API"). Load the module in ExecStartPre.

Signed-off-by: Pierre LE GUEN <26087574+PierreLeGuen@users.noreply.github.com>
Guest-OS releases are tagged `mkosi-os-v<version>` by the mkosi release
workflow, but `dstackup image pull` only looked for `guest-os-v`, so both a
pinned `--version` and the latest-release lookup found nothing for 0.6.x.
Look up `mkosi-os-v` first and keep `guest-os-v` as a fallback.

These releases also publish `dstack-<version>-kernel-devel.tar.gz`, which
the asset picker accepted as a host image; skip it like the `-uki` archive.

Signed-off-by: Pierre LE GUEN <26087574+PierreLeGuen@users.noreply.github.com>
`free_local_port()` bound port 0, which returns a kernel ephemeral port
(32768 and up). The vmm.toml that `dstackup install` writes only allows tcp
1-20000, so the VMM refused every auto-picked port: the KMS CVM deploy in
`dstackup install` failed with "Port mapping is not allowed", and so did
`dstack deploy --port <vm>` without a host port.

Pick a free loopback port from 10000-19999 instead, and test that the
rendered port-mapping range covers it.

Signed-off-by: Pierre LE GUEN <26087574+PierreLeGuen@users.noreply.github.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-02T13:27:46.237707Z 5ba2610 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
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