Installing from source, Elasticsearch does not start

  • Operating system: OpenSUSE TW
# zypper repos --details |grep elast
4 | elasticsearch-7.x                | Elasticsearch repository for 7.x packages        | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://artifacts.elastic.co/packages/7.x/yum                       |

# zypper info elasticsearch
Loading repository data...
Reading installed packages...


Information for package elasticsearch:
--------------------------------------
Repository     : Elasticsearch repository for 7.x packages
Name           : elasticsearch
Version        : 7.17.8-1
Arch           : x86_64
Vendor         : Elasticsearch
Installed Size : 501.9 MiB
Installed      : Yes (automatically)
Status         : up-to-date
Source package : elasticsearch-7.17.8-1.
Upstream URL   : https://www.elastic.co/
Summary        : Distributed RESTful search engine built for the cloud
Description    : 
    Reference documentation can be found at
      https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
      and the 'Elasticsearch: The Definitive Guide' book can be found at
      https://www.elastic.co/guide/en/elasticsearch/guide/current/index.html

I followed
https://docs.zammad.org/en/latest/install/source.html
https://docs.zammad.org/en/latest/install/elasticsearch.html

Starting the elasticsearch on OpenSUSE fails:

# systemctl start elasticsearch
Job for elasticsearch.service failed because the control process exited with error code.
See "systemctl status elasticsearch.service" and "journalctl -xeu elasticsearch.service" for details.

# systemctl status elasticsearch.service
Γ— elasticsearch.service - Elasticsearch
     Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; preset: disabled)
     Active: failed (Result: exit-code) since Wed 2023-01-18 14:10:11 CET; 59s ago
       Docs: https://www.elastic.co
    Process: 12568 ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=1/FAILURE)
   Main PID: 12568 (code=exited, status=1/FAILURE)
        CPU: 4.168s

Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:160)
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77)
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at org.elasticsearch.cli.Command.main(Command.java:77)
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:125)
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)
Jan 18 14:10:11 zammad02 systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Jan 18 14:10:11 zammad02 systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
Jan 18 14:10:11 zammad02 systemd[1]: Failed to start Elasticsearch.
Jan 18 14:10:11 zammad02 systemd[1]: elasticsearch.service: Consumed 4.168s CPU time.

# journalctl -xeu elasticsearch.service
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:484)
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at java.base/java.nio.file.Files.newOutputStream(Files.java:228)
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at org.apache.lucene.store.FSDirectory$FSIndexOutput.<init>(FSDirectory.java:410)
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at org.apache.lucene.store.FSDirectory$FSIndexOutput.<init>(FSDirectory.java:406)
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at org.apache.lucene.store.FSDirectory.createOutput(FSDirectory.java:254)
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at org.elasticsearch.common.settings.KeyStoreWrapper.save(KeyStoreWrapper.java:501)
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at org.elasticsearch.bootstrap.Bootstrap.loadSecureSettings(Bootstrap.java:272)
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at org.elasticsearch.bootstrap.Bootstrap.loadSecureSettings(Bootstrap.java:247)
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:364)
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:169)
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:160)
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77)
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at org.elasticsearch.cli.Command.main(Command.java:77)
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:125)
Jan 18 14:10:11 zammad02 systemd-entrypoint[12568]:         at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)
Jan 18 14:10:11 zammad02 systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
β–‘β–‘ Subject: Unit process exited
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
β–‘β–‘ 
β–‘β–‘ An ExecStart= process belonging to unit elasticsearch.service has exited.
β–‘β–‘ 
β–‘β–‘ The process' exit code is 'exited' and its exit status is 1.
Jan 18 14:10:11 zammad02 systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
β–‘β–‘ Subject: Unit failed
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
β–‘β–‘ 
β–‘β–‘ The unit elasticsearch.service has entered the 'failed' state with result 'exit-code'.
Jan 18 14:10:11 zammad02 systemd[1]: Failed to start Elasticsearch.
β–‘β–‘ Subject: A start job for unit elasticsearch.service has failed
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
β–‘β–‘ 
β–‘β–‘ A start job for unit elasticsearch.service has finished with a failure.
β–‘β–‘ 
β–‘β–‘ The job identifier is 1153 and the job result is failed.
Jan 18 14:10:11 zammad02 systemd[1]: elasticsearch.service: Consumed 4.168s CPU time.
β–‘β–‘ Subject: Resources consumed by unit runtime
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
β–‘β–‘ 
β–‘β–‘ The unit elasticsearch.service completed and consumed the indicated resources.

The elasticsearch logfile should contain more information on what exactly happened. Also the whole journalctl output should. With only a small portion of this output nobody will be able to help you with that issue.

The logfile you’re searching lifes in /var/log/elasticsearch/elasticsearch.log in default installations.

That log file does not exist. I only found

# ls -al /var/log/elasticsearch/
total 56
drwxr-s--- 1 elasticsearch elasticsearch  246 Jan 30 16:23 .
drwxr-xr-x 1 root          root          1038 Jan 19 00:00 ..
-rw-r--r-- 1 elasticsearch elasticsearch 2800 Jan 30 16:23 gc.log
-rw-r--r-- 1 elasticsearch elasticsearch 2125 Jan 18 12:02 gc.log.00
-rw-r--r-- 1 elasticsearch elasticsearch 2442 Jan 18 12:02 gc.log.01
-rw-r--r-- 1 elasticsearch elasticsearch 2125 Jan 18 12:02 gc.log.02
-rw-r--r-- 1 elasticsearch elasticsearch 2266 Jan 18 12:02 gc.log.03
-rw-r--r-- 1 elasticsearch elasticsearch 2100 Jan 18 12:54 gc.log.04
-rw-r--r-- 1 elasticsearch elasticsearch 2241 Jan 18 12:54 gc.log.05
-rw-r--r-- 1 elasticsearch elasticsearch 2125 Jan 18 14:09 gc.log.06
-rw-r--r-- 1 elasticsearch elasticsearch 2266 Jan 18 14:10 gc.log.07
-rw-r--r-- 1 elasticsearch elasticsearch 2125 Jan 18 14:10 gc.log.08
-rw-r--r-- 1 elasticsearch elasticsearch 2266 Jan 18 14:10 gc.log.09
-rw-r--r-- 1 elasticsearch elasticsearch 2125 Jan 18 15:36 gc.log.10
-rw-r--r-- 1 elasticsearch elasticsearch 2266 Jan 18 15:36 gc.log.11
-rw-r--r-- 1 elasticsearch elasticsearch 2125 Jan 30 16:23 gc.log.12

In gc.log I can’t see any errors…
But in journalctl -xeu elasticsearch.service I found:
Jan 30 16:25:56 zammad02 systemd-entrypoint[22353]: Exception in thread "main" org.elasticsearch.bootstrap.BootstrapException: org.elasticsearch.cli.UserException: unable to create temporary keystore at [/etc/elasticsearch/elasticsearch.keystore.tmp], write permissions required for [/etc/elasticsearch] or run>

Permissions:

# ls -al /etc/elasticsearch/
total 44
drwxr-s--- 1 root elasticsearch   264 Jan 17 16:50 .
drwxr-xr-x 1 root root           3814 Jan 20 13:33 ..
-rw-rw---- 1 root elasticsearch  1042 Dec  2 18:35 elasticsearch-plugins.example.yml
-rw-rw---- 1 root elasticsearch  3431 Dec  2 18:35 elasticsearch.yml
-rw-rw---- 1 root elasticsearch  3329 Dec  2 18:35 jvm.options
drwxr-s--- 1 root elasticsearch     0 Dec  2 18:38 jvm.options.d
-rw-rw---- 1 root elasticsearch 19304 Dec  2 18:35 log4j2.properties
-rw-rw---- 1 root elasticsearch   473 Dec  2 18:35 role_mapping.yml
-rw-rw---- 1 root elasticsearch   197 Dec  2 18:35 roles.yml
-rw-rw---- 1 root elasticsearch     0 Dec  2 18:35 users
-rw-rw---- 1 root elasticsearch     0 Dec  2 18:35 users_roles
# chmod -Rc g+w /etc/elasticsearch/
mode of '/etc/elasticsearch/' changed from 2750 (rwxr-s---) to 2770 (rwxrws---)
mode of '/etc/elasticsearch/jvm.options.d' changed from 2750 (rwxr-s---) to 2770 (rwxrws---)

Now Elasticsearch is up and running. Thanks.

1 Like