Skip to content

Commit 925b006

Browse files
committed
remoive redundant setup
1 parent e399db4 commit 925b006

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

scripts/dev/configure_container_auth.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@ setup_validate_container_runtime() {
2424
fi
2525
CONFIG_PATH="${HOME}/.config/containers/auth.json"
2626
echo "Using Podman for container authentication (rootless mode)"
27+
28+
# Ensure XDG_RUNTIME_DIR is set for rootless podman
29+
if [[ -z "${XDG_RUNTIME_DIR:-}" ]]; then
30+
XDG_RUNTIME_DIR="/run/user/$(id -u)"
31+
export XDG_RUNTIME_DIR
32+
fi
33+
34+
# Clean up stale podman state to avoid "cannot re-exec process" errors
35+
echo "Cleaning up stale podman state..."
36+
pkill -9 -u "$(id -u)" -f "podman" 2>/dev/null || true
37+
pkill -9 -u "$(id -u)" -f "conmon" 2>/dev/null || true
38+
rm -rf "${XDG_RUNTIME_DIR}/containers" 2>/dev/null || true
39+
rm -rf "${XDG_RUNTIME_DIR}/libpod" 2>/dev/null || true
40+
rm -rf "${HOME}/.local/share/containers/storage/libpod" 2>/dev/null || true
41+
sleep 1
2742
;;
2843
"docker")
2944
if ! command -v docker &> /dev/null; then

scripts/dev/setup_ibm_container_runtime.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ fi
1515
export XDG_RUNTIME_DIR="${runtime_dir}"
1616

1717
# Clean up stale podman state (fixes "cannot re-exec process to join the existing user namespace")
18+
# Note: We only use file-based cleanup here, not podman commands, because podman itself
19+
# may fail with "cannot re-exec" if state is corrupted
1820
echo "Cleaning up stale podman state..."
19-
pkill -u "$(id -u)" -f "podman" 2>/dev/null || true
21+
pkill -9 -u "$(id -u)" -f "podman" 2>/dev/null || true
22+
pkill -9 -u "$(id -u)" -f "conmon" 2>/dev/null || true
2023
rm -rf "${XDG_RUNTIME_DIR}/containers" 2>/dev/null || true
24+
rm -rf "${XDG_RUNTIME_DIR}/libpod" 2>/dev/null || true
2125
rm -rf "${HOME}/.local/share/containers/storage/libpod" 2>/dev/null || true
22-
podman system migrate 2>/dev/null || true
23-
podman system reset --force 2>/dev/null || true
26+
rm -rf "${HOME}/.local/share/containers/storage/overlay-containers" 2>/dev/null || true
27+
sleep 1
2428

2529
# Install crun
2630
echo "Installing crun..."

0 commit comments

Comments
 (0)