File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 1515export 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
1820echo " 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
2023rm -rf " ${XDG_RUNTIME_DIR} /containers" 2> /dev/null || true
24+ rm -rf " ${XDG_RUNTIME_DIR} /libpod" 2> /dev/null || true
2125rm -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
2630echo " Installing crun..."
You can’t perform that action at this time.
0 commit comments