Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 474028 - /etc/sysctl.conf or files in /etc/sysctl.d not processed
Summary: /etc/sysctl.conf or files in /etc/sysctl.d not processed
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-21 10:35 UTC by Darko Luketic
Modified: 2014-09-12 17:16 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emergeinfo,6.99 KB, text/plain)
2013-06-21 17:01 UTC, Darko Luketic
Details
emerge --info 2nd pc (emergeinfo,6.42 KB, text/plain)
2013-06-21 17:21 UTC, Darko Luketic
Details
log (log,4.40 KB, text/plain)
2013-06-22 20:37 UTC, Darko Luketic
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Darko Luketic 2013-06-21 10:35:39 UTC
the mentioned files are not being processed or setting are not applied.
I don't know which package it belongs to

Reproducible: Always

Steps to Reproduce:
1. write net.ipv6.conf.all.use_tempaddr = 2 in /etc/sysctl.conf or /etc/sysctl.d/local.conf
2. reboot
3. cat /proc/sys/net/ipv6/conf/all/use_tempaddr
0



Expected Results:  
2

kernel features are enabled
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2013-06-21 13:11:37 UTC
Please post your `emerge --info' output in a comment.
Comment 2 Darko Luketic 2013-06-21 17:01:21 UTC
Created attachment 351574 [details]
emerge --info
Comment 3 Darko Luketic 2013-06-21 17:21:01 UTC
Created attachment 351578 [details]
emerge --info 2nd pc
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2013-06-22 14:26:59 UTC
Could you investigate this further? Is sysctl simply not being run at startup? If so, does sysctl succeed when you run:
 sysctl net.ipv6.conf.all.use_tempaddr=2
in a shell?
Comment 5 Darko Luketic 2013-06-22 14:36:18 UTC
(In reply to Jeroen Roovers from comment #4)
> Could you investigate this further? Is sysctl simply not being run at
> startup? If so, does sysctl succeed when you run:
>  sysctl net.ipv6.conf.all.use_tempaddr=2
> in a shell?

Yes it succeeds and works next time I boot (on both PCs) but is reset to 0 on the boot that follows

reading rc.log
it seems that it isn't ran
however
               sysctl | boot                         

rc boot logging started at Sat Jun 22 01:11:38 2013

 * Setting system clock using the hardware clock [UTC] ...
hwclock: Cannot access the Hardware Clock via any known method.
hwclock: Use the --debug option to see the details of our search for an access method.
 * Failed to set the system clock
 [ !! ]
 * Autoloaded 0 module(s)
 * Setting up the Logical Volume Manager ...
  No volume groups found
  No volume groups found
  No volume groups found
 [ ok ]
 * Checking local filesystems  ...
/dev/sdb1: clean, 495694/29483008 files, 5309136/117902848 blocks
 [ ok ]
 * Remounting root filesystem read/write ...
 [ ok ]
 * Remounting filesystems ...
 [ ok ]
 * Updating /etc/mtab ...
 [ ok ]
 * Activating swap devices ...
 [ ok ]
 * Mounting local filesystems ...
 [ ok ]
 * Configuring kernel parameters ...
 [ ok ]
 * Starting ZFS ...
 * Checking if zfs userspace tools present
 * Importing ZFS pools
 * Mounting ZFS filesystems
 * Exporting ZFS filesystems
 [ ok ]
 * Creating user login records ...
 [ ok ]
 * Cleaning /var/run ...
 [ ok ]
 * Wiping /tmp directory ...
 [ ok ]
 * Setting hostname to server ...
 [ ok ]
 * Setting terminal encoding [UTF-8] ...
 [ ok ]
 * Setting keyboard mode [UTF-8] ...
 [ ok ]
 * Loading key mappings [de] ...
 [ ok ]
 * Bringing up interface lo
 *   127.0.0.1/8 ...
 [ ok ]
 *   Adding routes
 *     127.0.0.0/8 via 127.0.0.1 ...
 [ ok ]
 * Bringing up interface enp5s0
 *   Changing MAC address of enp5s0 ...
 [ ok ]
 *     changed to xx:xx:xx:xx:xx:xx
 *   xxxx:xxxx:xxxx:xxxx::2/64 ...
 [ ok ]
 *   192.168.178.2/24 ...
 [ ok ]
 *   Adding routes
 *     default via 192.168.178.1 ...
 [ ok ]
 *     default via fe80::0 ...
 [ ok ]
 * Activating additional swap space ...
 [ ok ]
 * setting up tmpfiles.d entries ...
 [ ok ]
 * Initializing random number generator ...
 [ ok ]

rc boot logging stopped at Sat Jun 22 01:11:42 2013
Comment 6 Alexander Vershilov (RETIRED) gentoo-dev 2013-06-22 20:25:21 UTC
> * Configuring kernel parameters ...
> [ ok ]

means that sysctl service have runned, it should apply sysctl -p to every readable file.

1). can you run
sysctl -p /etc/sysctl.conf

or /etc/sysctl/local.conf to check if values are applied by sysctl.
If they are applied

2).can you run:

  /etc/init.d/sysctl zap # clean up real sysctl state
  /etc/init.d/sysctl -d start 2&> log # start sysctl once again 

and paste file log here.

Thanks.
Comment 7 Darko Luketic 2013-06-22 20:37:55 UTC
Created attachment 351674 [details]
log
Comment 8 Alexander Vershilov (RETIRED) gentoo-dev 2013-06-22 21:07:13 UTC
(In reply to Darko Luketic from comment #7)
> Created attachment 351674 [details]
> log

Thanks. Strange according to logs all conf files are applied without errors.

++ sysctl -p /etc/sysctl.conf
...
++ sysctl -p /etc/sysctl.d/local.conf


It seems for me that some other script overrides this settings. It will need some more investigation.
Comment 9 Darko Luketic 2013-06-22 21:41:55 UTC
thank you too.

             bootmisc | boot                         
                 fsck | boot                         
             hostname | boot                         
              hwclock | boot                         
              keymaps | boot                         
           localmount | boot                         
                  lvm | boot                         
               mcelog | boot                         
              modules | boot                         
                 mtab | boot                         
               net.lo | boot                         
               procfs | boot                         
                 root | boot                         
                 swap | boot                         
            swapfiles | boot                         
               sysctl | boot                         
         termencoding | boot                         
       tmpfiles.setup | boot                         
              urandom | boot                         
                  zfs | boot        
            alsasound |      default                 
                 dbus |      default                 
              distccd |      default                 
           lm_sensors |      default                 
                local |      default                 
              metalog |      default                 
           net.enp6s0 |      default                 
             netmount |      default                 
                  nfs |      default                 
                nginx |      default                 
                 ntpd |      default                 
              preload |      default                 
               smartd |      default                 
                 sshd |      default                 
                uwsgi |      default                 
           vixie-cron |      default                 
                  xdm |      default            
            killprocs |              shutdown        
             mount-ro |              shutdown        
            savecache |              shutdown        
                devfs |                       sysinit
                dmesg |                       sysinit
                sysfs |                       sysinit
                 udev |                       sysinit
           udev-mount |                       sysinit

I've also searched Google and it seems like others also have this problem, at least I saw some posts on the forum without a real solution, only workarounds.
/etc/local.d/ is empty except for the README.

Maybe it has something to do with sysfs

my fstab, do I need to mount /proc and so on in there?

/dev/sdc2               /boot                   ext2            noauto,noatime                          0 2
/dev/sda6               /                       ext4            defaults,noatime                        0 1
/dev/sdc1               /boot/efi               vfat            noauto,noatime                          0 0
/dev/sdc3               none                    swap            sw                                      0 0
tosh/var                /var                    zfs             defaults                                0 0
/dev/cdrom              /mnt/cdrom              auto            noauto,user                             0 0
tmpfs                   /tmp                    tmpfs           nosuid                                  0 0
vartmpfs                /var/tmp/portage        tmpfs           uid=250,gid=250,mode=0775               0 0
#server:/storage        /home/darko/srv         nfs     _netdev,defaults,user,auto,noatime,intr,rw      0 0
192.168.178.2:/usr/portage      /usr/portage    nfs     _netdev,defaults,auto,noatime,intr,rw   0 0
192.168.178.2:/usr/local/portage        /usr/local/portage      nfs     _netdev,defaults,auto,noatime,intr,rw   0 0
Comment 10 Alexander Vershilov (RETIRED) gentoo-dev 2013-06-24 09:16:46 UTC
Currently I don't see a reason for such behaviour. I'll try to configure my system on the week to check your problem more precisely, (as I have use_tempaddr=2 as a default value, and I have no real ipv6 interfaces to test). 

Currently you can try to make next steps:

1). add debug logging to sysctl script itself, i.e. smth like: in the end of the start() function in /etc/init,d/sysctl

  echo "after sysctl" >> /var/log/findsysctlbug
  cat /proc/sys/net/ipv6/conf/all/use_tempaddr  >> /var/log/findsysctlbug

and check whether the value was really set, if no then we need to search problem in sysctl itself, or in load order.

2). add you sysctl service to local one:

  echo "sysctl -p /etc/sysctl.conf" >> /etc/local.d/mysysctl.start

  and possibly add debug script.

This will gave an answer if problem may be related to load order.

Sorry, that I'm not able to do in myself now, I'll try to do it as soon as it will be possible. And maybe other part of our team have more ideas how to track this problem.
Comment 11 Darko Luketic 2013-06-25 03:55:38 UTC
ok... here goes...

it's not related to ipv6 only
the ipv6 problem with sysctl is solved by adding the ipv6 module to /etc/conf.d/modules

co-incidently distcc refused to start because 
DISTCCD_OPTS="${DISTCCD_OPTS} --listen 192.168.178.20"
was set
although an ipv4 lease was acquired (but I guess the iface wasn't up so fast)
removing the config option "solved" this as it's now listening on 0.0.0.0, which might or might not be the desired behaviour.

vm.swappiness=10
vm.dirty_background_ratio=50
vm.dirty_ratio=80
is still affected

sysctl vars are set with the init script
80

but are reverted to some default value
10

however only on the desktop. it works on the server
differences are, a different kernel, different hardware, server does not have cinnamon running or xdm or lightdm or preload or a pre-emptive kernel, has a static ipv4 and ipv6.

I didn't try 2.) yet
Comment 12 Darko Luketic 2013-06-25 04:06:24 UTC
correction

vm.swappiness is set but
vm.dirty_background_ratio=50
vm.dirty_ratio=80
aren't
Comment 13 Alexander Vershilov (RETIRED) gentoo-dev 2013-06-27 10:12:18 UTC
I've tested on a fresh system and vm.swappiness, vm.dirty_background_ratio, vm.dirty_ratio worked for me.

If you want I can try to prepare additional log scripts in order to track changes in verify that options are really set, and track when they are changed.
Comment 14 Darko Luketic 2013-06-28 12:54:28 UTC
ok, but I can't promise a timely response, lots of stuff to do right now I'll squeeze it in where I can.

So go ahead :)
Comment 15 Hank Leininger 2013-08-26 19:07:05 UTC
I suspect the problem is that sysctl can't load/modify parameters for modules that aren't loaded yet (and/or they'll get stomped on when the module does load).  I'm looking at the same thing now with conntrack tweaks.

This seems to be a common problem.  The Gentoo sysctl(8) man page doesn't mention it, but see for example this version of sysctl.8:

http://linux.die.net/man/8/sysctl

And some bugs for other distros:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=507788

https://bugs.launchpad.net/ubuntu/+source/procps/+bug/50093

The workarounds I've seen proposed include:

- Make sure all modules whose sysctl's you plan to tweak are already loaded; in our case that means explicitly listing them in /etc/conf.d/modules

- put off running the sysctl init.d service later (possible security downsides)

- load sysctl.conf again later, in /etc/local.d/ or similar (ugly)

- arrange for modules to get autoloaded if their /proc/sys files don't exist (ugly, complex, and ugly)
Comment 16 William Hubbs gentoo-dev 2014-09-12 17:15:32 UTC
(In reply to Hank Leininger from comment #15)
> I suspect the problem is that sysctl can't load/modify parameters for
> modules that aren't loaded yet (and/or they'll get stomped on when the
> module does load).  I'm looking at the same thing now with conntrack tweaks.
> 
> This seems to be a common problem.  The Gentoo sysctl(8) man page doesn't
> mention it, but see for example this version of sysctl.8:
> 
> http://linux.die.net/man/8/sysctl
> 
> And some bugs for other distros:
> 
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=507788
> 
> https://bugs.launchpad.net/ubuntu/+source/procps/+bug/50093
> 
> The workarounds I've seen proposed include:
> 
> - Make sure all modules whose sysctl's you plan to tweak are already loaded;
> in our case that means explicitly listing them in /etc/conf.d/modules

This is the cleanest way to handle this, so it isn't a bug in OpenRC, just make sure that you list all of the modules you need in /etc/conf.d/modules or build these modules into the kernel.