Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 386017 - sysctl init.d loads, but kdm resets those later on
Summary: sysctl init.d loads, but kdm resets those later on
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal major (vote)
Assignee: OpenRC Team
URL: https://bugs.kde.org/show_bug.cgi?id=...
Whiteboard:
Keywords:
: 452630 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-10-07 08:45 UTC by dE
Modified: 2013-04-13 16:22 UTC (History)
1 user (show)

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


Attachments
sysctl strace (log,5.80 KB, text/plain)
2011-10-10 12:36 UTC, dE
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dE 2011-10-07 08:45:18 UTC
I've set some custom parameters in /etc/sysctl.conf which doesn't get read by sysctl on boot despite sysctl service available on the boot runlevel, I even tried addng it to the default runlevel.

Parameters get read when restarting the service manually. However adding /etc/init.d/sysctl restart to the local startup script doesn't work.

Reproducible: Always
Comment 1 SpanKY gentoo-dev 2011-10-07 14:55:09 UTC
always post `emerge --info` with all your bug reports

run `/etc/init.d/sysctl --debug restart >& log` and post the log as an attachment

post your /etc/sysctl.conf file as well
Comment 2 dE 2011-10-07 15:52:05 UTC
That's the problem, if service is restarted manually it works. I'll try this in the local.d/* files.

sysctl.conf - 
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
vm.swappiness=60
vm.dirty_background_ratio=5
vm.dirty_ratio=3
vm.dirty_expire_centisecs=500

Portage 2.2.0_alpha53 (default/linux/amd64/10.0/desktop/kde, gcc-4.5.3, glibc-2.12.2-r0, 3.0.4 x86_64)
=================================================================
System uname: Linux-3.0.4-x86_64-AMD_Athlon-tm-_64_X2_Dual-Core_Processor_TK-55-with-gentoo-2.0.3
Timestamp of tree: Thu, 01 Sep 2011 11:00:01 +0000
app-shells/bash:      4.1_p9
dev-java/java-config: 2.1.11-r3
dev-lang/python:      2.7.1-r1, 3.1.3-r1
dev-util/cmake:       2.8.4-r1
dev-util/pkgconfig:   0.26
sys-apps/baselayout:  2.0.3
sys-apps/openrc:      0.8.3-r1
sys-apps/sandbox:     2.4
sys-devel/autoconf:   2.13, 2.68
sys-devel/automake:   1.11.1
sys-devel/binutils:   2.21.1-r1
sys-devel/gcc:        4.5.3-r1
sys-devel/gcc-config: 1.4.1-r1
sys-devel/libtool:    2.4-r1
sys-devel/make:       3.82-r1
sys-libs/glibc:       2.12.2
Repositories: gentoo sunrise proaudio x11 mozilla sardemff7 my-tree
Installed sets: 
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -fomit-frame-pointer -floop-interchange -floop-strip-mine -floop-block -fgraphite-identity"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -fomit-frame-pointer -floop-interchange -floop-strip-mine -floop-block -fgraphite-identity"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=n --complete-graph --binpkg-respect-use=y"
FEATURES="assume-digests binpkg-logs candy distlocks ebuild-locks fixlafiles fixpackages news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/sunrise /var/lib/layman/pro-audio /var/lib/layman/x11 /var/lib/layman/mozilla /var/lib/layman/sardemff7 /home/de/dev-tree"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow X a52 a53 aac aalib acc acpi adns alsa amd64 amr atm audiofile branding bzip2 cdda cdr cli consolekit cracklib css cups custom-cflags custom-optimization dbus dbx declarative dga dirac dri dts dv dvd dvdr emboss encode enscript exif ffmpeg firefox flac fortran gdu gif glut gmp gsm gstreamer gzip iconv icu imlib ipc jpeg jpeg2k kde ladspa lame lcms libedit libnotify libsamplerate libwww lzma lzo mad matroska matrox mikmod mime minimal mmap mmx mng modules mozilla mp3 mp4 mpeg mplayer mudflap multilib musepack networkmanager nntp nocd nptl nptlonly nsplugin offensive ogg openal openexr opengl openmp optimization osc pam pango pch pdf phonon plasma png policykit posix ppds pppd qt3support qt4 quicktime raw readline schroedinger sharedmem shorten smp sndfile sockets socks5 speex spell sse sse2 startup-notification strong-optimization svg symlink sysfs taglib tcpd theora threads tiff toolame truetype twolame udev unicode usb vcd vhosts vorbis wavpack wmf x264 xcb xcomposite xine xinerama xml xorg xpm xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeon r300 r600" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-10-07 20:13:04 UTC
Can you enable logging in rc.conf and attach that from a boot as well please?
Comment 4 dE 2011-10-08 05:34:14 UTC
The problem appears to be more fundamental, setting sysctl -p in local.d scripts does not change the kernel parameter, although there's output from sysctl on tty0 that is has set the parameter.
Comment 5 SpanKY gentoo-dev 2011-10-08 18:42:19 UTC
run it through strace:
  strace -o /tmp/log sysctl ...
Comment 6 dE 2011-10-10 12:36:34 UTC
Created attachment 289443 [details]
sysctl strace
Comment 7 SpanKY gentoo-dev 2011-10-10 18:35:01 UTC
looks to me like sysctl worked.  are you saying that after that, your sysctl settings did not get updated ?

i need to see the strace of a failed sysctl run ...

...
open("/proc/sys/net/ipv4/conf/all/rp_filter", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb998aa8000
write(4, "1\n", 2)                      = 2
close(4)                                = 0
munmap(0x7fb998aa8000, 4096)            = 0
write(1, "net.ipv4.conf.all.rp_filter = 1\n", 32) = 32
...
Comment 8 dE 2011-10-11 05:50:22 UTC
This trace was generated from the failed sysctl -p which didn't change kernel parameters.

Right now after it's run in from local init scripts, the parameters remain the same - 

sysctl vm.dirty_ratio
vm.dirty_ratio = 10

I had set it to 5.

You might like to have a look at the various runlevels - 


       NetworkManager |      default                                  
             bootmisc | boot                                          
          consolefont | boot                                          
           consolekit |      default                                  
                devfs |                                        sysinit
                dmesg |                                        sysinit
                 fsck | boot                                          
             hostname | boot                                          
              hwclock | boot                                          
              keymaps | boot                                          
            killprocs |                        shutdown               
                local |      default nonetwork                        
           localmount | boot                                          
             mount-ro |                        shutdown               
                 mtab | boot                                          
               procfs | boot                                          
                 root | boot                                          
            savecache |                        shutdown               
                 swap | boot                                          
               sysctl | boot                                          
         termencoding | boot                                          
                 udev |                                        sysinit
       udev-postmount |      default                                  
              urandom | boot
Comment 9 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-10-11 05:53:44 UTC
Ok, if this sequence shows that the sysctl variable is not changing, that's something wrong with your kernel, NOT openrc.

# sysctl -w vm.dirty_ratio=5
# sysctl vm.dirty_ratio
# sysctl -w vm.dirty_ratio=10
# sysctl vm.dirty_ratio
Comment 10 dE 2011-10-11 13:23:03 UTC
Yes, it works - 

sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
vm.swappiness = 60
vm.dirty_background_ratio = 5
vm.dirty_ratio = 3
vm.dirty_expire_centisecs = 500

These are not the defaults.

For your e.g. - 

OLD_BROKEN_LAP de # sysctl -w vm.dirty_ratio=5
vm.dirty_ratio = 5
OLD_BROKEN_LAP de # sysctl vm.dirty_ratio
vm.dirty_ratio = 5
OLD_BROKEN_LAP de # sysctl -w vm.dirty_ratio=10
vm.dirty_ratio = 10
OLD_BROKEN_LAP de # sysctl vm.dirty_ratio
vm.dirty_ratio = 10                                                                             
OLD_BROKEN_LAP de # sysctl -p                                                                   
net.ipv4.ip_forward = 0                                                                         
net.ipv4.conf.default.rp_filter = 1                                                             
net.ipv4.conf.all.rp_filter = 1                                                                 
vm.swappiness = 60                                                                              
vm.dirty_background_ratio = 5                                                                   
vm.dirty_ratio = 3
vm.dirty_expire_centisecs = 500
OLD_BROKEN_LAP de # sysctl vm.dirty_ratio
vm.dirty_ratio = 3
Comment 11 SpanKY gentoo-dev 2011-10-11 15:16:36 UTC
your strace shows that it's working fine, and it shows that you set it to "3", not "5".

open("/proc/sys/vm/dirty_ratio", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb998aa8000
write(4, "3\n", 2)                      = 2
close(4)                                = 0
munmap(0x7fb998aa8000, 4096)            = 0
write(1, "vm.dirty_ratio = 3\n", 19)    = 19

do *all* of the sysctl knobs that you tweak from the default fail to keep their value ?  or is it only some ?  maybe something else on your system is changing the values after sysctl runs ?
Comment 12 dE 2011-10-29 13:21:54 UTC
This's a kdm issue. When a user logs in, it resets the kernel parameters to defaults.
Comment 13 Andreas K. Hüttel archtester gentoo-dev 2011-10-30 23:46:26 UTC
(In reply to comment #12)
> This's a kdm issue. When a user logs in, it resets the kernel parameters to
> defaults.

https://bugs.kde.org/show_bug.cgi?id=285254

Well upstream says no... 

The only thing that could go that far into kernel settings imho would be graphics drivers.
Comment 14 dE 2011-10-31 00:39:22 UTC
I'm gonna try this out on other distros.
Comment 15 SpanKY gentoo-dev 2013-04-03 16:49:41 UTC
*** Bug 452630 has been marked as a duplicate of this bug. ***
Comment 16 dE 2013-04-13 16:22:26 UTC
But I filed those bugs, and they got closed.

Anyway, if I'm the only one facing this problem, then no use reopening. I've the workarounds.