Browse Source

Remove SysV init support (#51716)

With the removal of support for older OSes, we no longer have any
supported systems which use SysV init. This commit removes support for
that legacy init system.

relates #51480
Ryan Ernst 5 years ago
parent
commit
2899e03217
26 changed files with 7 additions and 711 deletions
  1. 0 8
      distribution/packages/build.gradle
  2. 0 30
      distribution/packages/src/common/env/elasticsearch
  3. 0 27
      distribution/packages/src/common/scripts/postinst
  4. 1 23
      distribution/packages/src/common/scripts/prerm
  5. 0 171
      distribution/packages/src/deb/init.d/elasticsearch
  6. 1 7
      distribution/packages/src/deb/lintian/elasticsearch
  7. 0 164
      distribution/packages/src/rpm/init.d/elasticsearch
  8. 0 3
      distribution/src/bin/elasticsearch
  9. 1 1
      docs/plugins/discovery-gce.asciidoc
  10. 0 20
      docs/reference/setup/install/deb-init.asciidoc
  11. 0 8
      docs/reference/setup/install/deb.asciidoc
  12. 0 10
      docs/reference/setup/install/init-systemd.asciidoc
  13. 0 20
      docs/reference/setup/install/rpm-init.asciidoc
  14. 0 8
      docs/reference/setup/install/rpm.asciidoc
  15. 0 18
      docs/reference/setup/install/sysconfig-file.asciidoc
  16. 0 12
      docs/reference/setup/starting.asciidoc
  17. 3 5
      docs/reference/setup/sysconfig/configuring.asciidoc
  18. 0 6
      docs/reference/setup/sysconfig/swap.asciidoc
  19. 0 4
      qa/os/bats/utils/packages.bash
  20. 0 27
      qa/os/bats/utils/utils.bash
  21. 1 5
      qa/os/src/test/java/org/elasticsearch/packaging/test/DebPreservationTests.java
  22. 0 5
      qa/os/src/test/java/org/elasticsearch/packaging/test/RpmPreservationTests.java
  23. 0 109
      qa/os/src/test/java/org/elasticsearch/packaging/test/SysVInitTests.java
  24. 0 7
      qa/os/src/test/java/org/elasticsearch/packaging/util/Cleanup.java
  25. 0 6
      qa/os/src/test/java/org/elasticsearch/packaging/util/Packages.java
  26. 0 7
      qa/os/src/test/java/org/elasticsearch/packaging/util/Platforms.java

+ 0 - 8
distribution/packages/build.gradle

@@ -253,14 +253,6 @@ Closure commonPackageConfig(String type, boolean oss, boolean jdk, String archit
       fileMode 0755
     }
 
-    // ========= sysV init =========
-    configurationFile '/etc/init.d/elasticsearch'
-    into('/etc/init.d') {
-      fileMode 0750
-      fileType CONFIG | NOREPLACE
-      from "${packagingFiles}/init.d/elasticsearch"
-    }
-
     // ========= empty dirs =========
     // NOTE: these are created under packagingFiles as empty, but the permissions are set here
     Closure copyEmptyDir = { path, u, g, mode ->

+ 0 - 30
distribution/packages/src/common/env/elasticsearch

@@ -20,33 +20,3 @@ ES_PATH_CONF=${path.conf}
 
 # Configure restart on package upgrade (true, every other setting will lead to not restarting)
 #RESTART_ON_UPGRADE=true
-
-################################
-# Elasticsearch service
-################################
-
-# SysV init.d
-#
-# The number of seconds to wait before checking if Elasticsearch started successfully as a daemon process
-ES_STARTUP_SLEEP_TIME=5
-
-################################
-# System properties
-################################
-
-# Specifies the maximum file descriptor number that can be opened by this process
-# When using Systemd, this setting is ignored and the LimitNOFILE defined in
-# /usr/lib/systemd/system/elasticsearch.service takes precedence
-#MAX_OPEN_FILES=65535
-
-# The maximum number of bytes of memory that may be locked into RAM
-# Set to "unlimited" if you use the 'bootstrap.memory_lock: true' option
-# in elasticsearch.yml.
-# When using systemd, LimitMEMLOCK must be set in a unit file such as
-# /etc/systemd/system/elasticsearch.service.d/override.conf.
-#MAX_LOCKED_MEMORY=unlimited
-
-# Maximum number of VMA (Virtual Memory Areas) a process can own
-# When using Systemd, this setting is ignored and the 'vm.max_map_count'
-# property is set at boot time in /usr/lib/sysctl.d/elasticsearch.conf
-#MAX_MAP_COUNT=262144

+ 0 - 27
distribution/packages/src/common/scripts/postinst

@@ -62,18 +62,6 @@ if [ "x$IS_UPGRADE" != "xtrue" ]; then
         echo " sudo systemctl enable elasticsearch.service"
         echo "### You can start elasticsearch service by executing"
         echo " sudo systemctl start elasticsearch.service"
-
-    elif command -v chkconfig >/dev/null; then
-        echo "### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using chkconfig"
-        echo " sudo chkconfig --add elasticsearch"
-        echo "### You can start elasticsearch service by executing"
-        echo " sudo service elasticsearch start"
-
-    elif command -v update-rc.d >/dev/null; then
-        echo "### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using chkconfig"
-        echo " sudo update-rc.d elasticsearch defaults 95 10"
-        echo "### You can start elasticsearch service by executing"
-        echo " sudo /etc/init.d/elasticsearch start"
     fi
 elif [ "$RESTART_ON_UPGRADE" = "true" ]; then
 
@@ -81,21 +69,6 @@ elif [ "$RESTART_ON_UPGRADE" = "true" ]; then
     if command -v systemctl >/dev/null; then
         systemctl daemon-reload
         systemctl restart elasticsearch.service || true
-
-    elif [ -x /etc/init.d/elasticsearch ]; then
-        if command -v invoke-rc.d >/dev/null; then
-            invoke-rc.d elasticsearch stop || true
-            invoke-rc.d elasticsearch start || true
-        else
-            /etc/init.d/elasticsearch restart || true
-        fi
-
-    # older suse linux distributions do not ship with systemd
-    # but do not have an /etc/init.d/ directory
-    # this tries to start the elasticsearch service on these
-    # as well without failing this script
-    elif [ -x /etc/rc.d/init.d/elasticsearch ] ; then
-        /etc/rc.d/init.d/elasticsearch restart || true
     fi
     echo " OK"
 fi

+ 1 - 23
distribution/packages/src/common/scripts/prerm

@@ -53,21 +53,7 @@ esac
 if [ "$STOP_REQUIRED" = "true" ]; then
     echo -n "Stopping elasticsearch service..."
     if command -v systemctl >/dev/null; then
-        systemctl --no-reload stop elasticsearch.service
-
-    elif [ -x /etc/init.d/elasticsearch ]; then
-        if command -v invoke-rc.d >/dev/null; then
-            invoke-rc.d elasticsearch stop
-        else
-            /etc/init.d/elasticsearch stop
-        fi
-
-    # older suse linux distributions do not ship with systemd
-    # but do not have an /etc/init.d/ directory
-    # this tries to start the elasticsearch service on these
-    # as well without failing this script
-    elif [ -x /etc/rc.d/init.d/elasticsearch ] ; then
-        /etc/rc.d/init.d/elasticsearch stop
+        systemctl --no-reload stop elasticsearch.service || true
     fi
     echo " OK"
 fi
@@ -82,14 +68,6 @@ if [ "$REMOVE_SERVICE" = "true" ]; then
     if command -v systemctl >/dev/null; then
         systemctl disable elasticsearch.service > /dev/null 2>&1 || true
     fi
-
-    if command -v chkconfig >/dev/null; then
-        chkconfig --del elasticsearch 2> /dev/null || true
-    fi
-
-    if command -v update-rc.d >/dev/null; then
-        update-rc.d elasticsearch remove >/dev/null || true
-    fi
 fi
 
 ${scripts.footer}

+ 0 - 171
distribution/packages/src/deb/init.d/elasticsearch

@@ -1,171 +0,0 @@
-#!/bin/bash
-#
-# /etc/init.d/elasticsearch -- startup script for Elasticsearch
-#
-### BEGIN INIT INFO
-# Provides:          elasticsearch
-# Required-Start:    $network $remote_fs $named
-# Required-Stop:     $network $remote_fs $named
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: Starts elasticsearch
-# Description:       Starts elasticsearch using start-stop-daemon
-### END INIT INFO
-
-PATH=/bin:/usr/bin:/sbin:/usr/sbin
-NAME=elasticsearch
-DESC="Elasticsearch Server"
-DEFAULT=/etc/default/$NAME
-
-if [ `id -u` -ne 0 ]; then
-	echo "You need root privileges to run this script"
-	exit 1
-fi
-
-
-. /lib/lsb/init-functions
-
-if [ -r /etc/default/rcS ]; then
-	. /etc/default/rcS
-fi
-
-
-# The following variables can be overwritten in $DEFAULT
-
-# Directory where the Elasticsearch binary distribution resides
-ES_HOME=/usr/share/$NAME
-
-# Additional Java OPTS
-#ES_JAVA_OPTS=
-
-# Maximum number of open files
-MAX_OPEN_FILES=65535
-
-# Maximum amount of locked memory
-#MAX_LOCKED_MEMORY=
-
-# Elasticsearch configuration directory
-ES_PATH_CONF=/etc/$NAME
-
-# Maximum number of VMA (Virtual Memory Areas) a process can own
-MAX_MAP_COUNT=262144
-
-# Elasticsearch PID file directory
-PID_DIR="/var/run/elasticsearch"
-
-# End of variables that can be overwritten in $DEFAULT
-
-# overwrite settings from default file
-if [ -f "$DEFAULT" ]; then
-	. "$DEFAULT"
-fi
-
-# ES_USER and ES_GROUP settings were removed
-if [ ! -z "$ES_USER" ] || [ ! -z "$ES_GROUP" ]; then
-    echo "ES_USER and ES_GROUP settings are no longer supported. To run as a custom user/group use the archive distribution of Elasticsearch."
-    exit 1
-fi
-
-# Define other required variables
-PID_FILE="$PID_DIR/$NAME.pid"
-DAEMON=$ES_HOME/bin/elasticsearch
-DAEMON_OPTS="-d -p $PID_FILE"
-
-export ES_JAVA_OPTS
-export JAVA_HOME
-export ES_PATH_CONF
-
-if [ ! -x "$DAEMON" ]; then
-	echo "The elasticsearch startup script does not exists or it is not executable, tried: $DAEMON"
-	exit 1
-fi
-
-case "$1" in
-  start)
-
-	log_daemon_msg "Starting $DESC"
-
-	pid=`pidofproc -p $PID_FILE elasticsearch`
-	if [ -n "$pid" ] ; then
-		log_begin_msg "Already running."
-		log_end_msg 0
-		exit 0
-	fi
-
-	# Ensure that the PID_DIR exists (it is cleaned at OS startup time)
-	if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then
-		mkdir -p "$PID_DIR" && chown elasticsearch:elasticsearch "$PID_DIR"
-	fi
-	if [ -n "$PID_FILE" ] && [ ! -e "$PID_FILE" ]; then
-		touch "$PID_FILE" && chown elasticsearch:elasticsearch "$PID_FILE"
-	fi
-
-	if [ -n "$MAX_OPEN_FILES" ]; then
-		ulimit -n $MAX_OPEN_FILES
-	fi
-
-	if [ -n "$MAX_LOCKED_MEMORY" ]; then
-		ulimit -l $MAX_LOCKED_MEMORY
-	fi
-
-	if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ] && [ "$MAX_MAP_COUNT" -gt $(cat /proc/sys/vm/max_map_count) ]; then
-		sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT
-	fi
-
-	# Start Daemon
-	start-stop-daemon -d $ES_HOME --start --user elasticsearch -c elasticsearch --pidfile "$PID_FILE" --exec $DAEMON -- $DAEMON_OPTS
-	return=$?
-	if [ $return -eq 0 ]; then
-		i=0
-		timeout=10
-		# Wait for the process to be properly started before exiting
-		until { kill -0 `cat "$PID_FILE"`; } >/dev/null 2>&1
-		do
-			sleep 1
-			i=$(($i + 1))
-			if [ $i -gt $timeout ]; then
-				log_end_msg 1
-				exit 1
-			fi
-		done
-	fi
-	log_end_msg $return
-	exit $return
-	;;
-  stop)
-	log_daemon_msg "Stopping $DESC"
-
-	if [ -f "$PID_FILE" ]; then
-		start-stop-daemon --stop --pidfile "$PID_FILE" \
-			--user elasticsearch \
-			--quiet \
-			--retry forever/TERM/20 > /dev/null
-		if [ $? -eq 1 ]; then
-			log_progress_msg "$DESC is not running but pid file exists, cleaning up"
-		elif [ $? -eq 3 ]; then
-			PID="`cat $PID_FILE`"
-			log_failure_msg "Failed to stop $DESC (pid $PID)"
-			exit 1
-		fi
-		rm -f "$PID_FILE"
-	else
-		log_progress_msg "(not running)"
-	fi
-	log_end_msg 0
-	;;
-  status)
-	status_of_proc -p $PID_FILE elasticsearch elasticsearch && exit 0 || exit $?
-	;;
-  restart|force-reload)
-	if [ -f "$PID_FILE" ]; then
-		$0 stop
-	fi
-	$0 start
-	;;
-  *)
-	log_success_msg "Usage: $0 {start|stop|restart|force-reload|status}"
-	exit 1
-	;;
-esac
-
-exit 0

+ 1 - 7
distribution/packages/src/deb/lintian/elasticsearch

@@ -20,19 +20,13 @@ non-standard-dir-perm etc/elasticsearch/jvm.options.d/ 2750 != 0755
 non-standard-file-perm etc/elasticsearch/*
 non-standard-dir-perm var/lib/elasticsearch/ 2750 != 0755
 non-standard-dir-perm var/log/elasticsearch/ 2750 != 0755
-executable-is-not-world-readable etc/init.d/elasticsearch 0750
-non-standard-file-permissions-for-etc-init.d-script etc/init.d/elasticsearch 0750 != 0755
 
 # this lintian tag is simply wrong; contrary to the explanation, debian systemd
 # does actually look at /usr/lib/systemd/system
 systemd-service-file-outside-lib usr/lib/systemd/system/elasticsearch.service
 
-# we do not automatically enable the service in init.d or systemd
-script-in-etc-init.d-not-registered-via-update-rc.d etc/init.d/elasticsearch
-
-# the package scripts handle init.d/systemd directly and don't need to use deb helpers
+# the package scripts handle systemd directly and don't need to use deb helpers
 maintainer-script-calls-systemctl
-prerm-calls-updaterc.d elasticsearch
 
 # bundled JDK
 embedded-library

+ 0 - 164
distribution/packages/src/rpm/init.d/elasticsearch

@@ -1,164 +0,0 @@
-#!/bin/bash
-#
-# elasticsearch <summary>
-#
-# chkconfig:   2345 80 20
-# description: Starts and stops a single elasticsearch instance on this system
-#
-
-### BEGIN INIT INFO
-# Provides: Elasticsearch
-# Required-Start: $network $named
-# Required-Stop: $network $named
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: This service manages the elasticsearch daemon
-# Description: Elasticsearch is a very scalable, schema-free and high-performance search solution supporting multi-tenancy and near realtime search.
-### END INIT INFO
-
-#
-# init.d / servicectl compatibility (openSUSE)
-#
-if [ -f /etc/rc.status ]; then
-    . /etc/rc.status
-    rc_reset
-fi
-
-#
-# Source function library.
-#
-if [ -f /etc/rc.d/init.d/functions ]; then
-    . /etc/rc.d/init.d/functions
-fi
-
-# Sets the default values for elasticsearch variables used in this script
-ES_HOME="/usr/share/elasticsearch"
-MAX_OPEN_FILES=65535
-MAX_MAP_COUNT=262144
-ES_PATH_CONF="${path.conf}"
-
-PID_DIR="/var/run/elasticsearch"
-
-# Source the default env file
-ES_ENV_FILE="${path.env}"
-if [ -f "$ES_ENV_FILE" ]; then
-    . "$ES_ENV_FILE"
-fi
-
-# ES_USER and ES_GROUP settings were removed
-if [ ! -z "$ES_USER" ] || [ ! -z "$ES_GROUP" ]; then
-    echo "ES_USER and ES_GROUP settings are no longer supported. To run as a custom user/group use the archive distribution of Elasticsearch."
-    exit 1
-fi
-
-exec="$ES_HOME/bin/elasticsearch"
-prog="elasticsearch"
-pidfile="$PID_DIR/${prog}.pid"
-
-export ES_JAVA_OPTS
-export JAVA_HOME
-export ES_PATH_CONF
-export ES_STARTUP_SLEEP_TIME
-
-lockfile=/var/lock/subsys/$prog
-
-if [ ! -x "$exec" ]; then
-    echo "The elasticsearch startup script does not exists or it is not executable, tried: $exec"
-    exit 1
-fi
-
-start() {
-    [ -x $exec ] || exit 5
-
-    if [ -n "$MAX_OPEN_FILES" ]; then
-        ulimit -n $MAX_OPEN_FILES
-    fi
-    if [ -n "$MAX_LOCKED_MEMORY" ]; then
-        ulimit -l $MAX_LOCKED_MEMORY
-    fi
-    if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ] && [ "$MAX_MAP_COUNT" -gt $(cat /proc/sys/vm/max_map_count) ]; then
-        sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT
-    fi
-
-    # Ensure that the PID_DIR exists (it is cleaned at OS startup time)
-    if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then
-        mkdir -p "$PID_DIR" && chown elasticsearch:elasticsearch "$PID_DIR"
-    fi
-    if [ -n "$pidfile" ] && [ ! -e "$pidfile" ]; then
-        touch "$pidfile" && chown elasticsearch:elasticsearch "$pidfile"
-    fi
-
-    cd $ES_HOME
-    echo -n $"Starting $prog: "
-    # if not running, start it up here, usually something like "daemon $exec"
-    daemon --user elasticsearch --pidfile $pidfile $exec -p $pidfile -d
-    retval=$?
-    echo
-    [ $retval -eq 0 ] && touch $lockfile
-    return $retval
-}
-
-stop() {
-    echo -n $"Stopping $prog: "
-    # stop it here, often "killproc $prog"
-    killproc -p $pidfile -d ${stopping.timeout} $prog
-    retval=$?
-    echo
-    [ $retval -eq 0 ] && rm -f $lockfile
-    return $retval
-}
-
-restart() {
-    stop
-    start
-}
-
-reload() {
-    restart
-}
-
-force_reload() {
-    restart
-}
-
-rh_status() {
-    # run checks to determine if the service is running or use generic status
-    status -p $pidfile $prog
-}
-
-rh_status_q() {
-    rh_status >/dev/null 2>&1
-}
-
-
-case "$1" in
-    start)
-        rh_status_q && exit 0
-        $1
-        ;;
-    stop)
-        rh_status_q || exit 0
-        $1
-        ;;
-    restart)
-        $1
-        ;;
-    reload)
-        rh_status_q || exit 7
-        $1
-        ;;
-    force-reload)
-        force_reload
-        ;;
-    status)
-        rh_status
-        ;;
-    condrestart|try-restart)
-        rh_status_q || exit 0
-        restart
-        ;;
-    *)
-        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
-        exit 2
-esac
-exit $?

+ 0 - 3
distribution/src/bin/elasticsearch

@@ -85,9 +85,6 @@ else
   retval=$?
   pid=$!
   [ $retval -eq 0 ] || exit $retval
-  if [ ! -z "$ES_STARTUP_SLEEP_TIME" ]; then
-    sleep $ES_STARTUP_SLEEP_TIME
-  fi
   if ! ps -p $pid > /dev/null ; then
     exit 1
   fi

+ 1 - 1
docs/plugins/discovery-gce.asciidoc

@@ -241,7 +241,7 @@ Start Elasticsearch:
 
 [source,sh]
 --------------------------------------------------
-sudo /etc/init.d/elasticsearch start
+sudo systemctl start elasticsearch
 --------------------------------------------------
 
 If anything goes wrong, you should check logs:

+ 0 - 20
docs/reference/setup/install/deb-init.asciidoc

@@ -1,20 +0,0 @@
-==== Running Elasticsearch with SysV `init`
-
-Use the `update-rc.d` command to configure Elasticsearch to start automatically
-when the system boots up:
-
-[source,sh]
---------------------------------------------------
-sudo update-rc.d elasticsearch defaults 95 10
---------------------------------------------------
-
-Elasticsearch can be started and stopped using the `service` command:
-
-[source,sh]
---------------------------------------------
-sudo -i service elasticsearch start
-sudo -i service elasticsearch stop
---------------------------------------------
-
-If Elasticsearch fails to start for any reason, it will print the reason for
-failure to STDOUT. Log files can be found in `/var/log/elasticsearch/`.

+ 0 - 8
docs/reference/setup/install/deb.asciidoc

@@ -173,14 +173,6 @@ include::xpack-indices.asciidoc[]
 
 endif::include-xpack[]
 
-[[deb-sysv-init-vs-systemd]]
-==== SysV `init` vs `systemd`
-
-include::init-systemd.asciidoc[]
-
-[[deb-running-init]]
-include::deb-init.asciidoc[]
-
 [[deb-running-systemd]]
 include::systemd.asciidoc[]
 

+ 0 - 10
docs/reference/setup/install/init-systemd.asciidoc

@@ -1,10 +0,0 @@
-Elasticsearch is not started automatically after installation. How to start
-and stop Elasticsearch depends on whether your system uses SysV `init` or
-`systemd` (used by newer distributions).  You can tell which is being used by
-running this command:
-
-[source,sh]
---------------------------------------------
-ps -p 1
---------------------------------------------
-

+ 0 - 20
docs/reference/setup/install/rpm-init.asciidoc

@@ -1,20 +0,0 @@
-==== Running Elasticsearch with SysV `init`
-
-Use the `chkconfig` command to configure Elasticsearch to start automatically
-when the system boots up:
-
-[source,sh]
---------------------------------------------------
-sudo chkconfig --add elasticsearch
---------------------------------------------------
-
-Elasticsearch can be started and stopped using the `service` command:
-
-[source,sh]
---------------------------------------------
-sudo -i service elasticsearch start
-sudo -i service elasticsearch stop
---------------------------------------------
-
-If Elasticsearch fails to start for any reason, it will print the reason for
-failure to STDOUT. Log files can be found in `/var/log/elasticsearch/`.

+ 0 - 8
docs/reference/setup/install/rpm.asciidoc

@@ -166,14 +166,6 @@ include::xpack-indices.asciidoc[]
 
 endif::include-xpack[]
 
-[[rpm-sysv-init-vs-systemd]]
-==== SysV `init` vs `systemd`
-
-include::init-systemd.asciidoc[]
-
-[[rpm-running-init]]
-include::rpm-init.asciidoc[]
-
 [[rpm-running-systemd]]
 include::systemd.asciidoc[]
 

+ 0 - 18
docs/reference/setup/install/sysconfig-file.asciidoc

@@ -3,24 +3,6 @@
 
   Set a custom Java path to be used.
 
-`MAX_OPEN_FILES`::
-
-    Maximum number of open files, defaults to `65535`.
-
-`MAX_LOCKED_MEMORY`::
-
-    Maximum locked memory size. Set to `unlimited` if you use the
-    `bootstrap.memory_lock` option in elasticsearch.yml.
-
-`MAX_MAP_COUNT`::
-
-    Maximum number of memory map areas a process may have. If you use `mmapfs`
-    as index store type, make sure this is set to a high value. For more
-    information, check the
-    https://github.com/torvalds/linux/blob/master/Documentation/sysctl/vm.txt[linux kernel documentation]
-    about `max_map_count`. This is set via `sysctl` before starting
-    Elasticsearch. Defaults to `262144`.
-
 `ES_PATH_CONF`::
 
     Configuration file directory (which needs to include `elasticsearch.yml`,

+ 0 - 12
docs/reference/setup/starting.asciidoc

@@ -31,12 +31,6 @@ include::install/zip-windows-start.asciidoc[]
 [[start-deb]]
 === Debian packages
 
-include::install/init-systemd.asciidoc[]
-
-[float]
-[[start-es-deb-init]]
-include::install/deb-init.asciidoc[]
-
 [float]
 [[start-es-deb-systemd]]
 include::install/systemd.asciidoc[]
@@ -65,12 +59,6 @@ include::install/msi-windows-start.asciidoc[]
 [[start-rpm]]
 === RPM packages
 
-include::install/init-systemd.asciidoc[]
-
-[float]
-[[start-es-rpm-init]]
-include::install/rpm-init.asciidoc[]
-
 [float]
 [[start-es-rpm-systemd]]
 include::install/systemd.asciidoc[]

+ 3 - 5
docs/reference/setup/sysconfig/configuring.asciidoc

@@ -68,16 +68,14 @@ following line:
 [[sysconfig]]
 ==== Sysconfig file
 
-When using the RPM or Debian packages, system settings and environment
-variables can be specified in the system configuration file, which is located
-in:
+When using the RPM or Debian packages, environment variables can be specified
+in the system configuration file, which is located in:
 
 [horizontal]
 RPM::     `/etc/sysconfig/elasticsearch`
 Debian::  `/etc/default/elasticsearch`
 
-However, for systems which uses `systemd`, system limits need to be specified
-via <<systemd,systemd>>.
+However, system limits need to be specified via <<systemd,systemd>>.
 
 [[systemd]]
 ==== Systemd configuration

+ 0 - 6
docs/reference/setup/sysconfig/swap.asciidoc

@@ -88,12 +88,6 @@ follows:
 
 RPM and Debian::
 
-  Set `MAX_LOCKED_MEMORY` to `unlimited` in the
-  <<sysconfig,system configuration file>> (or see below for systems using
-  `systemd`).
-
-Systems using `systemd`::
-
   Set `LimitMEMLOCK` to `infinity` in the <<systemd,systemd configuration>>.
 
 Another possible reason why `mlockall` can fail is that

+ 0 - 4
qa/os/bats/utils/packages.bash

@@ -166,10 +166,6 @@ verify_package_installation() {
         fi
     fi
 
-    if is_sysvinit; then
-        assert_file "/etc/init.d/elasticsearch" f root root 750
-    fi
-
     run sudo -E -u vagrant LANG="en_US.UTF-8" cat "$ESCONFIG/elasticsearch.yml"
     [ $status = 1 ]
     [[ "$output" == *"Permission denied"* ]] || {

+ 0 - 27
qa/os/bats/utils/utils.bash

@@ -111,21 +111,6 @@ skip_not_systemd() {
     fi
 }
 
-# Returns 0 if the system supports SysV
-is_sysvinit() {
-    [ -x "`which service 2>/dev/null`" ]
-}
-
-# Skip test if SysV is not supported
-skip_not_sysvinit() {
-    if [ -x "`which service 2>/dev/null`" ] && is_systemd; then
-        skip "sysvinit is supported, but systemd too"
-    fi
-    if [ ! -x "`which service 2>/dev/null`" ]; then
-        skip "sysvinit is not supported"
-    fi
-}
-
 # Skip if tar is not supported
 skip_not_tar_gz() {
     if [ ! -x "`which tar 2>/dev/null`" ]; then
@@ -321,9 +306,6 @@ start_elasticsearch_service() {
         run systemctl status elasticsearch.service
         [ "$status" -eq 0 ]
 
-    elif is_sysvinit; then
-        run service elasticsearch status
-        [ "$status" -eq 0 ]
     fi
 }
 
@@ -378,9 +360,6 @@ BASH
         run systemctl start elasticsearch.service
         [ "$status" -eq "$expectedStatus" ]
 
-    elif is_sysvinit; then
-        run service elasticsearch start
-        [ "$status" -eq "$expectedStatus" ]
     fi
 }
 
@@ -399,12 +378,6 @@ stop_elasticsearch_service() {
 
         echo "$output" | grep -E 'inactive|failed'
 
-    elif is_sysvinit; then
-        run service elasticsearch stop
-        [ "$status" -eq 0 ]
-
-        run service elasticsearch status
-        [ "$status" -ne 0 ]
     fi
 }
 

+ 1 - 5
qa/os/src/test/java/org/elasticsearch/packaging/test/DebPreservationTests.java

@@ -28,7 +28,6 @@ import static org.elasticsearch.packaging.util.FileExistenceMatchers.fileExists;
 import static org.elasticsearch.packaging.util.FileUtils.append;
 import static org.elasticsearch.packaging.util.FileUtils.assertPathsDoNotExist;
 import static org.elasticsearch.packaging.util.FileUtils.assertPathsExist;
-import static org.elasticsearch.packaging.util.Packages.SYSVINIT_SCRIPT;
 import static org.elasticsearch.packaging.util.Packages.assertInstalled;
 import static org.elasticsearch.packaging.util.Packages.assertRemoved;
 import static org.elasticsearch.packaging.util.Packages.installPackage;
@@ -88,9 +87,6 @@ public class DebPreservationTests extends PackagingTestCase {
             Paths.get("/usr/share/doc/" + distribution().flavor.name + "/copyright")
         );
 
-        // sysvinit service file was not removed
-        assertThat(SYSVINIT_SCRIPT, fileExists());
-
         // defaults file was not removed
         assertThat(installation.envFile, fileExists());
     }
@@ -102,7 +98,7 @@ public class DebPreservationTests extends PackagingTestCase {
 
         assertRemoved(distribution());
 
-        assertPathsDoNotExist(installation.config, installation.envFile, SYSVINIT_SCRIPT);
+        assertPathsDoNotExist(installation.config, installation.envFile);
 
         assertThat(packageStatus(distribution()).exitCode, is(1));
     }

+ 0 - 5
qa/os/src/test/java/org/elasticsearch/packaging/test/RpmPreservationTests.java

@@ -32,7 +32,6 @@ import static org.elasticsearch.packaging.util.FileExistenceMatchers.fileExists;
 import static org.elasticsearch.packaging.util.FileUtils.append;
 import static org.elasticsearch.packaging.util.FileUtils.assertPathsDoNotExist;
 import static org.elasticsearch.packaging.util.Packages.SYSTEMD_SERVICE;
-import static org.elasticsearch.packaging.util.Packages.SYSVINIT_SCRIPT;
 import static org.elasticsearch.packaging.util.Packages.assertInstalled;
 import static org.elasticsearch.packaging.util.Packages.assertRemoved;
 import static org.elasticsearch.packaging.util.Packages.installPackage;
@@ -63,9 +62,6 @@ public class RpmPreservationTests extends PackagingTestCase {
         // config was removed
         assertThat(installation.config, fileDoesNotExist());
 
-        // sysvinit service file was removed
-        assertThat(SYSVINIT_SCRIPT, fileDoesNotExist());
-
         // defaults file was removed
         assertThat(installation.envFile, fileDoesNotExist());
     }
@@ -103,7 +99,6 @@ public class RpmPreservationTests extends PackagingTestCase {
             installation.logs,
             installation.pidDir,
             installation.envFile,
-            SYSVINIT_SCRIPT,
             SYSTEMD_SERVICE
         );
 

+ 0 - 109
qa/os/src/test/java/org/elasticsearch/packaging/test/SysVInitTests.java

@@ -1,109 +0,0 @@
-/*
- * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.packaging.test;
-
-import org.elasticsearch.packaging.util.Platforms;
-import org.elasticsearch.packaging.util.ServerUtils;
-import org.elasticsearch.packaging.util.Shell;
-import org.junit.BeforeClass;
-
-import static org.elasticsearch.packaging.util.FileExistenceMatchers.fileExists;
-import static org.elasticsearch.packaging.util.FileUtils.assertPathsExist;
-import static org.hamcrest.CoreMatchers.anyOf;
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assume.assumeFalse;
-import static org.junit.Assume.assumeTrue;
-
-public class SysVInitTests extends PackagingTestCase {
-
-    @BeforeClass
-    public static void filterDistros() {
-        assumeTrue("rpm or deb", distribution.isPackage());
-        assumeTrue(Platforms.isSysVInit());
-        assumeFalse(Platforms.isSystemd());
-    }
-
-    @Override
-    public void startElasticsearch() throws Exception {
-        sh.run("service elasticsearch start");
-        ServerUtils.waitForElasticsearch(installation);
-        sh.run("service elasticsearch status");
-    }
-
-    @Override
-    public void stopElasticsearch() {
-        sh.run("service elasticsearch stop");
-    }
-
-    public void test10Install() throws Exception {
-        install();
-    }
-
-    public void test20Start() throws Exception {
-        startElasticsearch();
-        assertThat(installation.logs.resolve("gc.log"), fileExists());
-        ServerUtils.runElasticsearchTests();
-        sh.run("service elasticsearch status"); // returns 0 exit status when ok
-    }
-
-    public void test21Restart() throws Exception {
-        sh.run("service elasticsearch restart");
-        sh.run("service elasticsearch status"); // returns 0 exit status when ok
-    }
-
-    public void test22Stop() throws Exception {
-        stopElasticsearch();
-        Shell.Result status = sh.runIgnoreExitCode("service elasticsearch status");
-        assertThat(status.exitCode, anyOf(equalTo(3), equalTo(4)));
-    }
-
-    public void test30PidDirCreation() throws Exception {
-        // Simulates the behavior of a system restart:
-        // the PID directory is deleted by the operating system
-        // but it should not block ES from starting
-        // see https://github.com/elastic/elasticsearch/issues/11594
-
-        sh.run("rm -rf " + installation.pidDir);
-        startElasticsearch();
-        assertPathsExist(installation.pidDir.resolve("elasticsearch.pid"));
-        stopElasticsearch();
-    }
-
-    public void test31MaxMapTooSmall() throws Exception {
-        sh.run("sysctl -q -w vm.max_map_count=262140");
-        startElasticsearch();
-        Shell.Result result = sh.run("sysctl -n vm.max_map_count");
-        String maxMapCount = result.stdout.strip();
-        sh.run("service elasticsearch stop");
-        assertThat(maxMapCount, equalTo("262144"));
-    }
-
-    public void test32MaxMapBigEnough() throws Exception {
-        // Ensures that if $MAX_MAP_COUNT is greater than the set
-        // value on the OS we do not attempt to update it.
-        sh.run("sysctl -q -w vm.max_map_count=262145");
-        startElasticsearch();
-        Shell.Result result = sh.run("sysctl -n vm.max_map_count");
-        String maxMapCount = result.stdout.strip();
-        sh.run("service elasticsearch stop");
-        assertThat(maxMapCount, equalTo("262145"));
-    }
-
-}

+ 0 - 7
qa/os/src/test/java/org/elasticsearch/packaging/util/Cleanup.java

@@ -31,7 +31,6 @@ import static org.elasticsearch.packaging.util.FileUtils.getTempDir;
 import static org.elasticsearch.packaging.util.FileUtils.lsGlob;
 import static org.elasticsearch.packaging.util.Platforms.isDPKG;
 import static org.elasticsearch.packaging.util.Platforms.isRPM;
-import static org.elasticsearch.packaging.util.Platforms.isSystemd;
 
 public class Cleanup {
 
@@ -88,12 +87,6 @@ public class Cleanup {
         // windows needs leniency due to asinine releasing of file locking async from a process exiting
         Consumer<? super Path> rm = Platforms.WINDOWS ? FileUtils::rmWithRetries : FileUtils::rm;
         filesToDelete.stream().map(Paths::get).filter(Files::exists).forEach(rm);
-
-        // disable elasticsearch service
-        // todo add this for windows when adding tests for service intallation
-        if (Platforms.LINUX && isSystemd()) {
-            sh.run("systemctl unmask systemd-sysctl.service");
-        }
     }
 
     private static void purgePackagesLinux() {

+ 0 - 6
qa/os/src/test/java/org/elasticsearch/packaging/util/Packages.java

@@ -41,7 +41,6 @@ import static org.elasticsearch.packaging.util.FileMatcher.p660;
 import static org.elasticsearch.packaging.util.FileMatcher.p750;
 import static org.elasticsearch.packaging.util.FileMatcher.p755;
 import static org.elasticsearch.packaging.util.FileUtils.getCurrentVersion;
-import static org.elasticsearch.packaging.util.Platforms.isSysVInit;
 import static org.elasticsearch.packaging.util.Platforms.isSystemd;
 import static org.elasticsearch.packaging.util.ServerUtils.waitForElasticsearch;
 import static org.hamcrest.CoreMatchers.anyOf;
@@ -55,7 +54,6 @@ public class Packages {
 
     private static final Logger logger = LogManager.getLogger(Packages.class);
 
-    public static final Path SYSVINIT_SCRIPT = Paths.get("/etc/init.d/elasticsearch");
     public static final Path SYSTEMD_SERVICE = Paths.get("/usr/lib/systemd/system/elasticsearch.service");
 
     public static void assertInstalled(Distribution distribution) throws Exception {
@@ -209,10 +207,6 @@ public class Packages {
             final String sysctlExecutable = (distribution.packaging == Distribution.Packaging.RPM) ? "/usr/sbin/sysctl" : "/sbin/sysctl";
             assertThat(sh.run(sysctlExecutable + " vm.max_map_count").stdout, containsString("vm.max_map_count = 262144"));
         }
-
-        if (isSysVInit()) {
-            assertThat(SYSVINIT_SCRIPT, file(File, "root", "root", p750));
-        }
     }
 
     private static void verifyDefaultInstallation(Installation es) {

+ 0 - 7
qa/os/src/test/java/org/elasticsearch/packaging/util/Platforms.java

@@ -59,13 +59,6 @@ public class Platforms {
         return new Shell().runIgnoreExitCode("which systemctl").isSuccess();
     }
 
-    public static boolean isSysVInit() {
-        if (WINDOWS) {
-            return false;
-        }
-        return new Shell().runIgnoreExitCode("which service").isSuccess();
-    }
-
     public static boolean isDocker() {
         return new Shell().runIgnoreExitCode("which docker").isSuccess();
     }