From 246782133cc36e66db0f4facccd7dabcd76a92d5 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 27 Oct 2021 09:44:54 +0200 Subject: runtime: check for pause pid existence check that the pause pid exists before trying to move it to a separate scope. Closes: https://github.com/containers/podman/issues/12065 Signed-off-by: Giuseppe Scrivano --- libpod/runtime.go | 6 +++++- test/e2e/system_reset_test.go | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libpod/runtime.go b/libpod/runtime.go index c22d87324..a99f55fb3 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -541,7 +541,11 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) { return err } if became { - utils.MovePauseProcessToScope(pausePid) + // Check if the pause process was created. If it was created, then + // move it to its own systemd scope. + if _, err = os.Stat(pausePid); err == nil { + utils.MovePauseProcessToScope(pausePid) + } os.Exit(ret) } } diff --git a/test/e2e/system_reset_test.go b/test/e2e/system_reset_test.go index 102526a46..93ab166cd 100644 --- a/test/e2e/system_reset_test.go +++ b/test/e2e/system_reset_test.go @@ -60,6 +60,8 @@ var _ = Describe("podman system reset", func() { session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) + Expect(session.ErrorToString()).To(Not(ContainSubstring("Failed to add pause process"))) + // If remote then the API service should have exited // On local tests this is a noop podmanTest.StartRemoteService() -- cgit v1.2.3-54-g00ecf