Elastic Agent on Amazon Linux 2: "service" executable file not found in $PATH

Hi,

Following the installation guidelines for the Elastic Agent, it does not seem possible to run it on Amazon Linux 2. How can we work around this? I believe that AL2 does not use "service".

docker run -it --rm amazonlinux:latest bash

yum install -y tar gzip
cd ~
curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-8.3.2-linux-x86_64.tar.gz
tar xzvf elastic-agent-8.3.2-linux-x86_64.tar.gz
cd elastic-agent-8.3.2-linux-x86_64
./elastic-agent install --url=https://REDACTED.fleet.eu-west-1.aws.found.io:443 --enrollment-token=REDACTED --non-interactive

Installing in non-interactive mode.Installation failed to start Elastic Agent service.
Error: failed to start service (elastic-agent): "service" failed: exec: "service": executable file not found in $PATH
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.3/fleet-troubleshooting.html

Turns out that the docker doesn't have service because... it's a docker image. Kind of makes sense!

Hi Alex,

As you've discovered docker images do not typically run systemd.
If you were to try on a VM it should not have an issue.
We also provide a docker image as you can see in our docs Run Elastic Agent in a container | Fleet and Elastic Agent Guide [8.3] | Elastic

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.