Bug 887017

Summary: sub-configs in '/etc/sysctl.d' not being loaded as expected
Product: [Fedora] Fedora Reporter: Nicholas Nachefski <nick>
Component: libvirtAssignee: Eric Blake <eblake>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 18CC: berrange, clalancette, crobinso, eblake, iarlyy, ipilcher, itamar, jforbes, johannbg, jonathan, jyang, laine, libvirt-maint, lnykryn, metherid, misc, msekleta, notting, plautrba, rebus, systemd-maint, trivial+rhbugzilla, veillard, virt-maint, vpavlin
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 892693 (view as bug list) Environment:
Last Closed: 2013-03-04 12:16:21 EST Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 892693    

Description Nicholas Nachefski 2012-12-13 15:28:37 EST
The sub-config files located in the folder '/etc/sysctl.d' are not being loaded on bootup.  See below for example.

<after bootup>

[root@desktop ~]# cat /etc/sysctl.d/libvirtd |grep -v ^#
fs.aio-max-nr = 1048576

[root@desktop ~]# cat /etc/sysctl.d/postgresql 

[root@desktop ~]# sysctl -a |grep fs.aio-max-nr
fs.aio-max-nr = 65536

[root@desktop ~]# sysctl -a |grep kernel.shmmax
kernel.shmmax = 33554432

As you can see, the values are not proper after the system boots.  If i manually set the values to the desired setting via the sysctl utility from the CLI, then all is well.

Version is Fedora 18 Beta with current patch level as of today (12/13/2012). see below for actually version number of initscripts....

[root@desktop ~]# rpm -qf /etc/sysctl.conf 
Comment 1 Bill Nottingham 2012-12-13 15:49:24 EST
See 'man sysctl.d' - files should end with '.conf'.
Comment 2 Nicholas Nachefski 2012-12-13 20:04:41 EST
Ah, yes... I guess i should file this under the *libvirt-daemon* package then.  The libvirtd file under the /etc/sysctl.d directory (in the libvirt-daemon pacakge) does not have the .conf extension and it's settings are not being applied.

# rpm -qf /etc/sysctl.d/libvirtd

# cat /etc/sysctl.d/libvirtd |grep -v ^#
fs.aio-max-nr = 1048576

Comment 3 Eric Blake 2012-12-16 00:21:58 EST
Reading that man page, it sounds like libvirt should be installing into /usr/lib/sysctl.d/libvirt.conf, not /etc/sysctl.d/ - so it is more than just a wrong suffix, but a wrong location.
Comment 4 Bill Nottingham 2012-12-17 14:26:29 EST
/etc will work, but /usr/lib/sysctl.d is preferred for system-distributed configurations.
Comment 5 Nicholas Nachefski 2012-12-18 13:55:37 EST
I guess that just leaves the matter of adding the proper '.conf' suffix to the file then.
Comment 6 Eric Blake 2013-01-04 16:05:36 EST
In the spec file, how does one guarantee that the file will be installed into /usr/lib/sysctl.d, even when %{_libdir} is /usr/lib64?
Comment 7 Kay Sievers 2013-01-04 16:14:48 EST
/usr/lib/<pkgname>/ has nothing to do with %{_libdir} or multi-lib.
It is always:
and treated as the "application private directory" which is the same
for all architectures and systems.

%{_libdir} is for shared libraries and almost nothing else.
Comment 8 Eric Blake 2013-01-04 17:37:27 EST
Upstream patch proposed:
Comment 9 Eric Blake 2013-01-07 11:10:39 EST
This commit addresses the bug, and the three commits beforehand are probably also worth pulling into F18.  I'll go ahead and do the backport work for the v0.10.2-maint branch.

commit a1fd56cb3057c45cffbf5d41eaf70a26d2116b20
Author: Eric Blake <eblake@redhat.com>
Date:   Fri Jan 4 14:21:59 2013 -0700

    build: install libvirt sysctl file correctly
    https://bugzilla.redhat.com/show_bug.cgi?id=887017 reports that
    even though libvirt attempts to set fs.aio-max-nr via sysctl,
    the file was installed with the wrong name and gets ignored by
    sysctl.  Furthermore, 'man systcl.d' recommends that packages
    install into hard-coded /usr/lib/sysctl.d (even when libdir is
    /usr/lib64), so that sysadmins can use /etc/sysctl.d for overrides.
    * daemon/Makefile.am (install-sysctl, uninstall-sysctl): Use
    correct location.
    * libvirt.spec.in (network_files): Reflect this.
Comment 10 Eric Blake 2013-01-16 14:43:42 EST
*** Bug 896149 has been marked as a duplicate of this bug. ***
Comment 11 Eric Blake 2013-01-22 08:29:11 EST
*** Bug 902552 has been marked as a duplicate of this bug. ***
Comment 12 Fedora Update System 2013-01-28 15:46:10 EST
libvirt- has been submitted as an update for Fedora 18.
Comment 13 Michal Ambroz 2013-01-31 06:15:40 EST
I can confirm issue is fixed in libvirt-daemon-
File is /usr/lib/sysctl.d/libvirtd.conf and gets successfully processed by systemd-sysctl.service

# systemctl restart systemd-sysctl.service 
# sysctl -a|grep fs.aio
fs.aio-max-nr = 1048576
fs.aio-nr = 0
Comment 14 Fedora Update System 2013-02-05 11:53:10 EST
libvirt- has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.