# Facing error while starting kibana & trying to connect to elasticsearch version 8.5.1

**URL:** <https://discuss.elastic.co/t/facing-error-while-starting-kibana-trying-to-connect-to-elasticsearch-version-8-5-1/359884>\
**Category:** Kibana\
**Tags:** elastic-stack-monitoring, elastic-stack-security, elastic-stack-alerting\
**Created:** [May 21, 2024, 7:33am UTC](https://discuss.elastic.co/t/facing-error-while-starting-kibana-trying-to-connect-to-elasticsearch-version-8-5-1/359884 "2024-05-21T07:33:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sunil\_Jagtap](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sunil_jagtap/32/133604_2.png) [@Sunil\_Jagtap](https://discuss.elastic.co/u/Sunil_Jagtap)\
**Post date:** [May 21, 2024, 7:33am UTC](https://discuss.elastic.co/t/facing-error-while-starting-kibana-trying-to-connect-to-elasticsearch-version-8-5-1/359884/1 "2024-05-21T07:33:31Z")

</div>

Hi Everyone,

w.r.t suggetion given by Devid over post :

> [@Facing connection closer error while starting elasticsearch 8.5.1 instance on local machine](https://discuss.elastic.co/t/facing-connection-closer-error-while-starting-elasticsearch-8-5-1-instance-on-local-machine/359680/2):
>
> First. Don't use this version. It's a bit old. Better to start with the latest 8.13 as you are running all that locally. BTW, I'd use docker compose as it's much easier to run all that locally. Most likely you are using self-signed certificates (by default). So you need to tell Kibana about this. Have a look at [Start the Elastic Stack with security enabled automatically | Elasticsearch Guide [8.13] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/8.13/configuring-stack-security.html#stack-start-with-security)

I tried both ways, (FYI : I am testing this on kibana plugin development environment)  
supplied below values to respective parameters to config/kibana.yml

1. elasticsearch username & password to parameters:

2. elasticsearch service token :

I am still getting the same error,

On kibana terminal :

```auto
[2024-05-21T12:50:12.756+05:30][ERROR][elasticsearch-service] Unable to retrieve version information from Elasticsearch nodes. socket hang up - Local: 127.0.0.1:64610, Remote: 127.0.0.1:9200

```

& On elasticsearch terminal :

```auto
2024-05-21T12:50:12,754][WARN][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [Sunils-MacBook-Pro.local] received plaintext http traffic on an https channel, closing connection Netty4HttpChannel{localAddress=/127.0.0.1:9200, remoteAddress=/127.0.0.1:64610}

```

Additional info : Below are the parameters mentioned on elasticsearch.yml

```auto
# Enable security features
xpack.security.enabled: true

xpack.security.enrollment.enabled: true

# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
  enabled: true
  keystore.path: certs/http.p12

# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12
# Create a new cluster with the current node only
# Additional nodes can still join the cluster later
cluster.initial_master_nodes: ["Sunils-MacBook-Pro.local"]

# Allow HTTP API connections from anywhere
# Connections are encrypted and require user authentication
http.host: 0.0.0.0

```

thankful to have some fix.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 21, 2024, 8:23am UTC](https://discuss.elastic.co/t/facing-error-while-starting-kibana-trying-to-connect-to-elasticsearch-version-8-5-1/359884/2 "2024-05-21T08:23:00Z")

</div>

This error message indicates that Elasticsearch received an **http** request although it's expecting an **https** request.

```auto
2024-05-21T12:50:12,754][WARN][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [Sunils-MacBook-Pro.local] received plaintext http traffic on an https channel, closing connection Netty4HttpChannel{localAddress=/127.0.0.1:9200, remoteAddress=/127.0.0.1:64610}

```

Check that Kibana is using https as the protocol in that case.

---

<div class="post-metadata">

**Author:** ![Sunil\_Jagtap](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sunil_jagtap/32/133604_2.png) [@Sunil\_Jagtap](https://discuss.elastic.co/u/Sunil_Jagtap)\
**Post date:** [May 21, 2024, 8:54am UTC](https://discuss.elastic.co/t/facing-error-while-starting-kibana-trying-to-connect-to-elasticsearch-version-8-5-1/359884/3 "2024-05-21T08:54:26Z")

</div>

Hi David,

Activated this parameter to config/kibana.yml,

elasticsearch.hosts: ["[https://localhost:9200](https://localhost:9200)"]

& now below is the error message on kibana terminal :

```auto
2024-05-21T14:20:31.363+05:30][ERROR][elasticsearch-service] Unable to retrieve version information from Elasticsearch nodes. self signed certificate in certificate chain

```

---

<div class="post-metadata">

**Author:** ![Sunil\_Jagtap](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sunil_jagtap/32/133604_2.png) [@Sunil\_Jagtap](https://discuss.elastic.co/u/Sunil_Jagtap)\
**Post date:** [May 21, 2024, 9:19am UTC](https://discuss.elastic.co/t/facing-error-while-starting-kibana-trying-to-connect-to-elasticsearch-version-8-5-1/359884/4 "2024-05-21T09:19:59Z")

</div>

Even tried activating below parameters :

```auto
# server.ssl.enabled: true
# server.ssl.certificate: /Users/sunil/Documents/workspace/elasticsearch-8.5.1/config/certs/http_ca.crt
# server.ssl.key: /Users/sunil/Documents/workspace/elasticsearch-8.5.1/config/certs/http.p12

```

And

```auto
elasticsearch.ssl.certificate: /Users/sunil/Documents/workspace/elasticsearch-8.5.1/config/certs/http_ca.crt
elasticsearch.ssl.key: /Users/sunil/Documents/workspace/elasticsearch-8.5.1/config/certs/http.p12

```

below are the error messages on terminal :

```auto
[2024-05-21T14:20:31.363+05:30][ERROR][elasticsearch-service] Unable to retrieve version information from Elasticsearch nodes. self signed certificate in certificate chain

FATAL Error: error:0909006C:PEM routines:get_name:no start line
 server crashed with status code 1

[2024-05-21T14:46:52.369+05:30][ERROR][elasticsearch-service] Unable to retrieve version information from Elasticsearch nodes. error:0909006C:PEM routines:get_name:no start line

```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 21, 2024, 9:32am UTC](https://discuss.elastic.co/t/facing-error-while-starting-kibana-trying-to-connect-to-elasticsearch-version-8-5-1/359884/5 "2024-05-21T09:32:39Z")

</div>

I think it's not pointing to the expected certificate format. Not an expert on this. I'm usually just using docker compose which makes my life easier.

So may be check the documentation to find out what are the expected settings?

---

<div class="post-metadata">

**Author:** ![Sunil\_Jagtap](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sunil_jagtap/32/133604_2.png) [@Sunil\_Jagtap](https://discuss.elastic.co/u/Sunil_Jagtap)\
**Post date:** [May 21, 2024, 9:44am UTC](https://discuss.elastic.co/t/facing-error-while-starting-kibana-trying-to-connect-to-elasticsearch-version-8-5-1/359884/6 "2024-05-21T09:44:01Z")

</div>

Sure David, Thanks for your valuable suggestions 👍

---

<div class="post-metadata">

**Author:** ![Sunil\_Jagtap](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sunil_jagtap/32/133604_2.png) [@Sunil\_Jagtap](https://discuss.elastic.co/u/Sunil_Jagtap)\
**Post date:** [May 22, 2024, 5:31am UTC](https://discuss.elastic.co/t/facing-error-while-starting-kibana-trying-to-connect-to-elasticsearch-version-8-5-1/359884/7 "2024-05-22T05:31:19Z")

</div>

Hi All,

I am referring this post which is more relevant to my issue,

> [@Kibana - Unable to retrieve version information from Elasticsearch nodes. self signed certificate in certificate chain](https://discuss.elastic.co/t/kibana-unable-to-retrieve-version-information-from-elasticsearch-nodes-self-signed-certificate-in-certificate-chain/299159/3):
>
> If you want to use the enrollment process, then you should not make configuration changes to your kibana.yml but let the enrollment process handle this for you. Remove elasticsearch.hosts: ["https://10.0.2.15:9200"] and start the kibana service again. When you navigate to [http://localhost:5601/](http://localhost:5601/) you will be prompted to enter the enrollment token you generated in Elasticsearch ( please generate a new one, each enrollment token is only valid for 30 minutes)

In my case I am using kibana plugin development environment & when I am trying to invoke enrollment process process using "yarn start" it is taking me to below error on kibana terminal :

```auto
[2024-05-22T10:52:31.044+05:30][ERROR][elasticsearch-service] Unable to retrieve version information from Elasticsearch nodes. socket hang up - Local: 127.0.0.1:60140, Remote: 127.0.0.1:9200

```

As per documentation : [Start the Elastic Stack with security enabled automatically | Elasticsearch Guide [8.13] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/configuring-stack-security.html#stack-start-with-security)

I tried below step :

- **Detached mode** (non-browser)Run the `kibana-setup` tool and pass the generated enrollment token with the `--enrollment-token` parameter.

bin/kibana-setup --enrollment-token

As "bin/kibana-setup" not exist on kibana plugin development environment I tried executing the script manually from location :

```auto
Sunils-MacBook-Pro:scripts sunil$ pwd
/Users/sunil/Documents/workspace/kibana/src/dev/build/tasks/bin/scripts

Sunils-MacBook-Pro:scripts sunil$ ./kibana-setup --enrollment-token [ENCRYPTED_TEXT]
**unable to find usable node.js executable.**

```

Looking for help, thanks in advance.

---

<div class="post-metadata">

**Author:** ![Sunil\_Jagtap](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sunil_jagtap/32/133604_2.png) [@Sunil\_Jagtap](https://discuss.elastic.co/u/Sunil_Jagtap)\
**Post date:** [May 23, 2024, 6:17am UTC](https://discuss.elastic.co/t/facing-error-while-starting-kibana-trying-to-connect-to-elasticsearch-version-8-5-1/359884/8 "2024-05-23T06:17:18Z")

</div>

@ikakavas , Elastic Team,

Looking for help reg. above issue
