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

**URL:** <https://discuss.elastic.co/t/elastic-agent-on-amazon-linux-2-service-executable-file-not-found-in-path/309616>\
**Category:** Elastic Agent\
**Tags:** docker, elastic-agent\
**Created:** [July 14, 2022, 8:11am UTC](https://discuss.elastic.co/t/elastic-agent-on-amazon-linux-2-service-executable-file-not-found-in-path/309616 "2022-07-14T08:11:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajbailey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ajbailey/32/108291_2.png) [@ajbailey](https://discuss.elastic.co/u/ajbailey)\
**Post date:** [July 14, 2022, 8:11am UTC](https://discuss.elastic.co/t/elastic-agent-on-amazon-linux-2-service-executable-file-not-found-in-path/309616/1 "2022-07-14T08:11:02Z")

</div>

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".

```auto
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

```

---

<div class="post-metadata">

**Author:** ![Alex\_Bailey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_bailey/32/103259_2.png) [@Alex\_Bailey](https://discuss.elastic.co/u/Alex_Bailey)\
**Post date:** [July 14, 2022, 9:38pm UTC](https://discuss.elastic.co/t/elastic-agent-on-amazon-linux-2-service-executable-file-not-found-in-path/309616/2 "2022-07-14T21:38:56Z")

</div>

> [@ajbailey](#):
>
> ```auto
> yum install -y tar gzip
> cd ~
> 
> ```

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

---

<div class="post-metadata">

**Author:** ![MichelLaterman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michellaterman/32/110221_2.png) [@MichelLaterman](https://discuss.elastic.co/u/MichelLaterman)\
**Post date:** [July 18, 2022, 6:29pm UTC](https://discuss.elastic.co/t/elastic-agent-on-amazon-linux-2-service-executable-file-not-found-in-path/309616/3 "2022-07-18T18:29:47Z")

</div>

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](https://www.elastic.co/guide/en/fleet/current/elastic-agent-container.html)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 15, 2022, 6:30pm UTC](https://discuss.elastic.co/t/elastic-agent-on-amazon-linux-2-service-executable-file-not-found-in-path/309616/4 "2022-08-15T18:30:32Z")

</div>

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