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.