------ Original Message ------
From "Dale" <[email protected]>
To [email protected]
Date 21.07.2025 15:49:48
Subject Re: [gentoo-user] sysctl as a directory instead of a file.
Possible wrong name.
Stefan Schmiedl wrote:
------ Original Message ------
From "Dale" <[email protected]>
To [email protected]
Date 21.07.2025 06:52:01
Subject [gentoo-user] sysctl as a directory instead of a file.
Possible wrong name.
root@Gentoo-1 / # sysctl -p
sysctl: cannot open "/etc/sysctl.conf": No such file or directory
root@Gentoo-1 / #
So, that makes me think maybe the directory named sysctl.d should
really be named sysctl.conf instead. That seems to be what sysctl is
looking for, or what it says it is looking for.
Am I wrong on this? If I'm right, is this a bug that needs to be
reported and fixed? Given this is a fairly recent install, I don't
think this is just some old cruft that got left behind. Something
looks to be wrong somewhere. Or I am wrong on this. ;-)
Hi Dale,
`man sysctl` is your friend:
-p[FILE], --load[=FILE]
Load in sysctl settings from the file specified or
/etc/sysctl.conf if none given...
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
/etc/sysctl.conf
If your box is using /etc/sysctl.d, you'll have to use --system
or name the file you want to load.
Regards,
s.
That worked. Odd but it worked. Question tho. It does see those
setting when booting up right? If it can't find it out without options
that aren't really the default, does it see it when booting?
Let's ask the system what it thinks:
~ % rc-update show | grep sysctl
sysctl | boot
~ % grep -n conf /etc/init.d/sysctl
21: [ -e /etc/sysctl.conf ] || return 0
22: local retval=0 var= comments= conf=
24: for conf in /etc/sysctl.conf /etc/sysctl.d/*.conf; do
25: if [ -r "$conf" ]; then
26: vebegin "applying $conf"
32: done < "$conf"
57: eend $rc "Unable to configure some kernel parameters"
So (at least here) sysctl is run at boot time and there is a for-loop in
the
openrc-script (line 24) looking at conf files in /etc
I did look at the man page. I thought that option was for when in a
chroot or something like that where the location might not be so
obvious, booted from a different distro that uses a different init
system or something like that. No idea it needed to be used for a OS
that is live. o_O
You can reconfigure quite a few parameters via sysctl. I do remember
that I
had a few sysctl.conf lines waaaay back when accessing the internet made
audible
noises to toggle the settings required to use my linux PC as ad-hoc
router.
Don't ask me what those settings were, though :-)
s.