3

I am running Fedora 27 with kernel 4.14.5 and have a problem that /etc/sysctl.conf is not being loaded upon boot.

If I run:

sudo sysctl -p

after boot, my settings are loaded and everything works fine.

What do I need to do to enable the loading of /etc/sysctl.conf or what alternatives are there to load it?

migrated from serverfault.com Dec 16 '17 at 6:08

This question came from our site for system and network administrators.

5

In systemd operating systems like Fedora, loading these settings is done with the systemd-sysctl commmand, run by the systemd-sysctl service. Your problem is that you have put the settings in the wrong configuration file.

systemd-sysctl does not read /etc/sysctl.conf. It reads a whole bunch of *.conf files in (amongst other places) the /etc/sysctl.d directory. You should create such a file and put your settings there.

Further reading

  • Lennart Poettering et al. (2016). systemd-sysctl. systemd manual pages. Freedesktop.org.
  • Lennart Poettering et al. (2016). sysctl.d. systemd manual pages. Freedesktop.org.
1

Edit your root's CRON:

sudo crontab -e

Paste the following:

@reboot /sbin/sysctl --load=/etc/sysctl.conf
  • This will work, but is a kludge around a different configuration problem. – mattdm Dec 16 '17 at 14:12
  • @mattdm I myself am using it. Tell me in detail, what problems it might cause as for your claim. Thanks. – Vlastimil Dec 16 '17 at 14:19
  • It's not the normal way to configure this. There's many ways to do things, and if you like a certain way, that's fine, but the other answer represents the standard way. That's important if you ever work on other systems, or if other people work on yours, or if you want the knowledge to transfer for a job or something. – mattdm Dec 16 '17 at 15:13
  • 1
    Additionally, this will trigger after a reboot when cron starts. The systemd-sysctl service usually starts very early. That's probably not going to cause a problem in real life, but could, depending on what you want to set. – mattdm Dec 16 '17 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.