Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI:DOCS] Document how to enable CPU limit delegation #8134

Merged
merged 1 commit into from
Oct 27, 2020
Merged

[CI:DOCS] Document how to enable CPU limit delegation #8134

merged 1 commit into from
Oct 27, 2020

Conversation

xordspar0
Copy link
Contributor

This adds documentation around the CPU limit delegation issue as discussed in #7959.

@xordspar0 xordspar0 changed the title Document how to enable CPU limit delegation [CI:DOCS] Document how to enable CPU limit delegation Oct 25, 2020
@rhatdan
Copy link
Member

rhatdan commented Oct 25, 2020

Thanks @xordspar0
LGTM
@TomSweeneyRedHat PTAL
@containers/podman-maintainers PTAL

Comment on lines 1466 to 1495
## TROUBLESHOOTING

### Rootless cgroups v2 CPU limits

On some systems, setting CPU limits such as **--cpu-quota** will fail with an
error similar to the following:

Error: opening file `cpu.max` for writing: Permission denied: OCI runtime permission denied error

This means that CPU limit delegation is not enabled for the current user. You
can verify by running the following command:

cat "/sys/fs/cgroup/user.slice/user-$(id -u).slice/user@$(id -u).service/cgroup.controllers"

Example output might be:

memory pids

In the above example, `cpu` is not listed, which means the curent user does
not have permission to set CPU limits.

If you want to enable CPU limit delegation for all users, you can create the
file `/etc/systemd/system/user@.service.d/delegate.conf` with the contents:

[Service]
Delegate=memory pids cpu io

After logging out and loggin back in, you should have permission to set CPU
limits.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is fine to have it documented only in troubleshooting.md

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. What should be in the man pages? A note saying that if you have issues with setting limits you should check troubleshooting.md?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I'd just add a pointer to the troubleshooting.md page to avoid maintaining the same information in 3 different places

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, that sounds good. Is troubleshooting.md hosted on the website or should I just link to https://github.com/containers/podman/blob/master/troubleshooting.md?

Comment on lines 1165 to 1194
## TROUBLESHOOTING

### Rootless cgroups v2 CPU limits

On some systems, setting CPU limits such as **--cpu-quota** will fail with an
error similar to the following:

Error: opening file `cpu.max` for writing: Permission denied: OCI runtime permission denied error

This means that CPU limit delegation is not enabled for the current user. You
can verify by running the following command:

cat "/sys/fs/cgroup/user.slice/user-$(id -u).slice/user@$(id -u).service/cgroup.controllers"

Example output might be:

memory pids

In the above example, `cpu` is not listed, which means the curent user does
not have permission to set CPU limits.

If you want to enable CPU limit delegation for all users, you can create the
file `/etc/systemd/system/user@.service.d/delegate.conf` with the contents:

[Service]
Delegate=memory pids cpu io

After logging out and loggin back in, you should have permission to set CPU
limits.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, I think it is fine to have it documented only in troubleshooting.md


### 26) Running containers with CPU limits fails with a permissions error

On some systems, non-root users do not have CPU limit delegation permissions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we be more specific here? We could say the issue happens with systemd as by default it doesn't enable all the available controllers for unprivileged users

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not all systems that have systemd. Fedora 33 does have CPU delegation enabled by default. It's really only systems that have cgroups v2 enabled but don't configure the delegations, which as far as I know is only Fedora 31 and 32. How specific should we be?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the proposed solution works only on systems managed by systemd, that is why I was pointing out we could specify the issue is specific to systemd. Either way, it is just a nit, I am fine as it is now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. That makes sense.

@rhatdan
Copy link
Member

rhatdan commented Oct 26, 2020

/approve

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhatdan, xordspar0

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 26, 2020
Signed-off-by: Jordan Christiansen <xordspar0@gmail.com>
@rhatdan
Copy link
Member

rhatdan commented Oct 27, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 27, 2020
@openshift-merge-robot openshift-merge-robot merged commit 434de06 into containers:master Oct 27, 2020
@xordspar0 xordspar0 deleted the cpu.max-permission branch October 27, 2020 19:42
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants