Honor masking of systemd-sysctl.service
During package install on systemd-based systems, some sysctl settings should be set (e.g. vm.max_map_count). In some environments, changing sysctl settings plainly does not work; previously a global environment variable named ES_SKIP_SET_KERNEL_PARAMETERS was introduced to skip calling sysctl, but this causes trouble for: - configuration management systems, which usually cannot apply an env var when running a package manager - package upgrades, which will not have the env var set any more, and thus leaving the package management system in a bad state (possibly half-way upgraded, can be very hard to recover) This removes the env var again and instead of calling systemd-sysctl manually, tells systemd to restart the wrapper unit - which itself can be masked by system administrators or management tools if it is known that sysctl does not work in a given environment. The restart is not silent on systems in their default configuration, but is ignored if the unit is masked. Relates #24234
This commit is contained in:
parent
d47d47928b
commit
c3ec6a1714
|
@ -48,17 +48,8 @@ case "$1" in
|
|||
esac
|
||||
|
||||
# to pick up /usr/lib/sysctl.d/elasticsearch.conf
|
||||
if [ "${ES_SKIP_SET_KERNEL_PARAMETERS:-false}" == "false" ]; then
|
||||
if command -v /usr/lib/systemd/systemd-sysctl > /dev/null; then
|
||||
/usr/lib/systemd/systemd-sysctl
|
||||
elif command -v /lib/systemd/systemd-sysctl > /dev/null; then
|
||||
/lib/systemd/systemd-sysctl
|
||||
fi
|
||||
elif [ "$ES_SKIP_SET_KERNEL_PARAMETERS" == "true" ]; then
|
||||
echo "skipping setting kernel parameters"
|
||||
else
|
||||
echo "unrecognized value [$ES_SKIP_SET_KERNEL_PARAMETERS] for ES_SKIP_SET_KERNEL_PARAMETERS; must [false] (default) or [true]"
|
||||
exit 1
|
||||
if command -v systemctl > /dev/null; then
|
||||
systemctl restart systemd-sysctl.service
|
||||
fi
|
||||
|
||||
if [ "x$IS_UPGRADE" != "xtrue" ]; then
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
NOTE: On systemd-based distributions, the installation scripts will attempt to set kernel parameters (e.g.,
|
||||
`vm.max_map_count`); you can skip this by setting the environment variable `ES_SKIP_SET_KERNEL_PARAMETERS` to `true`.
|
||||
`vm.max_map_count`); you can skip this by masking the systemd-sysctl.service unit.
|
||||
|
|
Loading…
Reference in New Issue