# Fleet Server & ES Agent

**URL:** <https://discuss.elastic.co/t/fleet-server-es-agent/318259>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security, fleet\
**Created:** [November 6, 2022, 1:12pm UTC](https://discuss.elastic.co/t/fleet-server-es-agent/318259 "2022-11-06T13:12:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![EExisT](https://avatars.discourse-cdn.com/v4/letter/e/35a633/32.png) [@EExisT](https://discuss.elastic.co/u/EExisT)\
**Post date:** [November 6, 2022, 1:12pm UTC](https://discuss.elastic.co/t/fleet-server-es-agent/318259/1 "2022-11-06T13:12:49Z")

</div>

Hello,

when I try to install the fleet server on the machine I receive this error:

```auto
sudo ./elastic-agent install \--fleet-server-es=http://10.211.55.7:9200 \--fleet-server-service-token=AAEAAWVsYXN0aWMvZmxlZXQtc2VydmVyL3Rva2VuLTE2Njc3MzM0ODk1OTI6czBsQm1xcVRSZHlsOXd3QnJ6T1dqZw \--fleet-server-policy=fleet-server-policy \--fleet-server-es-ca=/etc/kibana/ca/ca.crt
Elastic Agent will be installed at /opt/Elastic/Agent and will run as a service. Do you want to continue? [Y/n]:Y
{"log.level":"info","@timestamp":"2022-11-06T13:10:50.748+0100","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":403},"message":"Generating self-signed certificate for Fleet Server","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-11-06T13:10:53.344+0100","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":759},"message":"Waiting for Elastic Agent to start Fleet Server","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-11-06T13:11:53.366+0100","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":792},"message":"Fleet Server - Error - EOF","ecs.version":"1.6.0"}
Error: fleet-server failed: context canceled
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.5/fleet-troubleshooting.html
Error: enroll command failed with exit code: 1
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.5/fleet-troubleshooting.html

```

I have an Elasticsearch server and the Kibana server on the same VM Ubuntu machine.  
Previously i produced a Certificate Authorities with the `/usr/share/elasticsearch/bin/elasticsearch-certutil ca` command and I passed this value in the `fleet-server-es-ca` option above to install elastic agent.

I tried also the above command with some variations:

```auto
$ sudo ./elastic-agent install \--fleet-server-es=http://10.211.55.7:9200 \--fleet-server-service-token=AAEAAWVsYXN0aWMvZmxlZXQtc2VydmVyL3Rva2VuLTE2Njc3MzM0ODk1OTI6czBsQm1xcVRSZHlsOXd3QnJ6T1dqZw \--fleet-server-policy=fleet-server-policy \--fleet-server-es-ca=/etc/kibana/ca/ca.crt \--fleet-server-es-insecure
Elastic Agent will be installed at /opt/Elastic/Agent and will run as a service. Do you want to continue? [Y/n]:Y
{"log.level":"info","@timestamp":"2022-11-06T14:24:37.927+0100","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":403},"message":"Generating self-signed certificate for Fleet Server","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-11-06T14:24:40.394+0100","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":792},"message":"Fleet Server - Error - EOF","ecs.version":"1.6.0"}
Error: fleet-server failed: context canceled
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.5/fleet-troubleshooting.html
Error: enroll command failed with exit code: 1
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.5/fleet-troubleshooting.html

```

```auto
$ sudo ./elastic-agent install \--fleet-server-es=http://10.211.55.7:9200 \--fleet-server-service-token=AAEAAWVsYXN0aWMvZmxlZXQtc2VydmVyL3Rva2VuLTE2Njc3MzM0ODk1OTI6czBsQm1xcVRSZHlsOXd3QnJ6T1dqZw \--fleet-server-policy=fleet-server-policy \--fleet-server-es-insecure
Elastic Agent will be installed at /opt/Elastic/Agent and will run as a service. Do you want to continue? [Y/n]:Y
{"log.level":"info","@timestamp":"2022-11-06T14:26:58.882+0100","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":403},"message":"Generating self-signed certificate for Fleet Server","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-11-06T14:27:01.435+0100","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":792},"message":"Fleet Server - Error - EOF","ecs.version":"1.6.0"}
Error: fleet-server failed: context canceled
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.5/fleet-troubleshooting.html
Error: enroll command failed with exit code: 1
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.5/fleet-troubleshooting.html

```

```auto
sudo ./elastic-agent install \--fleet-server-es=http://10.211.55.7:9200 \--fleet-server-service-token=AAEAAWVsYXN0aWMvZmxlZXQtc2VydmVyL3Rva2VuLTE2Njc3MzM0ODk1OTI6czBsQm1xcVRSZHlsOXd3QnJ6T1dqZw \--fleet-server-policy=fleet-server-policy \--insecure
Elastic Agent will be installed at /opt/Elastic/Agent and will run as a service. Do you want to continue? [Y/n]:Y
{"log.level":"info","@timestamp":"2022-11-06T14:38:38.525+0100","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":403},"message":"Generating self-signed certificate for Fleet Server","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-11-06T14:38:41.287+0100","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":759},"message":"Waiting for Elastic Agent to start Fleet Server","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-11-06T14:39:41.311+0100","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":792},"message":"Fleet Server - Error - EOF","ecs.version":"1.6.0"}
Error: fleet-server failed: context canceled
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.5/fleet-troubleshooting.html
Error: enroll command failed with exit code: 1
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.5/fleet-troubleshooting.html

```

Thank u for ur help!

---

<div class="post-metadata">

**Author:** ![Cristina\_Amico](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Cristina\_Amico](https://discuss.elastic.co/u/Cristina_Amico)\
**Post date:** [November 7, 2022, 10:22am UTC](https://discuss.elastic.co/t/fleet-server-es-agent/318259/2 "2022-11-07T10:22:13Z")

</div>

Hi @EExisT,

Could you enable debug log levels, retry and provide them?

---

<div class="post-metadata">

**Author:** ![EExisT](https://avatars.discourse-cdn.com/v4/letter/e/35a633/32.png) [@EExisT](https://discuss.elastic.co/u/EExisT)\
**Post date:** [November 7, 2022, 10:29am UTC](https://discuss.elastic.co/t/fleet-server-es-agent/318259/3 "2022-11-07T10:29:51Z")

</div>

Hi @Cristina_Amico,

I think I have to set the agent.logging.level to debug, is it right?  
Then what I have to do?

---

<div class="post-metadata">

**Author:** ![Cristina\_Amico](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Cristina\_Amico](https://discuss.elastic.co/u/Cristina_Amico)\
**Post date:** [November 7, 2022, 10:43am UTC](https://discuss.elastic.co/t/fleet-server-es-agent/318259/4 "2022-11-07T10:43:49Z")

</div>

Usually I've seen this error happening because one of the parameters passed in the enrolment command is not correct.  
I would check that:

- `fleet-server-policy` exists
- ES host is reachable. Have you checked that `http://10.211.55.7:9200` is reachable?
- The enrolment token is active. You can check this by going to the enrolment tokens tab in fleet or going to dev tools on the left column of kibana and running `GET api/fleet/enrollment_api_keys`.  
Just to be extra sure, how many enrolment tokens (active and inactive) do you have?

---

<div class="post-metadata">

**Author:** ![EExisT](https://avatars.discourse-cdn.com/v4/letter/e/35a633/32.png) [@EExisT](https://discuss.elastic.co/u/EExisT)\
**Post date:** [November 7, 2022, 11:11am UTC](https://discuss.elastic.co/t/fleet-server-es-agent/318259/5 "2022-11-07T11:11:51Z")

</div>

Hi Cristina, in the meantime I tried to install fleet by deb package and it goes well.  
But naturally this is only a workaround...

---

<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:** [December 5, 2022, 11:12am UTC](https://discuss.elastic.co/t/fleet-server-es-agent/318259/6 "2022-12-05T11:12:47Z")

</div>

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