veza/scripts/bootstrap/runner-unstick-apt.sh
senke dd5317a57b chore(bootstrap): add runner-unstick-apt.sh helper
Single-quote nesting through ssh -> sudo -> incus exec -> bash -c was
mangling rm globs. A standalone script run on the R720 sidesteps the
quoting layers entirely.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 11:44:20 +02:00

27 lines
889 B
Bash
Executable file

#!/usr/bin/env bash
# Kill any apt-get / dpkg holding the dpkg lock inside the
# forgejo-runner Incus container, clear lock files, reconfigure.
# Run on the R720 itself with: sudo bash runner-unstick-apt.sh
set -euo pipefail
echo "→ inspecting forgejo-runner container"
incus exec forgejo-runner -- bash -c '
set -eu
echo " current apt/dpkg processes:"
ps -ef | grep -E "apt-get|dpkg" | grep -v grep || echo " (none)"
echo
echo " killing apt-get + dpkg"
pkill -9 -f apt-get 2>/dev/null || true
pkill -9 -f dpkg 2>/dev/null || true
echo
echo " removing stale locks"
rm -f /var/lib/dpkg/lock-frontend
rm -f /var/lib/dpkg/lock
rm -f /var/cache/apt/archives/lock
rm -f /var/lib/apt/lists/lock
echo
echo " reconfiguring partial installs"
DEBIAN_FRONTEND=noninteractive dpkg --configure -a
echo
echo " done."
'