Ubuntu 16 server, systemctl restart elasticsearch does nothing, and there’s no log

elasticsearchsystemctlubuntu-16.04

On ubuntu 16 lts server system, a newly installed elasticsearch instance won't start up with systemctl restart elasticsearch (or with start).
No logs are created, manually running /usr/share/elasticsearch/bin/elasticsearch as user elasticsearch WORKS, so permissions or the configuration file are not the issue (I think), and there's no logs in /var/log/elasticsearch when I run the systemctl commands, so I assume systemctl just fails silently to do anything.

I have no idea what to check next. Is there some /etc/init.d/##elasticsearch script or something that is bad and needs to be replaced?

What does systemctl do on ubuntu? Does it find and run /etc/rc4.d/S01elasticsearch? Something else?

systemctl status elasticsearch says:

● elasticsearch.service - LSB: Starts elasticsearch
   Loaded: loaded (/etc/init.d/elasticsearch; bad; vendor preset: enabled)
   Active: active (exited) since Mon 2016-11-07 16:29:25 EST; 2min 26s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1151 ExecStart=/etc/init.d/elasticsearch start (code=exited, status=0

Nov 07 16:29:25 webci systemd[1]: Starting LSB: Starts elasticsearch...
Nov 07 16:29:25 webci elasticsearch[1151]:  * Starting Elasticsearch Server
Nov 07 16:29:25 webci elasticsearch[1151]:    ...done.
Nov 07 16:29:25 webci systemd[1]: Started LSB: Starts elasticsearch.

I think the above means it started and silently exited giving no useful log output. No additional logging from journalctl either.

If I use journalctl -xe I get a pile of clock noise, but nothing interesting:

Nov 07 16:33:44 webci elasticsearch[2273]:  * Starting Elasticsearch Server
Nov 07 16:33:44 webci elasticsearch[2273]:    ...done.
Nov 07 16:33:44 webci systemd[1]: Started LSB: Starts elasticsearch.
-- Subject: Unit elasticsearch.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit elasticsearch.service has finished starting up.
--
-- The start-up result is done.
Nov 07 16:33:44 webci sudo[2233]: pam_unix(sudo:session): session closed for use
Nov 07 16:34:08 webci smbd[2343]: pam_unix(samba:session): session closed for us
Nov 07 16:35:01 webci CRON[2356]: pam_unix(cron:session): session opened for use
Nov 07 16:35:01 webci CRON[2357]: (root) CMD (command -v debian-sa1 > /dev/null
Nov 07 16:35:01 webci CRON[2356]: pam_unix(cron:session): session closed for use
lin

It looks like a success, but the elasticsearch process is not running, and has exited.

Best Answer

You can use

systemctl status <service>

to get basic information about the status of the service an d

journalctl -xe

will show the contents of the systemd journal in a pager program and jump to the end of the journal. You may need to scroll up to get to the information you want.

Related Topic