Systemd-sysctl Not Running On Boot
Hey all,
After upgrading to CentOS 7.2, non of my servers run systemd-sysctl on boot. So far, I tried running manually /usr/lib/systemd/systemd-sysctl, it runs smoothly and updates all the parameters. I also ran sysctl –system, which also executes successfully.
I checked within systemd, and systemd-sysctl is wanted by the sysinit.target which is wanted by the multi-user.target – the one I boot into.
I can’t find anything by doing journalctl | grep sysctl Or by looking through /var/log/messages (I run rsyslog as well).
Any idea’s ?
Thanks
10 thoughts on - Systemd-sysctl Not Running On Boot
Works here…
# systemctl status systemd-sysctl
● systemd-sysctl.service – Apply Kernel Variables
Loaded: loaded (/usr/lib/systemd/system/systemd-sysctl.service;
static; vendor preset: disabled)
Active: active (exited) since Wed 2015-12-16 20:19:10 PST; 6 days ago
Docs: man:systemd-sysctl.service(8)
man:sysctl.d(5)
Process: 652 ExecStart=/usr/lib/systemd/systemd-sysctl (code=exited, status=0/SUCCESS)
Main PID: 652 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/systemd-sysctl.service
You are correct, I’ll refine my problem,
By running “systemctl status systemd-sysctl” I also receive the same output, but a simple “cat /proc/sys/vm/swappiness” returns the default value, and not the one set by my conf file. But, if I run “/usr/lib/systemd/systemd-sysctl” the “cat
/proc/sys/vm/swappiness” does return the correct value.
Any idea ?
Does this happen to anyone else ?
CentOS mailing list CentOS@CentOS.org https://lists.CentOS.org/mailman/listinfo/CentOS
All of mine, as set by files in /etc/sysctl.d/, are correct after boot.
Where is your conf file?
also in /etc/sysctl.d/
Added some info from the my system:
[root@web-devel-local-1 ~]# uname -a Linux web-devel-local-1.in.parkam-ip.com 3.10.0-327.3.1.el7.x86_64 #1 SMP
Wed Dec 9 14:09:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@web-devel-local-1 ~]# cat /etc/sysctl.d/sysctl.conf.conf file
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an
/etc/sysctl.d/
#
# For more information, see sysctl.conf(5) and sysctl.d(5). net.ipv4.ip_forward = 0
kernel.panic = 20
kernel.sem = 250 65000 32 256
vm.swappiness = 10
net.ipv4.conf.all.log_martians = 1
kernel.dmesg_restrict = 1
vm.dirty_ratio = 15
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv4.tcp_syncookies = 1
net.ipv6.conf.all.disable_ipv6 = 1
kernel.kptr_restrict = 1
[root@web-devel-local-1 ~]# systemctl status systemd-sysctl
● systemd-sysctl.service – Apply Kernel Variables
Loaded: loaded (/usr/lib/systemd/system/systemd-sysctl.service; static;
vendor preset: disabled)
Active: active (exited) since Thu 2015-12-24 09:05:15 IST; 3min 8s ago
Docs: man:systemd-sysctl.service(8)
man:sysctl.d(5)
Process: 488 ExecStart=/usr/lib/systemd/systemd-sysctl (code=exited, status=0/SUCCESS)
Main PID: 488 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/systemd-sysctl.service
Dec 24 09:05:14 web-devel-local-1.in.parkam-ip.com systemd[1]: Starting Apply Kernel Variables… Dec 24 09:05:15 web-devel-local-1.in.parkam-ip.com systemd[1]: Started Apply Kernel Variables.
[root@web-devel-local-1 ~]# reboot
[root@web-devel-local-1 ~]# cat /proc/sys/vm/swappiness
30
[root@web-devel-local-1 ~]# /usr/lib/systemd/systemd-sysctl
[root@web-devel-local-1 ~]# cat /proc/sys/vm/swappiness
10
[root@web-devel-local-1 ~]# cat
/usr/lib/systemd/system/systemd-sysctl.service
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Apply Kernel Variables Documentation=man:systemd-sysctl.service(8) man:sysctl.d(5)
DefaultDependencies=no Conflicts=shutdown.target After=systemd-readahead-collect.service systemd-readahead-replay.service After=systemd-modules-load.service Before=sysinit.target shutdown.target ConditionPathIsReadWrite=/proc/sys/
[Service]
Type=oneshot RemainAfterExit=yes ExecStart=/usr/lib/systemd/systemd-sysctl
CentOS mailing list CentOS@CentOS.org https://lists.CentOS.org/mailman/listinfo/CentOS
So… you know that it works when you run it from a root shell, but not during boot. Is the file labeled properly? Anything in audit.log?
I don’t see anything related in the audit log (I’m using audit2why).
As for labeling:
[root@web-devel-local-1 ~]# ll -Z /etc/ | grep sysctl drwxr-xr-x. root root system_u:object_r:etc_t:s0 sysctl.d
[root@web-devel-local-1 ~]# ll -Z /etc/sysctl.d/
-rw-r–r–. root root unconfined_u:object_r:system_conf_t:s0 sysctl.conf
—– Mail original —–
Is there a relationship with the new symlink created by the upgrade in my servers ?
# ls -l /etc/sysctl.d/
total 0
lrwxrwxrwx. 1 root root 14 23 déc. 18:11 99-sysctl.conf -> ../sysctl.conf
# yum provides /etc/sysctl.d/99-sysctl.conf initscripts-9.49.30-1.el7.x86_64 : The inittab file and the /etc/init.d scripts Dépôt : base Correspondance depuis :
Nom de fichier : /etc/sysctl.d/99-sysctl.conf
Sylvain. Pensez ENVIRONNEMENT : n’imprimer que si ncessaire
I dont see any reason this will have anything to do with the issue. In any case, i re-installed the package, had the symlink, moved my definitions to sysctl.conf. still the same….
CentOS mailing list CentOS@CentOS.org https://lists.CentOS.org/mailman/listinfo/CentOS
Baffling. I can’t recreate this problem.
If you’re interested in debugging further:
# cp /usr/lib/systemd/system/systemd-sysctl.service /etc/systemd/system/
# vi /etc/systemd/system/systemd-sysctl.service
replaced the ExecStart line with:
ExecStart=/bin/strace -f -e trace=file -o /var/tmp/sysctl.trace
/usr/lib/systemd/systemd-sysctl
# reboot
/var/tmp/sysctl.trace should tell you whether or not the files are being opened. Beyond that, my only guess would be that some other service is restoring the defaults, but I have no idea what might do that.