Skip to content

Commit 9d29b78

Browse files
committed
Add option to skip kernel parameters on install
During package install on systemd-based systems, we try to set vm.max_map_count. On some systems (e.g., containers), users do not have the ability to tune these parameters from within the container. This commit provides an option for these users to skip setting such kernel parameters. Relates #21899
1 parent b4c5bcb commit 9d29b78

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

distribution/src/main/packaging/scripts/postinst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,17 @@ case "$1" in
5252
esac
5353

5454
# to pick up /usr/lib/sysctl.d/elasticsearch.conf
55-
if command -v /usr/lib/systemd/systemd-sysctl > /dev/null; then
56-
/usr/lib/systemd/systemd-sysctl
57-
elif command -v /lib/systemd/systemd-sysctl > /dev/null; then
58-
/lib/systemd/systemd-sysctl
55+
if [ "${ES_SKIP_SET_KERNEL_PARAMETERS:-false}" == "false" ]; then
56+
if command -v /usr/lib/systemd/systemd-sysctl > /dev/null; then
57+
/usr/lib/systemd/systemd-sysctl
58+
elif command -v /lib/systemd/systemd-sysctl > /dev/null; then
59+
/lib/systemd/systemd-sysctl
60+
fi
61+
elif [ "$ES_SKIP_SET_KERNEL_PARAMETERS" == "true" ]; then
62+
echo "skipping setting kernel parameters"
63+
else
64+
echo "unrecognized value [$ES_SKIP_SET_KERNEL_PARAMETERS] for ES_SKIP_SET_KERNEL_PARAMETERS; must [false] (default) or [true]"
65+
exit 1
5966
fi
6067

6168
if [ "x$IS_UPGRADE" != "xtrue" ]; then

docs/reference/setup/install/deb.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ Examine +/etc/apt/sources.list.d/elasticsearch-{major-version}.list+ for the dup
9696

9797
endif::[]
9898

99+
include::skip-set-kernel-parameters.asciidoc[]
99100

100101
[[install-deb]]
101102
==== Download and install the Debian package manually

docs/reference/setup/install/rpm.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ sudo rpm --install elasticsearch-{version}.rpm
112112

113113
endif::[]
114114

115+
include::skip-set-kernel-parameters.asciidoc[]
116+
115117
include::init-systemd.asciidoc[]
116118

117119
[[rpm-running-init]]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
NOTE: On systemd-based distributions, the installation scripts will attempt to set kernel parameters (e.g.,
2+
`vm.max_map_count`); you can skip this by setting the environment variable `ES_SKIP_SET_KERNEL_PARAMETERS` to `true`.

0 commit comments

Comments
 (0)