我需要知道Linux的所有发行版是否都有/etc/sysctl.conf下的sysctl.conf。
有人告诉我Arch Linux没有。在上述路径下设置的配置可以被某些发行版中的另一个文件覆盖吗?
发布于 2020-10-08 14:06:27
不总是这样。RHEL8有一个引用sysctl.d手册页的虚拟文件。
man sysctl.d可以阅读很多地方。
NAME
sysctl.d - Configure kernel parameters at boot
SYNOPSIS
/etc/sysctl.d/*.conf
/run/sysctl.d/*.conf
/usr/lib/sysctl.d/*.conf从框中运行的sysctl --system在RHEL8上按以下顺序计算文件:
sysctl --system
* Applying /usr/lib/sysctl.d/10-default-yama-scope.conf ...
* Applying /usr/lib/sysctl.d/50-coredump.conf ...
* Applying /usr/lib/sysctl.d/50-default.conf ...
* Applying /usr/lib/sysctl.d/50-libkcapi-optmem_max.conf ...
* Applying /etc/sysctl.d/50-libreswan.conf ...
* Applying /usr/lib/sysctl.d/50-pid-max.conf ...
* Applying /etc/sysctl.d/99-sysctl.conf ...
* Applying /etc/sysctl.conf ...发布于 2020-10-08 14:11:50
/etc/sysctl.d/*.conf
/run/sysctl.d/*.conf
/usr/local/lib/sysctl.d/*.conf
/usr/lib/sysctl.d/*.conf
/lib/sysctl.d/*.conf
/etc/sysctl.conf
The paths where sysctl preload files usually exist. See also sysctl
option --system.来自曼斯克特
--system
Load settings from all system configuration files. Files are
read from directories in the following list in given order
from top to bottom. Once a file of a given filename is
loaded, any file of the same name in subsequent directories is
ignored.
/etc/sysctl.d/*.conf
/run/sysctl.d/*.conf
/usr/local/lib/sysctl.d/*.conf
/usr/lib/sysctl.d/*.conf
/lib/sysctl.d/*.conf
/etc/sysctl.conf在现代系统中,sysctl配置是在systemd-sysctl.service启动时加载的。来自人类系统d-sysctl
systemd-sysctl.service is an early boot service that configures sysctl(8) kernel parameters by invoking
/usr/lib/systemd/systemd-sysctl.
When invoked with no arguments, /usr/lib/systemd/systemd-sysctl applies all directives from configuration files listed in
sysctl.d(5).据我所知,这些文件是从上到下加载的,因此存储在/etc/sysctl.conf中的配置可能会覆盖前面设置的配置。
专业提示:/usr/lib/systemd/systemd-sysctl --cat-config
任何发行版、供应商和包管理器以及拥有分发文件的其他人员都可以将配置存储在任何这些目录中。软件包将在/usr/lib/sysctl.d/*.conf中存储配置。通常,/etc/sysctl.conf和/etc/sysctl.d/*.conf只留给手动管理员工作。
https://stackoverflow.com/questions/64264127
复制相似问题