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 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 19:13:15 +01:00
parent f7fffc0ac3
commit 4d4e6cba75
2 changed files with 13 additions and 11 deletions

View File

@@ -213,15 +213,12 @@ auto_mode() {
# ════════════════════════════════════════════════════════════════════════════════ # ════════════════════════════════════════════════════════════════════════════════
whitelist_eth0 whitelist_eth0
# ── Start pured daemon ──────────────────────────────────────────────────────── # pured daemon is NOT pre-started here intentionally.
log "Starting pured daemon …" # purevpn-cli will call `systemctl is-active pured` → inactive → trigger
NODE_ENV=production /opt/purevpn-cli/pured-linux-x64 --start & # `sudo purevpn-cli --install-missing-components` which downloads the daemon
# Wait until daemon is listening on :9485 (up to 15s) # (via the patched correct URL), writes pured-linux-x64 (no ETXTBSY since
for i in $(seq 1 15); do # the daemon isn't running yet), then starts it via `systemctl start pured`.
nc -z 127.0.0.1 9485 2>/dev/null && { log "pured listening on :9485"; break; } # Pre-starting the daemon caused ETXTBSY when the install tried to overwrite it.
sleep 1
done
nc -z 127.0.0.1 9485 2>/dev/null || log "WARNING: pured not listening after 15s — continuing anyway"
if [[ "$MANUAL_CONNECT" == "true" ]]; then if [[ "$MANUAL_CONNECT" == "true" ]]; then
manual_mode manual_mode

View File

@@ -7,9 +7,14 @@ case "$*" in
echo "inactive"; exit 1 ;; echo "inactive"; exit 1 ;;
*"start pured"*) *"start pured"*)
NODE_ENV=production /opt/purevpn-cli/pured-linux-x64 --start & 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"*) *"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 ;; exit 0 ;;
esac esac