ES_PATH_CONF not considered in 6.2

Hi,

I'm just trying to upgrade from 5.6 to 6.2.
I have a host with two elasticsearch instances running, which was working fine with 5.6.
But since upgrading to 6.2 the environment variable for ES_PATH_CONF isn't working anymore.

I'm using Debian 9 and created an additional systemd service file here the relevant parts:

[Service]
RuntimeDirectory=elasticsearch-archiv
Environment=ES_HOME=/usr/share/elasticsearch
Environment=ES_PATH_CONF=/etc/elasticsearch-archiv
Environment=PID_DIR=/var/run/elasticsearch-archiv
EnvironmentFile=-/etc/default/elasticsearch-archiv

WorkingDirectory=/usr/share/elasticsearch

User=elasticsearch
Group=elasticsearch

ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid

In /etc/default/elasticsearch-archiv ES_PATH_CONF is set to /etc/elasticsearch-archiv as well.
But still /etc/elasticsearch/ is used as ES_PATH_CONF!

If I try to start it from commandline with:
elasticsearch@elk01:/$ ES_PATH_CONF=/etc/elasticsearch-archiv /usr/share/elasticsearch/bin/elasticsearch -p /var/run/elasticsearch/elasticsearch-archiv.pid

it still uses the config from /etc/elasticsearch/

Hope someone can help.

Okay, I just found the issue....

on startup
/usr/share/elasticsearch/bin/elasticsearch-env gets executed which has

source /etc/default/elasticsearch

hardcoded....

This is documented:

For the package distributions, the config directory location defaults to /etc/elasticsearch. The location of the config directory can also be changed via the ES_PATH_CONF environment variable, but note that setting this in your shell is not sufficient. Instead, this variable is sourced from /etc/default/elasticsearch (for the Debian package) and /etc/sysconfig/elasticsearch (for the RPM package). You will need to edit the ES_PATH_CONF=/etc/elasticsearch entry in one of these files accordingly to change the config directory location.