Query on link of sysctl.conf file

Here you can discuss every aspect of Debian. Note: not for support requests!
Post Reply
Message
Author
DebianFox
Posts: 53
Joined: 2024-05-05 14:11
Has thanked: 12 times
Been thanked: 3 times

Query on link of sysctl.conf file

#1 Post by DebianFox »

In recent Debian instances I have seen that the file /etc/sysctl.d/99-sysctl.conf is a syslink to /etc/sysctl.conf.

Why was the decision made to link the custom conf file back to the sysctl.conf file? What was the reasoning behind this?

I am not saying that is a good or bad thing. I am not saying it should be changed. I am not challenging this. All I want to know or understand is that why was this design choice made?
The reason that I ask this is because if the custom file, i.e. 99-sysctl.conf, is linked back to sysctl.conf then whatever changes in kernel parameters that we make will be overwritten. Typically the standard /etc/sysctl.conf file should not be edited, rather changes made is files kept in the /etc/sysctl.d directory. This helps to determine root causes of the issue.
I know that this refers to SysInit initialization and not SystemD init.

DebianFox
Posts: 53
Joined: 2024-05-05 14:11
Has thanked: 12 times
Been thanked: 3 times

Re: Query on link of sysctl.conf file

#2 Post by DebianFox »

If someone is using non SystemD init then sysctl.conf file is read and processed.

User avatar
sunrat
Administrator
Administrator
Posts: 6761
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 122 times
Been thanked: 542 times

Re: Query on link of sysctl.conf file

#3 Post by sunrat »

DebianFox wrote: 2024-06-12 06:34 If someone is using non SystemD init then sysctl.conf file is read and processed.
sysctl.conf is also read and processed under systemd.

Note it is spelled systemd, not SystemD - system daemon.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

DebianFox
Posts: 53
Joined: 2024-05-05 14:11
Has thanked: 12 times
Been thanked: 3 times

Re: Query on link of sysctl.conf file

#4 Post by DebianFox »

I assumed that systemd had its own config and did not use sysctl.conf and files under /etc/sysctl.d. Is that right?

User avatar
wizard10000
Global Moderator
Global Moderator
Posts: 782
Joined: 2019-04-16 23:15
Location: southeastern us
Has thanked: 96 times
Been thanked: 129 times

Re: Query on link of sysctl.conf file

#5 Post by wizard10000 »

It seems sysctl.conf has moved to /etc/sysctl.d - this would explain the symlink. Check out what I found in the Arch wiki - https://wiki.archlinux.org/title/sysctl#Configuration
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.
edit: I just fixed all four of my machines :)
we see things not as they are, but as we are.
-- anais nin

DebianFox
Posts: 53
Joined: 2024-05-05 14:11
Has thanked: 12 times
Been thanked: 3 times

Re: Query on link of sysctl.conf file

#6 Post by DebianFox »

:) congrats on fixing of your machines.

The link that you had given is from Arch Linux. And from the article
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.
....
The sysctl preload/configuration file can be created at /etc/sysctl.d/99-sysctl.conf
So in Debian systems the file /etc/sysctl.d/99-sysctl.conf is a syslink to the /etc/sysctl.conf because systemd does not process /etc/sysctl.conf file and which we need systemd to process /etc/sysctl.conf file? Or is it some other reason?
And if you see the second line Arch Linux seems to suggests that the custom parameters be kept in /etc/sysctl.d/99-sysctl.conf. But that cannot happen since in Debian it is a link to /etc/sysctl.conf
If any of the Debian architects or designers or old timers who know the history of Debian can suggest on why is this link present?
I am trying to question this decision or say that it is wrong or say that it needs to be changed. Want to understand.

Post Reply