Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: sysctl.conf still being ignored on boot

  1. #1

    Default sysctl.conf still being ignored on boot

    Hi

    I have a setting to disable ipv6 in /etc/sysctl.conf and it is ignored at boot

    I have to manually run

    sudo sysctl -p

    and the settings I've added (or are added by suse?) are then appied

    I've had a look back though posts on these forums and cannot see an actual answer that works (including a thread from 2013)

    /etc/sysctl.conf is defintely link to from /usr/lib/sysctl.d/99-sysctl.conf -> /etc/sysctl.conf

    Code:
    ls -l /usr/lib/sysctl.d/99-sysctl.conf
    lrwxrwxrwx 1 root root 16 Mar  6 21:05 /usr/lib/sysctl.d/99-sysctl.conf -> /etc/sysctl.conf
    One thread suggested

    Code:
    chkconfig -a boot.sysctl
    But I got a response of
    Code:
    boot.sysctl: unknown service
    Running
    Code:
    sudo systemctl enable systemd-sysctl.service
    tells me:
    Code:
    The unit files have no installation config (WantedBy=, RequiredBy=, Also=,
    Alias= settings in the [Install] section, and DefaultInstance= for template
    units). This means they are not meant to be enabled using systemctl.
     
    Possible reasons for having this kind of units are:
    • A unit may be statically enabled by being symlinked from another unit's
      .wants/ or .requires/ directory.
    • A unit's purpose may be to act as a helper for some other unit which has
      a requirement dependency on it.
    • A unit may be started when needed via activation (socket, path, timer,
      D-Bus, udev, scripted systemctl call, ...).
    • In case of template units, the unit is meant to be enabled with some
      instance name specified.
    Running
    Code:
    sudo sysctl -p
    Gives me what I want and reads /etc/sysctl.conf

    But this does not happen at boot

    Why?

    In debian (which I use at work on multiple VMs, actual hardware etc of all OSes dating back years) this just works

    But not in Tumbleweed

    There is obviously some step I am missing that involves more than just putting an entry in /etc/sysctl.conf

    (and has been for a while?)

    But it should be possible to just add an entry in /etc/sysctl.conf and reboot and it to just work by default

    If it doesn't, then is it a bug?

    It really should not be a question of RTFM because manually running

    Code:
    sudo sysctl -p
    works



    Regards

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    28,112
    Blog Entries
    15

    Default Re: sysctl.conf still being ignored on boot

    Hi
    No softlink here, /etc/sysctl.conf is a file, it's better to use your own conf file in /etc/sysctl.d/, I use a 98-hostname.conf file and is used and read based on the output from;

    Code:
    sysctl --system
    
    
    net.ipv6.conf.all.disable_ipv6 = 1
    Not sure why it would be a softlink....

    Is the output from status ok?

    Code:
    systemctl status systemd-sysctl.service
    In openSUSE YaST network settings is where ipv6 can be disabled, which does touch /etc/sysctl.conf.
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  3. #3
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    13,322
    Blog Entries
    3

    Default Re: sysctl.conf still being ignored on boot

    Have you tried running:
    Code:
    mkinitrd
    The system is possibly using the version of "sysctl.conf" that is saved in the "initrd".
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  4. #4

    Default Re: sysctl.conf still being ignored on boot

    Quote Originally Posted by nrickert View Post
    Have you tried running:
    Code:
    mkinitrd
    The system is possibly using the version of "sysctl.conf" that is saved in the "initrd".
    Interesting

    I'll give that a go

    (although I've never had to do similar with any other distro, usually just editing the file and rebooting works, in debian (for example) you dont have to do "update-grub2" which rebuilds your initrd)

  5. #5

    Default Re: sysctl.conf still being ignored on boot

    Quote Originally Posted by iDominic42 View Post
    Interesting

    I'll give that a go

    (although I've never had to do similar with any other distro, usually just editing the file and rebooting works, in debian (for example) you dont have to do "update-grub2" which rebuilds your initrd)

    Nope

    Made no difference

    (as per the instructions in /etc/default/grub I ran

    Code:
    sudo grub2-mkconfig -o /boot/grub2/grub.cfg
    And rebooted

  6. #6

    Default Re: sysctl.conf still being ignored on boot

    Just to confirm that

    Code:
    /etc/sysctl.conf
    is a file

    Code:
    /usr/lib/sysctl.d/99-sysctl.conf
    is a link to

    Code:
    /etc/sysctl.conf
    And as I said, running

    Code:
    sudo sysctl -p
    loads the config that is in

    Code:
    /etc/sysctl.conf
    So I am trying to determine why /etc/systl.conf is not applied at boot

    Running

    Code:
    sudo systemctl status systemd-sysctl.service
    tells me

    Code:
    systemd-sysctl.service - Apply Kernel Variables
         Loaded: loaded (/usr/lib/systemd/system/systemd-sysctl.service; static; vendor preset: disabled)
        Drop-In: /usr/lib/systemd/system/systemd-sysctl.service.d
                 └─50-kernel-uname_r.conf
         Active: active (exited) since Mon 2020-03-16 19:19:11 GMT; 2h 54min ago
           Docs: man:systemd-sysctl.service(8)
                 man:sysctl.d(5)
       Main PID: 616 (code=exited, status=0/SUCCESS)
          Tasks: 0 (limit: 4915)
         Memory: 0B
         CGroup: /system.slice/systemd-sysctl.service
    So, is the problem

    "vendor preset: disabled"

    ?

    And how do I enable reading /etc/sysctl.conf


    It seems to be enabled by default in other (debian based eg mint, ubuntu debian) distros

    It just seems (to me) a bit strange that you should have to add an override to make your OS use the settings that are in /etc/sysctl.conf

    ie

    cat /etc/sysctl.conf
    Code:
    ####
    #
    # /etc/sysctl.conf is meant for local sysctl settings
    #
    # sysctl reads settings from the following locations:
    #   /boot/sysctl.conf-<kernelversion>
    #   /lib/sysctl.d/*.conf
    #   /usr/lib/sysctl.d/*.conf
    #   /usr/local/lib/sysctl.d/*.conf
    #   /etc/sysctl.d/*.conf
    #   /run/sysctl.d/*.conf
    #   /etc/sysctl.conf
    #
    # To disable or override a distribution provided file just place a
    # file with the same name in /etc/sysctl.d/
    #
    So it should read /etc/sysctl.conf

    and implement it?

    at boot?

  7. #7
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    28,112
    Blog Entries
    15

    Default Re: sysctl.conf still being ignored on boot

    Quote Originally Posted by iDominic42 View Post
    Just to confirm that

    Code:
    /etc/sysctl.conf
    is a file

    Code:
    /usr/lib/sysctl.d/99-sysctl.conf
    is a link to

    Code:
    /etc/sysctl.conf
    And as I said, running

    Code:
    sudo sysctl -p
    loads the config that is in

    Code:
    /etc/sysctl.conf
    So I am trying to determine why /etc/systl.conf is not applied at boot

    Running

    Code:
    sudo systemctl status systemd-sysctl.service
    tells me

    Code:
    systemd-sysctl.service - Apply Kernel Variables
         Loaded: loaded (/usr/lib/systemd/system/systemd-sysctl.service; static; vendor preset: disabled)
        Drop-In: /usr/lib/systemd/system/systemd-sysctl.service.d
                 └─50-kernel-uname_r.conf
         Active: active (exited) since Mon 2020-03-16 19:19:11 GMT; 2h 54min ago
           Docs: man:systemd-sysctl.service(8)
                 man:sysctl.d(5)
       Main PID: 616 (code=exited, status=0/SUCCESS)
          Tasks: 0 (limit: 4915)
         Memory: 0B
         CGroup: /system.slice/systemd-sysctl.service
    So, is the problem

    "vendor preset: disabled"

    ?

    And how do I enable reading /etc/sysctl.conf


    It seems to be enabled by default in other (debian based eg mint, ubuntu debian) distros

    It just seems (to me) a bit strange that you should have to add an override to make your OS use the settings that are in /etc/sysctl.conf

    ie

    cat /etc/sysctl.conf
    Code:
    ####
    #
    # /etc/sysctl.conf is meant for local sysctl settings
    #
    # sysctl reads settings from the following locations:
    #   /boot/sysctl.conf-<kernelversion>
    #   /lib/sysctl.d/*.conf
    #   /usr/lib/sysctl.d/*.conf
    #   /usr/local/lib/sysctl.d/*.conf
    #   /etc/sysctl.d/*.conf
    #   /run/sysctl.d/*.conf
    #   /etc/sysctl.conf
    #
    # To disable or override a distribution provided file just place a
    # file with the same name in /etc/sysctl.d/
    #
    So it should read /etc/sysctl.conf

    and implement it?

    at boot?
    Hi
    The reason is it may be over written on an update (well that may change since the move to /usr/etc on Tumbleweed), so do you see the files and settings in the output from;

    Code:
    sysctl --system
    No issues here with ipv6 disabled system wide.
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  8. #8
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    12,019
    Blog Entries
    2

    Default Re: sysctl.conf still being ignored on boot

    Reading through the posts in this thread...
    1. mkinitrd and everything related to that is irrelevant.
    Commands run that are in the sysctl files are applied late in the boot well after the kernel is put together completely (including loading kernel modules) whereas the initrd is the very first part of the kernel that is loaded.

    2. I don't see that the @OP has posted his /etc/sysctl.conf and the only one posted is the empty default file without his command. By design, and particularly if you implement the command you wish to run using a sysctl command (which in turn can be placed in a sysctl file) is designed to be run only if the command is valid so as not to bork your system if the command is faulty. I explain all this as part of a paper I wrote long ago that describes how this should be implemented... and I encourage you to invoke your command to disable IPv6 as I recommend in the paper and give you many examples

    https://sites.google.com/site/4techs...-buffer-values

    I'm also not aware that these files should be over-written during an upgrade but of course you should always make backups of anything that's important.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  9. #9

    Default Re: sysctl.conf still being ignored on boot

    The entry in /etc/sysctl.conf is this:

    Code:
    net.ipv6.conf.all.disable_ipv6 = 1
    This is - as far as I am aware - the normal way to disable ipv6 in linux

    You can apply it manually after putting that line in /etc/sysctl.conf by running

    Code:
    sudo sysctl -p
    This works, and running ip a afterwards shows that I do not have an ipv6 address

    However, it is not applied after a reboot.

    This is probably nothing to do with the problem I currently have - I suspect a DNS problem - however I am surprised that adding a perfectly valid setting to sysctl.conf is ignored at boot time


    So, why does tumbleweed ignore /etc/sysctl.conf at boot time?


    This may well not be the root cause of the issue I am experiencing, it's just that this is on a laptop that gets used at work and at home, and at work - with no ipv6 - I do not have delays opening web sites which I am thinking are to do with DNS lookups

    So I was simply looking to eliminate an obvious difference which is that at home my router gives me an ipv6 address, and I have an ipv6 nameserver in /etc/resolv.conf

    But ignore that

    This is about why settings in /etc/sysctl.conf are not applied on boot.in Tumbleweed but do work fine if manually run in


    Regards

  10. #10

    Default Re: sysctl.conf still being ignored on boot

    Quote Originally Posted by malcolmlewis View Post
    Hi
    The reason is it may be over written on an update (well that may change since the move to /usr/etc on Tumbleweed), so do you see the files and settings in the output from;

    Code:
    sysctl --system
    No issues here with ipv6 disabled system wide.
    Sorry. missed this

    Yes, it does look from running

    sudo sysctl --system

    that my config is there

    But just not applied
    I've just rebooted, and run that command and I can see

    Code:
    * Applying /etc/sysctl.d/99-sysctl.conf ...
    net.ipv6.conf.all.disable_ipv6 = 1
    But ip a shows that i have an ipv6 ip address until I manually run

    Code:
    sudo sysctl -p
    after which I don't have an ipv6 ip address

    So it looks as though boot reads the config, but ignores it?

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •