veza/scripts/bootstrap/runner-unstick-apt.sh

28 lines
889 B
Bash
Raw Normal View History

#!/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."
'