From 4d4e6cba75d7e886b23a29e63f6461994b28c954 Mon Sep 17 00:00:00 2001 From: Malin Date: Thu, 12 Mar 2026 19:13:15 +0100 Subject: [PATCH] fix: let install subprocess start pured daemon to avoid ETXTBSY Pre-starting pured in the entrypoint caused ETXTBSY when the install subprocess (triggered by createRootProcessForMissingComponents) tried to overwrite the running daemon binary. - Remove pured pre-start from entrypoint; daemon starts via `systemctl start pured` inside the install subprocess instead - systemctl stop: use pkill -9 + sleep 1 for reliable termination - systemctl start: wait up to 15s for :9485 instead of blind sleep 2 Co-Authored-By: Claude Sonnet 4.6 --- vpn-node/entrypoint.sh | 15 ++++++--------- vpn-node/systemctl.sh | 9 +++++++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/vpn-node/entrypoint.sh b/vpn-node/entrypoint.sh index 2a2d30d..b292d0a 100755 --- a/vpn-node/entrypoint.sh +++ b/vpn-node/entrypoint.sh @@ -213,15 +213,12 @@ auto_mode() { # ════════════════════════════════════════════════════════════════════════════════ whitelist_eth0 -# ── Start pured daemon ──────────────────────────────────────────────────────── -log "Starting pured daemon …" -NODE_ENV=production /opt/purevpn-cli/pured-linux-x64 --start & -# Wait until daemon is listening on :9485 (up to 15s) -for i in $(seq 1 15); do - nc -z 127.0.0.1 9485 2>/dev/null && { log "pured listening on :9485"; break; } - sleep 1 -done -nc -z 127.0.0.1 9485 2>/dev/null || log "WARNING: pured not listening after 15s — continuing anyway" +# pured daemon is NOT pre-started here intentionally. +# purevpn-cli will call `systemctl is-active pured` → inactive → trigger +# `sudo purevpn-cli --install-missing-components` which downloads the daemon +# (via the patched correct URL), writes pured-linux-x64 (no ETXTBSY since +# the daemon isn't running yet), then starts it via `systemctl start pured`. +# Pre-starting the daemon caused ETXTBSY when the install tried to overwrite it. if [[ "$MANUAL_CONNECT" == "true" ]]; then manual_mode diff --git a/vpn-node/systemctl.sh b/vpn-node/systemctl.sh index 81b1811..4131e54 100644 --- a/vpn-node/systemctl.sh +++ b/vpn-node/systemctl.sh @@ -7,9 +7,14 @@ case "$*" in echo "inactive"; exit 1 ;; *"start pured"*) NODE_ENV=production /opt/purevpn-cli/pured-linux-x64 --start & - sleep 2; exit 0 ;; + for _i in $(seq 1 15); do + nc -z 127.0.0.1 9485 2>/dev/null && exit 0 + sleep 1 + done + exit 0 ;; *"stop pured"*|*"disable pured"*) - pkill -f "pured-linux-x64" 2>/dev/null || true; exit 0 ;; + pkill -9 -f "pured-linux-x64" 2>/dev/null || true + sleep 1; exit 0 ;; *) exit 0 ;; esac