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

    From Stefan Schmiedl@21:1/5 to All on Mon Jul 21 07:30:01 2025
    ------ 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.

    Howdy,

    I was browsing around on my VPN provider website. It listed some
    config option to disable IPv6 to make sure no data leaks out. I have
    IPv6 disabled already in my router but thought I would disable it on my >system and enable it on the router so that other devices can use IPv6
    if they need to. I have two other computers and a cell phone, plus a >printer, that uses the router to. I found the directory for sysctl.d
    and it seems to work like the portage directory where you can add
    individual files instead of one big file for everything. I created a
    file named IPv6-disable.conf and put the needed options in the file.
    Then I ran the command to make it load the new settings. Like this:


    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. ;-)

    Thoughts??

    Dale

    :-) :-)
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From yahoo@21:1/5 to All on Mon Jul 21 16:10:01 2025
    Il 21/07/25 15:49, Dale ha scritto:

    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?


    The option is set by the sysctl rc-script which is in boot runlevel:

    Linux_sysctl()
    {
    local quiet
    yesno $rc_verbose || quiet=-q

    sysctl ${quiet} --system
    }

    raf

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From yahoo@21:1/5 to All on Mon Jul 21 18:50:01 2025
    Il 21/07/25 16:37, Dale ha scritto:
    Stefan Schmiedl wrote:
    ------ Original Message ------
    From "Dale" <[email protected] <mailto:[email protected]>>
    To [email protected] <mailto:[email protected]>
    Date 21.07.2025 15:49:48
    Subject Re: [gentoo-user] sysctl as a directory instead of a file.
    Possible wrong name.

    ~ % 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




    Ahhh.  So the init script is set up to find the files where they are not what may be the default on some other init system.  That works.  I can
    live with that.  :-D


    No, that is not correct. Stefan printed part of the function named BSD_sysctl().
    There is another function the same script, named Linux_sysctl(), which basically just does 'sysctl --system'. So I'd not say Gentoo is non
    standard, rather it seems to me the BSD function is provided to mimic
    the Linux behavior.

    But I already wrote this, looks like it did not get through.

    raf

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