What is the main difference between systemd-sysctl vs sysctl and when to use either? Both are present in my debian based system.
Asked
Active
Viewed 3,327 times
1 Answers
3
sysctl is an administrative tool which provides access to values in the /proc/sys virtual file system (see also How to set and understand fs.notify.max_user_watches). You can use it to see the current value of a setting:
sysctl fs.inotify.max_user_watches
and to change the value:
sysctl fs.inotify.max_user_watches=524288
systemd-sysctl is a systemd service which loads sysctl settings from a number of files during boot. You shouldn’t ever need to invoke or manipulate it directly.
The two tools are complementary: sysctl allows you to try a setting temporarily (the changes it makes don’t persist over reboots), and once you’ve decided on an appropriate value, writing it to a file in /etc/sysctl.d will ensure that systemd-sysctl sets it during boot. Again, see How to set and understand fs.notify.max_user_watches.
Stephen Kitt
- 411,918
- 54
- 1,065
- 1,164
-
Is Systemd-sysctl also responsible for loading etc/sysctl.conf? Sounds like sysctl is never executed without user intervention or systemd-sysctl. – AFP_555 Jun 18 '23 at 19:00
-
1`sysctl` used to be run by startup scripts; nowadays there’s usually a symlink from a file in `/etc/sysctl.d` to `/etc/sysctl.conf` to ensure that `systemd-sysctl` loads the latter. – Stephen Kitt Jun 18 '23 at 21:22