Improve relabel EPERM error for rootless

Fixes: https://github.com/containers/podman/issues/27184

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
This commit is contained in:
Jan Rodák
2026-03-09 20:54:36 +01:00
parent 5685ac5952
commit 35f9d61fcb

View File

@@ -3121,6 +3121,10 @@ func (c *Container) relabel(src, mountLabel string, shared bool) error {
logrus.Debugf("Labeling not supported on %q", src)
return nil
}
if errors.Is(err, unix.EPERM) {
return fmt.Errorf("failed to change selinux label: insufficient permissions, possibly due to a file owned by another user (current user: uid %d): %w", rootless.GetRootlessUID(), err)
}
return err
}