You are not logged in.

#1 2013-09-19 10:18:16

amatriain
Member
Registered: 2011-06-02
Posts: 50

wrong defaults for sysctl -p since upgrade to systemd 207?

I've run into this when trying to increase the inotify watches limit following these instructions.

Since upgrading systemd to version 207 sysctl.conf no longer exists, so instead I've put the following line in /etc/sysctl.d/99-sysctl.conf:

fs.inotify.max_user_watches = 524288

But when running "sudo sysctl -p" I get the following message:

$ sudo sysctl -p
sysctl: cannot open "/etc/sysctl.conf": No such file or directory

This is because according to the man page for sysctl:

       -p[FILE], --load[=FILE]
              Load   in   sysctl   settings  from  the  file  specified  or
              /etc/sysctl.conf if none given.

So, "sysctl -p" by default looks for the sysctl.conf file, which no longer exists in up-to-date arch boxes.

The solution of course is simply running:

sudo sysctl -p /etc/sysctl.d/99-sysctl.conf

But my question is, shouldn't "sysctl -p" look for settings files in /etc/sysctl.d and run all of them by default, instead of looking for a file which does not exist? (and that, even if it exists, will not be run on startup). From my understanding, "sysctl -p" is supposed to apply by default the same settings that will be applied on the next reboot.

Offline

#2 2013-09-19 10:34:46

kaszak696
Member
Registered: 2009-05-26
Posts: 543

Re: wrong defaults for sysctl -p since upgrade to systemd 207?

You can preview current sysctl settings through /proc, for example if you want to know the setting you shown:

 cat /proc/sys/fs/inotify/max_user_watches 

As for sysctl program, you should probably file a bug to procps-ng devs.

EDIT: I found --system option in sysctl man, does that do the trick?

Last edited by kaszak696 (2013-09-19 10:36:11)


'What can be asserted without evidence can also be dismissed without evidence.' - Christopher Hitchens
'There's no such thing as addiction, there's only things that you enjoy doing more than life.' - Doug Stanhope
GitHub Junkyard

Offline

#3 2013-09-19 11:03:56

amatriain
Member
Registered: 2011-06-02
Posts: 50

Re: wrong defaults for sysctl -p since upgrade to systemd 207?

@kaszak696: no, "sysctl --system" also gives an error message:

$ sudo sysctl --system
[sudo] password for amatriain: 
* Applying /usr/lib/sysctl.d/50-coredump.conf ...
kernel.core_pattern = |/usr/lib/systemd/systemd-coredump %p %u %g %s %t %e
* Applying /usr/lib/sysctl.d/50-default.conf ...
kernel.sysrq = 16
kernel.core_uses_pid = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
fs.protected_hardlinks = 1
fs.protected_symlinks = 1
* Applying /etc/sysctl.d/99-sysctl.conf ...
fs.inotify.max_user_watches = 524288
* Applying /etc/sysctl.conf ...
sysctl: cannot open "/etc/sysctl.conf": No such file or directory

Thanks for finding another example of sysctl wrongly assuming that sysctl.conf exists smile

I'll report the bug to upstream.

Offline

#4 2013-09-19 11:49:11

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,952
Website

Re: wrong defaults for sysctl -p since upgrade to systemd 207?

I don't think it's an error, and I don't think upstream are likely to change it (systemd isn't the only init system out there after all). It's possible that core/procps-ng will eventually drop the sysctl binary, as systemd is using /usr/lib/systemd/systemd-sysctl, not procps-ng's /usr/bin/sysctl.

I've not seen any mention of this on the mailing lists though, these are just my own thoughts. systemd-sysctl isn't a drop-in replacement, so /usr/bin/sysctl may be kept around for compatibility reasons.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#5 2013-10-10 15:22:46

jbernardo
Member
From: http://systemd-free.org/
Registered: 2012-07-03
Posts: 26

Re: wrong defaults for sysctl -p since upgrade to systemd 207?

Well, it seems that  /usr/lib/systemd/systemd-sysctl, if it is being called, isn't reading /etc/sysctl.d/99-sysctl.conf. I had re-enabled the sysrq there (setting kernel.sysrq=1) and it still was the 16 default. And I have systemd 208-1 installed, this supposedly was fixed in 207.

Last edited by jbernardo (2013-10-10 15:32:48)

Offline

#6 2013-10-10 15:35:45

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: wrong defaults for sysctl -p since upgrade to systemd 207?

jbernardo wrote:

Well, it seems that  /usr/lib/systemd/systemd-sysctl, if it is being called, isn't reading /etc/sysctl.d/99-sysctl.conf. I had re-enabled the sysrq there (setting kernel.sysrq=1) and it still was the stupid 16 default.

What's the output of

sudo sysctl -a | grep kernel.sysrq

Offline

#7 2013-10-10 16:16:15

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,952
Website

Re: wrong defaults for sysctl -p since upgrade to systemd 207?

Also, what is the output of:

# /usr/lib/systemd/systemd-sysctl

and

# systemctl status systemd-sysctl.service

and

$ cat /etc/sysctl.d/99-sysctl.conf

Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#8 2013-10-13 07:02:50

jbernardo
Member
From: http://systemd-free.org/
Registered: 2012-07-03
Posts: 26

Re: wrong defaults for sysctl -p since upgrade to systemd 207?

karol wrote:
jbernardo wrote:

Well, it seems that  /usr/lib/systemd/systemd-sysctl, if it is being called, isn't reading /etc/sysctl.d/99-sysctl.conf. I had re-enabled the sysrq there (setting kernel.sysrq=1) and it still was the stupid 16 default.

What's the output of

sudo sysctl -a | grep kernel.sysrq

Never mind, stupid mistake on my part, I had /etc/sysctl.d/99sysctlconf instead of /etc/sysctl.d/99-sysctl.conf, probably the lack of .conf extension was breaking things. I renamed it and now it works. Sorry.

Last edited by jbernardo (2013-10-13 07:20:55)

Offline

Board footer

Powered by FluxBB