Skip to content

Commit

Permalink
Merge pull request #4157 from kinvolk/rata/idmap-errormsg
Browse files Browse the repository at this point in the history
libct: Improve error msg when idmap is not supported
  • Loading branch information
lifubang authored Dec 29, 2023
2 parents c48c428 + a7c3e07 commit 35988ab
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libcontainer/mount_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,12 @@ func mountFd(nsHandles *userns.Handles, m *configs.Mount) (*mountSource, error)
Attr_set: unix.MOUNT_ATTR_IDMAP,
Userns_fd: uint64(usernsFile.Fd()),
}); err != nil {
return nil, fmt.Errorf("failed to set MOUNT_ATTR_IDMAP on %s: %w", m.Source, err)
extraMsg := ""
if err == unix.EINVAL {
extraMsg = " (maybe the filesystem used doesn't support idmap mounts on this kernel?)"
}

return nil, fmt.Errorf("failed to set MOUNT_ATTR_IDMAP on %s: %w%s", m.Source, err, extraMsg)
}
} else {
var err error
Expand Down

0 comments on commit 35988ab

Please sign in to comment.