• Re[2]: [gentoo-user] sysctl as a directory instead of a file. Possible

    From Stefan Schmiedl@21:1/5 to All on Mon Jul 21 16:10:01 2025
    ------ Original Message ------
    From "Dale" <rdalek1967@gmail.com>
    To gentoo-user@lists.gentoo.org
    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" <rdalek1967@gmail.com>
    To gentoo-user@lists.gentoo.org
    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.
    <html><head>

    <style id="signatureStyle" type="text/css"><!--#xc4e8b9c6d7ab4fd #xe61c1979f7dd4eaeb9a72a2370c0e757 p
    {margin: 0px;}
    #xc4e8b9c6d7ab4fd #xe61c1979f7dd4eaeb9a72a2370c0e757
    {font-family: "Segoe UI"; font-size: 12pt;}
    #xc4e8b9c6d7ab4fd #xe61c1979f7dd4eaeb9a72a2370c0e757 p
    {margin: 0px;}
    </style><style id="css_styles" type="text/css"><!--blockquote.cite { margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc }
    blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc; margin-top: 3px; padding-top: 0px; }
    a img { border: 0px; }
    li[style='text-align: center;'], li[style='text-align: center; '], li[style='text-align: right;'], li[style='text-align: right; '] { list-style-position: inside;}
    body { font-family: Consolas; font-size: 11pt; }
    .quote { margin-left: 1em; margin-right: 1em; border-left: 5px #ebebeb solid; padding-left: 0.3em; }
    a.em-mention[href] { text-decoration: none; color: inherit; border-radius: 3px; padding-left: 2px; padding-right: 2px; background-color: #e2e2e2; }
    ._em_placeholder {color: gray; border-bottom: 1px dotted lightblue;} ._em_placeholder:before{color:gray; content: '{{ ';} ._em_placeholder:after{color:gray; content: ' }}';}
    </style></head>
    <body><div><span>------ Original Message ------</span></div><div>
    <div>From "Dale" &lt;<a href="mailto:rdalek1967@gmail.com">rdalek1967@gmail.com</a>&gt;</div>
    <div>To <a href="mailto:gentoo-user@lists.gentoo.org">gentoo-user@lists.gentoo.org</a></div>
    <div>Date 21.07.2025 15:49:48</div>
    <div>Subject Re: [gentoo-user] sysctl as a directory instead of a file. Possible wrong name.</div></div><div x-em-quote=""><br /></div>
    <div id="x4b88995a7f1c48f" class="plain"><blockquote cite="ad2ac6d1-7bfb-bce8-24f2-7980afe723ab@gmail.com" type="cite" class="cite2">

    <div class="plain_line">Stefan Schmiedl wrote:</div>
    <blockquote type="cite" class="cite">
    <div class="plain_line"> ------ Original Message ------</div>
    <blockquote type="cite" class="cite">
    <div class="plain_line"> From "Dale" &lt;<a href="mailto:rdalek1967@gmail.com">rdalek1967@gmail.com</a>&gt;</div>
    </blockquote>
    <div class="plain_line"> To <a href="mailto:gentoo-user@lists.gentoo.org">gentoo-user@lists.gentoo.org</a></div>
    <div class="plain_line"> Date 21.07.2025 06:52:01</div>
    <div class="plain_line"> Subject [gentoo-user] sysctl as a directory instead of a file.</div>
    <div class="plain_line"> Possible wrong name.</div>
    <div class="plain_line"> </div>
    <blockquote type="cite" class="cite2">
    <div class="plain_line"><span> root@Gentoo-1 / # sysctl -p</span></div>
    <div class="plain_line"> sysctl: cannot open "/etc/sysctl.conf": No such file or directory</div>
    <div class="plain_line"> root@Gentoo-1 / #</div>
    <div class="plain_line"> </div>
    <div class="plain_line"> </div>
    <div class="plain_line"> So, that makes me think maybe the directory named sysctl.d should</div>
    <div class="plain_line"> really be named sysctl.conf instead.  That seems to be what sysctl is</div>
    <div class="plain_line"> looking for, or what it says it is looking for.</div> <div class="plain_line"> </div>
    <div class="plain_line"> Am I wrong on this?  If I'm right, is this a bug that needs to be</div>
    <div class="plain_line"> reported and fixed?  Given this is a fairly recent install, I don't</div>
    <div class="plain_line"> think this is just some old cruft that got left behind.  Something</div>
    <div class="plain_line"> looks to be wrong somewhere.  Or I am wrong on this.  ;-)</div>
    <div class="plain_line"> </div>
    <div class="plain_line"><br /></div>
    </blockquote>
    <div class="plain_line"> Hi Dale,</div>
    <div class="plain_line"> `man sysctl` is your friend:</div>
    <div class="plain_line">        -p[FILE], --load[=FILE]</div>
    <div class="plain_line">               Load in sysctl settings from the file specified or</div>
    <div class="plain_line">               /etc/sysctl.conf if none given...</div>
    <div class="plain_line"> SYSTEM FILE PRECEDENCE</div>
    <div class="plain_line">        When using the --system option, sysctl will read files from</div>
    <div class="plain_line">        directories in the following list in given order from top</div>
    <div class="plain_line">        to bottom. Once a file of a given filename is loaded, any</div>
    <div class="plain_line">        file of the same name in subsequent directories is ignored.</div>
    <div class="plain_line">        /etc/sysctl.d/*.conf</div>
    <div class="plain_line">        /run/sysctl.d/*.conf</div>
    <div class="plain_line">        /usr/local/lib/sysctl.d/*.conf</div>
    <div class="plain_line">        /usr/lib/sysctl.d/*.conf</div>
    <div class="plain_line">        /lib/sysctl.d/*.conf</div>
    <div class="plain_line">        /etc/sysctl.conf</div>
    <div class="plain_line"> If your box is using /etc/sysctl.d, you'll have to use --system</div>
    <div class="plain_line"> or name the file you want to load.</div>
    <div class="plain_line"> Regards,</div>
    <div class="plain_line"> s.</div>
    </blockquote>
    <div class="plain_line"> </div>
    <div class="plain_line">That worked.  Odd but it worked.  Question tho.  It does see those</div>
    <div class="plain_line">setting when booting up right?  If it can't find it out without options</div>
    <div class="plain_line">that aren't really the default, does it see it when booting? </div></blockquote><span><div id="x4b88995a7f1c48f" class="plain"><span>Let's ask the system what it thinks:</span></div><div id="x4b88995a7f1c48f" class="plain"><span><
    br /></span></div><div id="x4b88995a7f1c48f" class="plain"><span>~ % rc-update show | grep sysctl
    </span></div><div id="x4b88995a7f1c48f" class="plain"><span>               sysctl | boot
    </span></div><div id="x4b88995a7f1c48f" class="plain"><br /></div><div id="x4b88995a7f1c48f" class="plain"><span>~ % grep -n conf /etc/init.d/sysctl
    </span></div><div id="x4b88995a7f1c48f" class="plain"><span>21:     [ -e /etc/sysctl.conf ] || return 0
    </span></div><div id="x4b88995a7f1c48f" class="plain"><span>22:     local retval=0 var= comments= conf=
    </span></div><div id="x4b88995a7f1c48f" class="plain"><span>24:     for conf in /etc/sysctl.conf /etc/sysctl.d/*.conf; do
    </span></div><div id="x4b88995a7f1c48f" class="plain"><span>25:             if [ -r "$conf" ]; then
    </span></div><div id="x4b88995a7f1c48f" class="plain"><span>26:                     vebegin "applying $conf"
    </span></div><div id="x4b88995a7f1c48f" class="plain"><span>32:                     done &lt; "$conf"
    </span></div><div id="x4b88995a7f1c48f" class="plain"><span>57:     eend $rc "Unable to configure some kernel parameters"
    </span></div><div id="x4b88995a7f1c48f" class="plain"><span><br /></span></div><div id="x4b88995a7f1c48f" class="plain"><span>So (at least here) sysctl is run at boot time and there is a for-loop in the</span></div><div id="x4b88995a7f1c48f" class="plain"
    openrc-script (line 24) looking at conf files in /etc</div><div id="x4b88995a7f1c48f" class="plain"><span><br /></span></div><br /></span><blockquote cite="ad2ac6d1-7bfb-bce8-24f2-7980afe723ab@gmail.com" type="cite" class="cite2"><div class="plain_line">
    <span> </span></div>
    <div class="plain_line">I did look at the man page.  I thought that option was for when in a</div>
    <div class="plain_line">chroot or something like that where the location might not be so</div>
    <div class="plain_line">obvious, booted from a different distro that uses a different init</div>
    <div class="plain_line">system or something like that.  No idea it needed to be used for a OS</div>
    <div class="plain_line">that is live.  o_O </div></blockquote><span><div id="x4b88995a7f1c48f" class="plain">You can reconfigure quite a few parameters via sysctl. I do remember that I</div><div id="x4b88995a7f1c48f" class="plain">had a few sysctl.conf
    lines waaaay back when accessing the internet made audible</div><div id="x4b88995a7f1c48f" class="plain">noises to toggle the settings required to use my linux PC as ad-hoc router.</div><div id="x4b88995a7f1c48f" class="plain">Don't ask me what those
    settings were, though <span style="color: rgb(0, 0, 0); font-size: 11pt;">:-)</span></div></span><span><div id="x4b88995a7f1c48f" class="plain"><br /></div><div id="x4b88995a7f1c48f" class="plain">s.</div></span></div>


    </body></html>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)