migrate_node_to_cinc: don't let needrestart hang the migration
kosmos/actions: Required labels / Required labels (pull_request) Successful in 11s

The script runs over SSH with no TTY, but needrestart's apt hook runs in
its default interactive mode (via debconf) after installing or removing
packages, so it blocks forever waiting on a prompt. That stalled the
garage-14 migration during `apt-get remove chef`.

Export DEBIAN_FRONTEND=noninteractive and NEEDRESTART_SUSPEND=1 inside the
generated remote script so no invocation flags are needed. The needrestart
hook exits early ("needrestart is suspended") and dpkg/apt can't prompt.
This commit is contained in:
raucao committed 2026-12-04 15:42:56 +04:00
1 parent b431c97129
commit 09343cde51
1 file changed
+6
+6
View File
@@ -42,6 +42,12 @@ remote="$(mktemp)"; trap 'rm -f "$remote"' EXIT
cat >"$remote" <<EOF
set -euo pipefail
# No TTY over this SSH connection: keep package tooling from prompting.
# needrestart's apt hook would otherwise run interactively (via debconf)
# after installing/removing packages and hang.
export DEBIAN_FRONTEND=noninteractive
export NEEDRESTART_SUSPEND=1
# 1. Cinc Client (Chef -> Cinc migration, or fresh).
# Install the current stable release for this platform. omnitruck resolves the
# right build per OS (so 20.04 and 22.04+ each get their latest supported