From 9585147e1e281ffa35f94d2fecdf8ad6f76faaf7 Mon Sep 17 00:00:00 2001 From: Mikhail Khachayants Date: Tue, 6 Sep 2022 16:56:57 +0300 Subject: fix Pod removal after OS hard shutdown In case of a hard OS shutdown, containers may have a "removing" state after a reboot, and an attempt to remove Pods with such containers is unsuccessful: error freeing lock for container ...: no such file or directory [NO NEW TESTS NEEDED] Signed-off-by: Mikhail Khachayants --- libpod/runtime_ctr.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index 1e1b7dad5..fb4f80aa6 100644 --- a/libpod/runtime_ctr.go +++ b/libpod/runtime_ctr.go @@ -798,7 +798,7 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, force, remo // Deallocate the container's lock if err := c.lock.Free(); err != nil { - if cleanupErr == nil { + if cleanupErr == nil && !os.IsNotExist(err) { cleanupErr = fmt.Errorf("error freeing lock for container %s: %w", c.ID(), err) } else { logrus.Errorf("Free container lock: %v", err) -- cgit v1.2.3-54-g00ecf