From d245fa6235b64e9bbb7d6f90e8db9a6545432bfa Mon Sep 17 00:00:00 2001 From: josh Date: Sat, 18 Apr 2026 01:13:14 -0400 Subject: [PATCH] quick.sh: stage+install agent to avoid ETXTBSY, restart service Re-running quick.sh on a host where vetting-reporter was already running failed with curl error 23 because curl can't overwrite a busy executable. Download to a staging path, then use `install(1)` which unlinks the target before writing. Swap `enable --now` for `enable` + `restart` so the service picks up the new binary. Co-Authored-By: Claude Opus 4.7 --- internal/web/register/quick.sh.tmpl | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/internal/web/register/quick.sh.tmpl b/internal/web/register/quick.sh.tmpl index 6385323..886ed64 100644 --- a/internal/web/register/quick.sh.tmpl +++ b/internal/web/register/quick.sh.tmpl @@ -193,13 +193,19 @@ install_agent() { fi echo "Installing vetting-reporter service..." install -d /etc/vetting /usr/local/bin - if ! curl -fsSL "${ORCH_URL}/assets/vetting-agent-linux-amd64" \ - -o /usr/local/bin/vetting-agent; then + # Download to a staging path, then use `install` — it unlinks the + # target before writing, so re-running quick.sh on a host where + # vetting-reporter is already running doesn't hit ETXTBSY + # (curl error 23: write error on a busy executable). + local staged="/usr/local/bin/.vetting-agent.new" + if ! curl -fsSL "${ORCH_URL}/assets/vetting-agent-linux-amd64" -o "${staged}"; then echo "WARN: could not download agent from ${ORCH_URL}/assets/vetting-agent-linux-amd64" echo "WARN: registration succeeded but the host won't heartbeat." + rm -f "${staged}" return fi - chmod +x /usr/local/bin/vetting-agent + install -m 0755 "${staged}" /usr/local/bin/vetting-agent + rm -f "${staged}" cat >/etc/vetting/host-agent.yaml <