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

in container: sudo: setrlimit(RLIMIT_CORE): Operation not permitted #42

Closed
juhp opened this issue Mar 14, 2020 · 17 comments
Closed

in container: sudo: setrlimit(RLIMIT_CORE): Operation not permitted #42

juhp opened this issue Mar 14, 2020 · 17 comments

Comments

@juhp
Copy link

juhp commented Mar 14, 2020

Apparently since version 1.8.29, sudo started outputting this warning in Linux rootless containers:

$ sudo hello > /dev/null
sudo: setrlimit(RLIMIT_CORE): Operation not permitted

which is quite annoying. This is with sudo-1.9.0b1.
(There are quite a lot of reports of this.)

Can something be done to alleviate it?

@millert
Copy link
Collaborator

millert commented Mar 14, 2020

Handling of RLIMIT_CORE appears to be buggy in Linux containers. When sudo tries to restore the original coredump limit (which appears to be RLIM_INFINITY) as uid 0 it gets EPERM, which should not happen. Sudo 1.8.28 just silently ignored the failure, in 1.8.29 and above a warning is written to the standard error. I'll probably just go back to ignoring the failure but this is not actually a bug in sudo.

@millert
Copy link
Collaborator

millert commented Mar 14, 2020

This is fixed by 712afe0

@millert
Copy link
Collaborator

millert commented Mar 14, 2020

Fixed in sudo 1.8.31p1, available now.

@millert millert closed this as completed Mar 14, 2020
@juhp
Copy link
Author

juhp commented Mar 15, 2020

Thanks so much!!

@juhp
Copy link
Author

juhp commented Mar 21, 2020

BTW do you plan to add this also to 1.9.0?

@millert
Copy link
Collaborator

millert commented Mar 21, 2020

Yes, it was already committed to what will be the 1.9 tree

@juhp
Copy link
Author

juhp commented Mar 22, 2020

Great, thank you for confirming

@vorburger
Copy link

FTR in the sudo 1.9.x (?) included today in Fedora 30 this wasn't included, yet; but FYI to anyone hitting this, as per https://bugzilla.redhat.com/show_bug.cgi?id=1773148 (and https://ask.fedoraproject.org/t/sudo-setrlimit-rlimit-core-operation-not-permitted/4223) there is a simple workaround:

echo "Set disable_coredump false" >> /etc/sudo.conf

I've used this in https://github.com/vorburger/cloudshell.

@juhp
Copy link
Author

juhp commented Apr 7, 2020

FTR in the sudo 1.9.x (?) included today in Fedora 30 this wasn't included, yet

It is fixed in sudo-1.8.31p1-1.fc30 in Fedora update-testing for me - anyway better to report downstream problems to bugzilla. :)

@uwe72
Copy link

uwe72 commented Apr 27, 2020

I am new to linux. sorry to tell, but how can this be possible in a new installed linux, up-to-date

vintagesucks added a commit to vintagesucks/caddy-script that referenced this issue Apr 27, 2020
dwsteele added a commit to pgbackrest/pgbackrest that referenced this issue May 7, 2020
Newer versions of sudo output this message to stdout when run in a container:

sudo: setrlimit(RLIMIT_CORE): Operation not permitted

See sudo-project/sudo#42 for details.

A simple workaround is to prevent sudo from disabling core dumps. This seems safe enough because if sudo is segfaulting then core files are the least of our worries.
dwsteele added a commit to pgbackrest/pgbackrest that referenced this issue May 7, 2020
Newer versions of sudo output this message to stderr when run in a container:

sudo: setrlimit(RLIMIT_CORE): Operation not permitted

See sudo-project/sudo#42 for details.

A simple workaround is to prevent sudo from disabling core dumps. This seems safe enough because if sudo is segfaulting then core files are the least of our worries.
lharzenetter added a commit to lharzenetter/tosca-definitions-workshop that referenced this issue Jun 4, 2020
laithshadeed pushed a commit to laithshadeed/docker-selenium that referenced this issue Jun 25, 2020
This upgrade requires more packages to be upgraded:

ffmpeg 4.2.2
chrome 83.0.4103.116
firefox 77.0.1
pip 20.1.1 -> To skip pip warning
supervisor 4.2.0 -> To fix failing "ImportError: cannot import name escape' from 'cgi'"
change from apt to apt-get -> To remove warning "unstable cli interface"

pending next stable release:
TODO: upgrade sudo to 1.8.31p1 or 1.9 to fix
sudo: setrlimit(RLIMIT_CORE): Operation not permitted
sudo-project/sudo#42
@ChameleonDevil
Copy link

I have just installed sudo inside a Docker container - apt-get update && apt-get install -y sudo and this notification is still in the Docker Ubuntu 20.04 container.

The only thing that work was was this user said above:

FTR in the sudo 1.9.x (?) included today in Fedora 30 this wasn't included, yet; but FYI to anyone hitting this, as per https://bugzilla.redhat.com/show_bug.cgi?id=1773148 (and https://ask.fedoraproject.org/t/sudo-setrlimit-rlimit-core-operation-not-permitted/4223) there is a simple workaround:

echo "Set disable_coredump false" >> /etc/sudo.conf

I've used this in https://github.com/vorburger/cloudshell.

Creating a new /etc/sudo.conf file and restarting the container and testing in shell again; those information messages are not showing anymore.

LanderU added a commit to ros2-realtime-demo/pendulum that referenced this issue Aug 5, 2020
* Avoid issue with sudo package see: sudo-project/sudo#42

Signed-off-by: LanderU <lander.usategui@gmail.com>
hugojosefson added a commit to hugojosefson/ubuntu-install-scripts that referenced this issue Aug 7, 2020
carlossvg pushed a commit to ros2-realtime-demo/pendulum that referenced this issue Aug 15, 2020
* Avoid issue with sudo package see: sudo-project/sudo#42

Signed-off-by: LanderU <lander.usategui@gmail.com>
stanstrup added a commit to rformassspectrometry/metaRbolomics-book that referenced this issue Aug 28, 2020
trying to fix: sudo: setrlimit(RLIMIT_CORE): Operation not permitted

--> sudo-project/sudo#42
@warpspin
Copy link

Handling of RLIMIT_CORE appears to be buggy in Linux containers. When sudo tries to restore the original coredump limit (which appears to be RLIM_INFINITY) as uid 0 it gets EPERM, which should not happen.

Raising a hard limit without CAP_SYS_RESOURCE causes EPERM. This is not a bug in the containers in my opinion. The proper solution would probably be that sudo only sets the soft limit to 0 and leaves the hard limit untouched.

This would also solve the even more annoying than the warning problem, where sudo in a rootless container permanently messes up the coredump hard limit for processes it launches without giving any indication it did so.

amanagr added a commit to amanagr/zulip that referenced this issue Mar 29, 2021
This helps us reduce time to update dependencies on every CI
build since the previous containers used to take about 1 minute.

`sudo` had a bug due to which we were not able to create directories.
See sudo-project/sudo#42.
We used this directories to restore caches.
Upgrading the focus dependencies via this commit naturally fixes that
bug.

Fixes zulip#17854
amanagr added a commit to amanagr/zulip that referenced this issue Mar 29, 2021
This helps us reduce time to update dependencies on every CI
build since the previous containers used to take about 1 minute.

`sudo` had a bug due to which we were not able to create directories.
See sudo-project/sudo#42.
We used these directories to restore caches.
Upgrading the focus dependencies via this commit naturally fixes that
bug.

Fixes zulip#17854
amanagr added a commit to amanagr/zulip that referenced this issue Mar 29, 2021
This helps us reduce time to update dependencies on every CI
build since the previous containers used to take about 1 minute.

`sudo` had a bug due to which we were not able to create directories.
See sudo-project/sudo#42.
We used these directories to restore caches.
Upgrading the focal dependencies via this commit naturally fixes that
bug.

Fixes zulip#17854
amanagr added a commit to zulip/zulip that referenced this issue Mar 29, 2021
This helps us reduce time to update dependencies on every CI
build since the previous containers used to take about 1 minute.

`sudo` had a bug due to which we were not able to create directories.
See sudo-project/sudo#42.
We used these directories to restore caches.
Upgrading the focal dependencies via this commit naturally fixes that
bug.

Fixes #17854
@govindsajgane
Copy link

can we make these changes echo "Set disable_coredump false" >> /etc/sudo.conf without rebooting. just to avoid/disturb other people using the same machine?

@millert
Copy link
Collaborator

millert commented Aug 10, 2022

Yes, there is no need to reboot. The sudo.conf file is read every time sudo is run.

@govindsajgane
Copy link

I tried it and it worked. But it worked only once. After that if im trying to change nofile limit using c programm which uses settlimit look like doest work. Setting disable_core false means no core genration? Like core file generation on segmentatiom fault?

@govindsajgane
Copy link

@millert thank you for your help. Is it correct way to set nofile limit while running process ?? If yes it wont allow without set disble coredump to false.

@douglasg14b
Copy link

I'm on sudo v 1.9.9 and this still appears to be a problem? I keep being directed to this github thread as the solution to being unable to mount an NFS volume in portainer on a linux container 🤔

millert added a commit that referenced this issue Apr 24, 2023
This should avoid problems on Linux in cases where sudo does not
have CAP_SYS_RESOURCE which may be the case in an unprivileged container.
GitHub issue #42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants