From 2fbb6e261c6ced670022af69a2e2f808332dab27 Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:22:52 +0100 Subject: [PATCH] add-tailscale-lxc: start a stopped container and check its OS first (#18421) The container menu lists stopped containers too, and pct exec on one exits 255: 12 of 41 failures in three days. Start it the way add-netbird-lxc does and wait for its default route. The install runs under bash, which an Alpine container from the template does not have; lxc-attach then exits 127 before the Alpine branch is reached. Install bash there first, and stop with a clear message on any OS other than Debian, Ubuntu or Alpine instead of failing on apt-get. --- tools/addon/add-tailscale-lxc.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tools/addon/add-tailscale-lxc.sh b/tools/addon/add-tailscale-lxc.sh index 6d83b4d1c..ba7d2fa4c 100644 --- a/tools/addon/add-tailscale-lxc.sh +++ b/tools/addon/add-tailscale-lxc.sh @@ -65,6 +65,28 @@ while [[ -z "${CTID}" ]]; do "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit 0 done +if [[ "$(pct status "$CTID" | awk '{print $2}')" != "running" ]]; then + msg_info "Starting CT $CTID" + pct start "$CTID" + for _ in {1..30}; do + pct exec "$CTID" -- sh -c 'ip route 2>/dev/null | grep -q "^default"' && break + sleep 1 + done + msg_ok "Started CT $CTID" +fi + +CT_OS=$(pct exec "$CTID" -- sh -c '. /etc/os-release 2>/dev/null; echo "${ID:-}"') +case "$CT_OS" in +debian | ubuntu) ;; +alpine) + pct exec "$CTID" -- sh -c 'command -v bash >/dev/null 2>&1 || apk add --no-cache bash >/dev/null' + ;; +*) + msg_error "CT $CTID runs ${CT_OS:-an unknown OS}. This add-on supports Debian, Ubuntu and Alpine containers." + exit 238 + ;; +esac + CTID_CONFIG_PATH="/etc/pve/lxc/${CTID}.conf" # Skip if already configured