0

The sysctl utility allows a Linux admin to query and modify kernel parameters in runtime. For example, to change the swappiness of a linux system to 0 we can:

  1. echo 0 > /proc/sys/vm/swappiness

Or we can use sysctl

  1. sysctl -w vm.swappiness=0

To make the value persistent, Archwiki suggests to writevm.swappiness=0 to /etc/sysctl.d/99-swappiness.conf file.

For persistent silent boot, Archwiki suggests to write kernel.printk = 3 3 3 3 to /etc/sysctl.d/20-quiet-printk.conf

Similarly I have a 99-sysrq.conf on my system which works without the number as well.


Archwiki has a sysctl page which mentions the importance of the number:

Note: From version 207 and 21x, systemd only applies settings from /etc/sysctl.d/.conf and /usr/lib/sysctl.d/.conf. If you had customized /etc/sysctl.conf, you need to rename it as /etc/sysctl.d/99-sysctl.conf. If you had e.g. /etc/sysctl.d/foo, you need to rename it to /etc/sysctl.d/foo.conf.


What does the number in 99-swappiness.conf and 20-quiet-printk.conf denote here?

15 Volts
  • 1,946
  • 15
  • 37
  • 1
    Questions about the Linux operating system should be asked on https://unix.stackexchange.com/ Please delete this and ask over there. [What topics can I ask about here?](https://stackoverflow.com/help/on-topic) – Rob Mar 02 '20 at 12:15

1 Answers1

2

It's the order in which the files are read. By prefixing it with a two-digit number you can simply order in by the ascii-value of its characters. 20-quiet….conf comes before 99-swapiness.conf. (Try it with ls which sorts by default).

This follows the convention already used by SysV init system. Quoted from the Sequencing directories section of the very useful boot manpage:

To define the starting or stopping order within the same run-level, the name of a link contains an order-number. Also, for clarity, the name of a link usually ends with the name of the service to which it refers. For example, the link /etc/rc2.d/S80sendmail starts the sendmail service on runlevel 2. This happens after /etc/rc2.d/S12syslog is run but before /etc/rc2.d/S90xfs is run.

knittl
  • 246,190
  • 53
  • 318
  • 364
  • Hi, this question is off-topic here, and can't be moved to unix.stackexchange.com. Can you please edit and copy your answer and post it on https://unix.stackexchange.com/questions/570770/what-does-the-number-in-sysctl-configuration-file-denote ? So I can delete it. – 15 Volts Mar 02 '20 at 18:50
  • 1
    @S.Goswami feel free to answer the question on unix.stackexchange.com yourself. Self-answering is allowed and encouraged – knittl Mar 02 '20 at 19:23