Bug 1264080
Summary: | sysctl returns exit code 0 even on failure | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Tereza Cerna <tcerna> |
Component: | procps-ng | Assignee: | Jan Rybar <jrybar> |
Status: | CLOSED WONTFIX | QA Contact: | qe-baseos-daemons |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 7.2 | CC: | bnater, fedoraproject, jeder, jishi, jskarvad, kdudka |
Target Milestone: | rc | Keywords: | MoveUpstream |
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2020-12-15 07:36:53 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Tereza Cerna
2015-09-17 13:00:02 UTC
Reassigning to sysctl, tuned cannot detect that the sysctl command failed because sysctl is returning exit code 0, even if the kernel setting failed. Reproducer: # sysctl kernel.sched_rt_runtime_us=111111 sysctl: setting key "kernel.sched_rt_runtime_us": Invalid argument kernel.sched_rt_runtime_us = 111111 # echo $? 0 # sysctl kernel.sched_rt_runtime_us kernel.sched_rt_runtime_us = 950000 Expected result: Exit code<>0 if the sysctl settings failed. Regarding the error itself, I don't know why the setting itself is rejected by kernel on RHEL-7: # echo 111111 > /proc/sys/kernel/sched_rt_runtime_us -bash: echo: write error: Invalid argument but: # echo 950001 > /proc/sys/kernel/sched_rt_runtime_us # echo $? 0 I think it should work and it works on Fedora 22. Filled kernel bug 1264091. By using 950001 in tuned profile, it works correctly for me, so there is probably no tuned bug. Ahoj. The sysctl command is often used for writing multiple kernel variables at once and in such case it simply ignores the failed ones. It was always like that. We can't stop processing the variables somewhere in the middle, otherwise we would end up with unfinished kernel configuration during the startup. And since multiple variables can be configured with one sysctl call, we would have to define some rules for the return codes in order to satisfy the particular scenarios (all variables correctly set, some of the variable settings failed, all variable settings failed). Or shall we rather return the number of failures? This needs to be discussed upstream first. Regards, Jaromir. (In reply to Jaromír Cápík from comment #4) > Ahoj. > > The sysctl command is often used for writing multiple kernel variables at > once and in such case it simply ignores the failed ones. It was always like > that. We can't stop processing the variables somewhere in the middle, > otherwise we would end up with unfinished kernel configuration during the > startup. And since multiple variables can be configured with one sysctl > call, we would have to define some rules for the return codes in order to > satisfy the particular scenarios (all variables correctly set, some of the > variable settings failed, all variable settings failed). Or shall we rather > return the number of failures? This needs to be discussed upstream first. > > Regards, > Jaromir. I have no problem with multiple return codes for failure, but there definitely need to be mechanism how to detect that something failed, i.e. return code != 0. *** Bug 1395050 has been marked as a duplicate of this bug. *** Relevant bug: https://bugzilla.redhat.com/show_bug.cgi?id=1621940 The problem is that procps-ng/fileutils.c::close_stream() ignores ERRNO values. I sent fix to upstream a while ago. They seem to be kind of busy lately, so no response yet. After evaluating this issue, there are no plans to address it further or fix it in an upcoming release. Therefore, it is being closed. If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened. FYI, merged into upstream today: https://gitlab.com/procps-ng/procps/-/merge_requests/76/diffs |