Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 598732 - app-misc/elasticsearch-5.0.1 init script does not start
Summary: app-misc/elasticsearch-5.0.1 init script does not start
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Patrick Lauer
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-02 06:30 UTC by Oleh
Modified: 2017-09-08 04:26 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
/etc/init.d/elasticsearch.patch (init-script.diff,1.24 KB, patch)
2016-11-12 03:14 UTC, Alexey Zapparov
Details | Diff
PROPER /etc/init.d/elasticsearch.patch (init-script.diff,1.24 KB, patch)
2016-11-13 02:34 UTC, Alexey Zapparov
Details | Diff
/etc/init.d/elasticsearch.patch (proper.patch,1.31 KB, patch)
2016-11-13 02:35 UTC, Alexey Zapparov
Details | Diff
elasticsearch.service (elasticsearch.service,1.68 KB, text/plain)
2016-12-15 21:09 UTC, Leho Kraav (:macmaN @lkraav)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oleh 2016-11-02 06:30:10 UTC
as in summary update to 5.0.0 broke init script start up. version 2.4.1 (which shares same conf file and init script starts fine.)

Reproducible: Always

Steps to Reproduce:
1. emerge =app-misc/elasticsearch-5.0.0
2. rc-updte add elastcsearch default
3. rc
4. notice init script failure.
Actual Results:  
oleg2 / # rc-update add elasticsearch default
 * service elasticsearch added to runlevel default
oleg2 / # rc
 * Caching service dependencies ...                                                                                     [ ok ]
 * /etc/elasticsearch/logging.yml must be copied into place
 * ERROR: elasticsearch failed to start
oleg2 / #
Comment 1 Oleh 2016-11-02 14:57:49 UTC
this might be connected to https://bugs.gentoo.org/show_bug.cgi?id=597454
Comment 2 Ferenc Erki 2016-11-03 07:38:20 UTC
The way how JVM options and logging are configured has completely changed with 5.x.
Comment 3 Oleh 2016-11-03 07:40:30 UTC
make sense, however version bumped without taking care about such possible changes.
Comment 4 Alexey Zapparov 2016-11-12 03:14:19 UTC
Created attachment 453076 [details, diff]
/etc/init.d/elasticsearch.patch

- Elasticsearch 5.0.0 does not allows positional args anymore
- Argument `-P {key}={val}` was renamed to `-E {key}={val}` and it's short form of `--{key}={val}` was eliminated
- logging.yml is not used anymore, instead log4j config is used
Comment 5 Alexey Zapparov 2016-11-12 03:21:51 UTC
Hm. Patch won't help -- i've screwed it a bit. will fix and readd
Comment 6 Alexey Zapparov 2016-11-12 03:39:13 UTC
So the problem with patch is those positional args.
I don't know how to make start-stop-daemon properly pass those.

It will work if you will simply run (as elasticsearch):

```
PIDFILE="/run/elasticsearch/elasticsearch.pid"
ES_BASE_PATH="/var/lib/elasticsearch/_default"
CONF_DIR="/etc/elasticsearch"
LOG_DIR="/var/log/elasticsearch/_default"

ES_HOME="/usr/share/elasticsearch"

DATA_DIR="${ES_BASE_PATH}/data"

server_command="/usr/share/elasticsearch/bin/elasticsearch"
server_args="-d -p ${PIDFILE} -E default.path.home=${ES_HOME} -E default.path.logs=${LOG_DIR} -E default.path.data=${DATA_DIR} -E default.path.conf=${CONF_DIR}"

${server_command} ${server_args}
```

Notice that prior elasticsearch `5.0.0` it was creating `elasticsearch/nodes` under `$DATA_DIR`, and now it's simply `nodes`, so user needs to do some migration manually.
Comment 7 Alexey Zapparov 2016-11-13 01:23:38 UTC
I don't know what best option IS to solve this issue.

elasticsearch binary does not supports positional args, thus all args should be passed before positional. To emphasize:

```
# this will work:
elasticsearch -d -p ${PID_FILE}

# this will not
elasticsearch -- -d -p ${PID_FILE}
```

We probably can ship modified version of `/etc/elasticsearch/elasticsearch.yml` that will use ENV variables. Will provide a patch that shows this idea shortly.
Comment 8 Alexey Zapparov 2016-11-13 02:01:12 UTC
Did not came up with any working patch. Sorry.
Comment 9 Alexey Zapparov 2016-11-13 02:32:59 UTC
After continuous retries. I finally found what was wrong.
`ES_GC_LOG_FILE` was deprecated and using it was causing
ealsticsearch to show deprecation warning and stop.

Please, see new proper patch to initscript that makes it actually work (tested)!
Comment 10 Alexey Zapparov 2016-11-13 02:34:15 UTC
Created attachment 453174 [details, diff]
PROPER /etc/init.d/elasticsearch.patch
Comment 11 Alexey Zapparov 2016-11-13 02:35:45 UTC
Created attachment 453176 [details, diff]
/etc/init.d/elasticsearch.patch
Comment 12 Tomáš Mózes 2016-12-01 14:53:06 UTC
Can please look at this Patrick? I've just upgraded / fresh installed ES 5.0.1 and it fails to run.
Comment 13 Leho Kraav (:macmaN @lkraav) 2016-12-15 20:56:15 UTC
`/usr/lib/systemd/system/elasticsearch.service` is also completely broken. I will try to patch it up using the `init.d` patches above.
Comment 14 Leho Kraav (:macmaN @lkraav) 2016-12-15 21:09:34 UTC
Created attachment 456334 [details]
elasticsearch.service

changes were not difficult, modify PID_DIR to match what was defined in `tmpfiles.d` unit, and replace commandline -D with -E.
Comment 15 Tomáš Mózes 2016-12-18 11:48:29 UTC
https://github.com/gentoo/gentoo/pull/3158
Comment 16 Tomáš Mózes 2017-01-05 17:00:04 UTC
Please try 5.1.1.
Comment 17 Tomáš Mózes 2017-01-06 07:32:17 UTC
(In reply to Leho Kraav (:macmaN @lkraav) from comment #14)
> Created attachment 456334 [details]
> elasticsearch.service
> 
> changes were not difficult, modify PID_DIR to match what was defined in
> `tmpfiles.d` unit, and replace commandline -D with -E.

Let's continue fixing systemd in ES 5+ in https://bugs.gentoo.org/show_bug.cgi?id=597454. Can you please open a PR with the changes needed for 5.1.1 to make it work with systemd?
Comment 18 I am 2017-09-07 21:15:48 UTC
elasticsearch 5.5.2 init script still not working (with openrc)
Comment 19 Tomáš Mózes 2017-09-08 04:26:55 UTC
(In reply to I am from comment #18)
> elasticsearch 5.5.2 init script still not working (with openrc)

Can you please be more specific? I believe it's some other issue, because this bug was closed in January and it targetted the differences between ES v2 and ES v5. Now we just bumped from v5.5.1 to v5.5.2 so it should not horribly break, besides I have it running on 2 systems so I cannot reproduce. Please provide some logs, configs, etc., thank you.