See $SUMMARY man sysctl says: --system Load settings from all system configuration files. /run/sysctl.d/*.conf /etc/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /lib/sysctl.d/*.conf /etc/sysctl.conf But in fact it does not work as expected: bgp ~ # sysctl --system * Applying /etc/sysctl.d/libvirtd.conf ... fs.aio-max-nr = 1048576 sysctl -p works, but only for /etc/sysctl.conf, /etc/sysctl.d is not obeyed The bug is pure unstable thingie, stable is not affected, cause stable openrc use for loop in /etc/init.d/sysctl to load all options both from /etc/sysctl.conf and /etc/sysctl.d
This was broken in cdca71e94506fbb921ab2c626be3ad05c4287498 in upstream procps, and "fixed" in 7f6efed9bb85d1e212e06985ea3e06720f6ca949. The fix contains a logic error of its own. Instead of: if (stat(DEFAULT_PRELOAD, &ts) < 0 || S_ISREG(ts.st_mode)) { It should be: if (stat(DEFAULT_PRELOAD, &ts) == 0 && S_ISREG(ts.st_mode)) {
Created attachment 383198 [details, diff] Fix for logic error in sysctl.c
Using the just-attached patch: Before: # strace -e trace=file sysctl --system execve("/sbin/sysctl", ["sysctl", "--system"], [/* 44 vars */]) = 0 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 openat(AT_FDCWD, "/run/sysctl.d", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/etc/sysctl.d", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 openat(AT_FDCWD, "/usr/local/lib/sysctl.d", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/sysctl.d", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/lib/sysctl.d", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/etc/sysctl.conf", {st_mode=S_IFREG|0644, st_size=1595, ...}) = 0 +++ exited with 0 +++ # After: # strace -e trace=file ./sysctl --system execve("./sysctl", ["./sysctl", "--system"], [/* 45 vars */]) = 0 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 [...] openat(AT_FDCWD, "/run/sysctl.d", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/etc/sysctl.d", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 openat(AT_FDCWD, "/usr/local/lib/sysctl.d", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/sysctl.d", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/lib/sysctl.d", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/etc/sysctl.conf", {st_mode=S_IFREG|0644, st_size=1595, ...}) = 0 * Applying /etc/sysctl.conf ... open("/etc/sysctl.conf", O_RDONLY) = 3 [...] And the file is loaded.
(In reply to Tobias Klausmann from comment #2) > Created attachment 383198 [details, diff] [details, diff] > Fix for logic error in sysctl.c in portage, as procps-3.3.9-r2
*** Bug 520292 has been marked as a duplicate of this bug. ***