You are not logged in.

#1 2026-10-19 15:26:21

jmj
Member
Registered: 2023-12-10
Posts: 17

[SOLVED] sysctl loading commented lines?

In /etc/sysctl.d/50-coredump.conf I have:

#kernel.core_pattern=|/bin/false

So I can toggle coredumps by changing the comment. When I reboot with this config however, 'sysctl -n kernel.core_pattern' shows me '|/bin/false'.

If I completely remove the file I get the correct default from /usr/lib/sysctl.d/50-coredump.conf, which is '|/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h %d %F %I'

'man sysctl.d' says "Empty lines and lines whose first non-whitespace character is "#" or ";" are ignored," so why am I getting '|/bin/false' when that line is commented out?

Last edited by jmj (2026-10-19 19:23:01)

Offline

#2 2026-10-19 16:54:12

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 829

Re: [SOLVED] sysctl loading commented lines?

I'm pretty sure it is set not by your /etc/sysctl.d/50-coredump.conf but by systemd from src/shared/coredump-util.c:182.

Offline

#3 2026-10-19 19:06:27

just4arch
Member
Registered: 2023-01-07
Posts: 131

Re: [SOLVED] sysctl loading commented lines?

man sysctl wrote:

   System file precedence
     When using the --system option, sysctl will read files from directories in the following list in given order from top to bottom. Once a file of a given filename is loaded, any file of the same name in subsequent  directories
     is ignored.

     /etc/sysctl.d/*.conf
     /run/sysctl.d/*.conf
     /usr/local/lib/sysctl.d/*.conf
     /usr/lib/sysctl.d/*.conf
     /lib/sysctl.d/*.conf

So you'll probably have to adjust your approach.

Offline

#4 2026-10-19 19:22:27

jmj
Member
Registered: 2023-12-10
Posts: 17

Re: [SOLVED] sysctl loading commented lines?

Wow ok that explains it. I guess my solution is to use /etc/sysctl.d/60-coredump.conf instead.

Offline

Board footer

Powered by FluxBB