summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkg/rootless/rootless_linux.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/rootless/rootless_linux.go b/pkg/rootless/rootless_linux.go
index 182a39f6b..f71d55776 100644
--- a/pkg/rootless/rootless_linux.go
+++ b/pkg/rootless/rootless_linux.go
@@ -452,6 +452,7 @@ func TryJoinFromFilePaths(pausePidPath string, needNewNamespace bool, paths []st
var lastErr error
var pausePid int
+ foundProcess := false
for _, path := range paths {
if !needNewNamespace {
@@ -502,12 +503,16 @@ func TryJoinFromFilePaths(pausePidPath string, needNewNamespace bool, paths []st
}
pausePid, err = strconv.Atoi(string(b[:n]))
- if err == nil {
+ if err == nil && unix.Kill(pausePid, 0) == nil {
+ foundProcess = true
lastErr = nil
break
}
}
}
+ if !foundProcess {
+ return BecomeRootInUserNS(pausePidPath)
+ }
if lastErr != nil {
return false, 0, lastErr
}