FS#58899 - [systemd] sysctl hook doesn't load /etc/sysctl.d entries
Attached to Project:
Arch Linux
Opened by Rob Hoelz (hoelzro) - Wednesday, 06 June 2018, 21:59 GMT
Last edited by Christian Hesse (eworm) - Tuesday, 12 June 2018, 20:30 GMT
Opened by Rob Hoelz (hoelzro) - Wednesday, 06 June 2018, 21:59 GMT
Last edited by Christian Hesse (eworm) - Tuesday, 12 June 2018, 20:30 GMT
|
Details
Description:
There is a post-install and post-upgrade hook in the systemd package that loads sysctl.d conf files from /usr/lib; this hook does not load .conf files from under /etc/sysctl.d, though. This means that sysctls set in systemd that are explicitly overridden by the user (eg. kernel.sysrq) are reset to systemd's values. I don't know if this was a deliberate choice made by the systemd package maintainer; it's just something that bit me today and I wanted to bring their attention to it. If the choice was indeed deliberate, I can always write my own alpm hook to work around this. Additional info: * systemd version: 238.133-1 Steps to reproduce: * override kernel.sysrq in an /etc/sysctl.d file to a value other than 16 * reboot to make sure the settings take effect * verify that kernel.sysrq's value reflects the overridden value under /etc/sysctl.d * update the systemd package * sysctl -a will show kernel.sysrq is set to 16, which is systemd's default |
This task depends upon
Closed by Christian Hesse (eworm)
Tuesday, 12 June 2018, 20:30 GMT
Reason for closing: Fixed
Additional comments about closing: systemd 238.133-4
Tuesday, 12 June 2018, 20:30 GMT
Reason for closing: Fixed
Additional comments about closing: systemd 238.133-4
* Downloaded the latest Arch Linux ISO (2018.06.01)
* Installed Arch in a VM
* Ran "sysctl -a | grep sysrq" - output was "kernel.sysrq = 16"
* Created "/etc/sysctl.d/90-override.conf" with the content "kernel.sysrq = 1"
* Rebooted
* Ran "sysctl -a | grep sysrq" again - output was "kernel.sysrq = 1" this time
* Manually reinstalled systemd via "pacman -S systemd"
* Ran "sysctl -a | grep sysrq" - output was "kernel.sysrq = 16" again
I think it can be fixed by removing 'each_conf' from https://git.archlinux.org/svntogit/packages.git/tree/trunk/systemd-hook?h=packages/systemd#n33 . This way it will invoke 'systemd-sysctl' without specific file arguments thus it will honor /etc/sysctl.d/ settings.
The same problem probably occurs with tmpfiles.d and sysusers.d.
The each_conf function calls the executable with the basename of config file. So overwriting 50-default.conf with file with identical name works, overwriting values from a file with different name does not.
Running systemd-sysctl without arguments should fix this, it is run at boot anyway. (Same for the other cases, though we do not have an issue there I think.)