diff --git a/cmd/skopeo/unshare_linux.go b/cmd/skopeo/unshare_linux.go index 4b005c2b9c..6778a02938 100644 --- a/cmd/skopeo/unshare_linux.go +++ b/cmd/skopeo/unshare_linux.go @@ -22,10 +22,13 @@ func maybeReexec() error { // With Skopeo we need only the subset of the root capabilities necessary // for pulling an image to the storage. Do not attempt to create a namespace // if we already have the capabilities we need. - capabilities, err := capability.NewPid(0) + capabilities, err := capability.NewPid2(0) if err != nil { return fmt.Errorf("error reading the current capabilities sets: %w", err) } + if err := capabilities.Load(); err != nil { + return fmt.Errorf("error loading the current capabilities sets: %w", err) + } if slices.ContainsFunc(neededCapabilities, func(cap capability.Cap) bool { return !capabilities.Get(capability.EFFECTIVE, cap) }) {