Can't start elasticsearch service

Hello,

I am trying to start the elasticsearch service with the command systemctl start elasticsearch but I am getting this message

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

this is the current state of elasticsearch when running a systemctl status elasticsearch

systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2022-09-03 13:40:16 -05; 2min 37s ago
     Docs: http://www.elastic.co
  Process: 20405 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=1/FAILURE)
 Main PID: 20405 (code=exited, status=1/FAILURE)

Sep 03 13:40:16 vm-Name_of_my_Server elasticsearch[20405]:         at java.base/java.nio.file.Files.createDirectory(Files.java:693)
Sep 03 13:40:16 vm-Name_of_my_Server elasticsearch[20405]:         at java.base/java.nio.file.TempFileHelper.create(TempFileHelper.java:135)
Sep 03 13:40:16 vm-Name_of_my_Server elasticsearch[20405]:         at java.base/java.nio.file.TempFileHelper.createTempDirectory(TempFileHelper.java:172)
Sep 03 13:40:16 vm-Name_of_my_Server elasticsearch[20405]:         at java.base/java.nio.file.Files.createTempDirectory(Files.java:1010)
Sep 03 13:40:16 vm-Name_of_my_Server elasticsearch[20405]:         at org.elasticsearch.tools.launchers.Launchers.createTempDirectory(Launchers.java:66)
Sep 03 13:40:16 vm-Name_of_my_Server elasticsearch[20405]:         at org.elasticsearch.tools.launchers.TempDirectory.main(TempDirectory.java:54)
Sep 03 13:40:16 vm-Name_of_my_Server systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Sep 03 13:40:16 vm-Name_of_my_Server systemd[1]: Failed to start Elasticsearch.
Sep 03 13:40:16 vm-Name_of_my_Server systemd[1]: elasticsearch.service: Unit entered failed state.
Sep 03 13:40:16 vm-Name_of_my_Server systemd[1]: elasticsearch.service: Failed with result 'exit-code'.

When I go to the /etc/elasticsearch path and try to open the elasticsearch.yml file using nano I get the following message

" [ Error reading lock file ./.elasticsearch.yml.swp: Not enough data read ]"

with this I understand from my ignorance that it may be the cause

thank you help me to solve this problem

image

What does

sudo journalctl --unit elasticsearch

Show?

The nano thing looks like you don't have privilege to edit the file.

cd /etc/elasticsearch
ls -la
1 Like

Hello, thank you very much for answering

sudo journalctl --unit elasticsearch

-- Logs begin at Sat 2022-09-03 09:43:46 -05, end at Sat 2022-09-03 14:56:42 -05. --
Sep 03 12:51:06 vm-NameOfServer systemd[1]: Stopping Elasticsearch...
Sep 03 12:51:12 vm-NameOfServer systemd[1]: Stopped Elasticsearch.
Sep 03 12:51:12 vm-NameOfServer systemd[1]: Starting Elasticsearch...
Sep 03 12:51:12 vm-NameOfServer elasticsearch[8083]: Exception in thread "main" java.nio.file.FileSystemException: /tmp/elasticsearch-15990650543455083721: No space left o
Sep 03 12:51:12 vm-NameOfServer elasticsearch[8083]:         at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
Sep 03 12:51:12 vm-NameOfServer elasticsearch[8083]:         at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
Sep 03 12:51:12 vm-NameOfServer elasticsearch[8083]:         at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
Sep 03 12:51:12 vm-NameOfServer elasticsearch[8083]:         at java.base/sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:389)
Sep 03 12:51:12 vm-NameOfServer elasticsearch[8083]:         at java.base/java.nio.file.Files.createDirectory(Files.java:693)
Sep 03 12:51:12 vm-NameOfServer elasticsearch[8083]:         at java.base/java.nio.file.TempFileHelper.create(TempFileHelper.java:135)
Sep 03 12:51:12 vm-NameOfServer elasticsearch[8083]:         at java.base/java.nio.file.TempFileHelper.createTempDirectory(TempFileHelper.java:172)
Sep 03 12:51:12 vm-NameOfServer elasticsearch[8083]:         at java.base/java.nio.file.Files.createTempDirectory(Files.java:1010)
Sep 03 12:51:12 vm-NameOfServer elasticsearch[8083]:         at org.elasticsearch.tools.launchers.Launchers.createTempDirectory(Launchers.java:66)
Sep 03 12:51:12 vm-NameOfServer elasticsearch[8083]:         at org.elasticsearch.tools.launchers.TempDirectory.main(TempDirectory.java:54)
Sep 03 12:51:12 vm-NameOfServer systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Sep 03 12:51:12 vm-NameOfServer systemd[1]: Failed to start Elasticsearch.
Sep 03 12:51:12 vm-NameOfServer systemd[1]: elasticsearch.service: Unit entered failed state.
Sep 03 12:51:12 vm-NameOfServer systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
Sep 03 12:52:53 vm-NameOfServer systemd[1]: Starting Elasticsearch...
Sep 03 12:52:53 vm-NameOfServer elasticsearch[9195]: Exception in thread "main" java.nio.file.FileSystemException: /tmp/elasticsearch-13993745165102556584: No space left o
Sep 03 12:52:53 vm-NameOfServer elasticsearch[9195]:         at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
Sep 03 12:52:53 vm-NameOfServer elasticsearch[9195]:         at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
Sep 03 12:52:53 vm-NameOfServer elasticsearch[9195]:         at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
Sep 03 12:52:53 vm-NameOfServer elasticsearch[9195]:         at java.base/sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:389)
Sep 03 12:52:53 vm-NameOfServer elasticsearch[9195]:         at java.base/java.nio.file.Files.createDirectory(Files.java:693)
Sep 03 12:52:53 vm-NameOfServer elasticsearch[9195]:         at java.base/java.nio.file.TempFileHelper.create(TempFileHelper.java:135)
Sep 03 12:52:53 vm-NameOfServer elasticsearch[9195]:         at java.base/java.nio.file.TempFileHelper.createTempDirectory(TempFileHelper.java:172)
Sep 03 12:52:53 vm-NameOfServer elasticsearch[9195]:         at java.base/java.nio.file.Files.createTempDirectory(Files.java:1010)
Sep 03 12:52:53 vm-NameOfServer elasticsearch[9195]:         at org.elasticsearch.tools.launchers.Launchers.createTempDirectory(Launchers.java:66)
Sep 03 12:52:53 vm-NameOfServer elasticsearch[9195]:         at org.elasticsearch.tools.launchers.TempDirectory.main(TempDirectory.java:54)
Sep 03 12:52:53 vm-NameOfServer systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Sep 03 12:52:53 vm-NameOfServer systemd[1]: Failed to start Elasticsearch.
Sep 03 12:52:53 vm-NameOfServer systemd[1]: elasticsearch.service: Unit entered failed state.
Sep 03 12:52:53 vm-NameOfServer systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
Sep 03 12:53:17 vm-NameOfServer systemd[1]: Starting Elasticsearch...
Sep 03 12:53:18 vm-NameOfServer elasticsearch[9550]: Exception in thread "main" java.nio.file.FileSystemException: /tmp/elasticsearch-12676006695491231883: No space left o
Sep 03 12:53:18 vm-NameOfServer elasticsearch[9550]:         at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
Sep 03 12:53:18 vm-NameOfServer elasticsearch[9550]:         at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
Sep 03 12:53:18 vm-NameOfServer elasticsearch[9550]:         at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
Sep 03 12:53:18 vm-NameOfServer elasticsearch[9550]:         at java.base/sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:389)
Sep 03 12:53:18 vm-NameOfServer elasticsearch[9550]:         at java.base/java.nio.file.Files.createDirectory(Files.java:693)
Sep 03 12:53:18 vm-NameOfServer elasticsearch[9550]:         at java.base/java.nio.file.TempFileHelper.create(TempFileHelper.java:135)

cd /etc/elasticsearch
ls -la

ls -la
total 56
drwxr-s---  2 root elasticsearch  4096 Sep  3 14:18 .
drwxr-xr-x 85 root root           4096 Aug  3 14:19 ..
-rw-r--r--  1 root elasticsearch    76 Jul 28  2021 .elasticsearch.keystore.initial_md5sum
-rw-rw----  1 root elasticsearch   199 Jul 28  2021 elasticsearch.keystore
-rw-rw----  1 root elasticsearch  3005 Jun 23 22:27 elasticsearch.yml
-rw-r-----  1 root elasticsearch  3007 Jun 23 22:26 elasticsearch.yml.bak
-rw-rw----  1 root elasticsearch  2416 Sep  3 13:16 jvm.options
-rw-rw----  1 root elasticsearch 17545 Feb  5  2020 log4j2.properties
-rw-rw----  1 root elasticsearch   473 Feb  5  2020 role_mapping.yml
-rw-rw----  1 root elasticsearch   197 Feb  5  2020 roles.yml
-rw-rw----  1 root elasticsearch     0 Feb  5  2020 users
-rw-rw----  1 root elasticsearch     0 Feb  5  2020 users_roles

I have run the command ls -a and was able to find the . swp and deleted it

I tried to start the elasticsearch service again but it still does not start, it seems that this swp file was not related to the problem.

You have no space on /tmp

1 Like

this contains the path /tmp/

**ls -la**
total 148
drwxrwxrwt 37 root          root          4096 Sep  3 15:10 .
drwxr-xr-x 24 root          root          4096 Jun 23 22:23 ..
drwxrwxrwt  2 root          root          4096 Jun 23 09:05 .ICE-unix
drwxrwxrwt  2 root          root          4096 Jun 23 09:05 .Test-unix
drwxrwxrwt  2 root          root          4096 Jun 23 09:05 .X11-unix
drwxrwxrwt  2 root          root          4096 Jun 23 09:05 .XIM-unix
drwxrwxrwt  2 root          root          4096 Jun 23 09:05 .font-unix
drwx------  3 kibana        kibana        4096 Aug  8 22:52 chromium-4NE4Rr
drwx------  3 kibana        kibana        4096 Aug  8 22:05 chromium-83svvC
drwx------  3 kibana        kibana        4096 Jul 18 14:24 chromium-8UNR56
drwx------  3 kibana        kibana        4096 Jun 23 22:30 chromium-E96KXd
drwx------  3 kibana        kibana        4096 Sep  1 00:21 chromium-IN8Ltk
drwx------  3 kibana        kibana        4096 Jul 18 14:16 chromium-IOh2S0
drwx------  3 kibana        kibana        4096 Jul 18 14:07 chromium-LkXDeJ
drwx------  3 kibana        kibana        4096 Aug 11 21:08 chromium-LvWqJb
drwx------  3 kibana        kibana        4096 Jun 23 22:39 chromium-Ns74E9
drwx------  3 kibana        kibana        4096 Jul 18 14:33 chromium-W4NL6a
drwx------  3 kibana        kibana        4096 Aug 11 20:59 chromium-WLeFnm
drwx------  3 kibana        kibana        4096 Aug  1 03:42 chromium-hROSRj
drwx------  3 kibana        kibana        4096 Aug 31 13:34 chromium-hYfiXn
drwx------  3 kibana        kibana        4096 Aug 16 16:34 chromium-hnR7TH
drwx------  3 kibana        kibana        4096 Jun 23 22:51 chromium-iZa1Rt
drwx------  3 kibana        kibana        4096 Aug  5 14:26 chromium-jm3Aw9
drwx------  3 kibana        kibana        4096 Jul  1 00:05 chromium-l0FzxJ
drwx------  3 kibana        kibana        4096 Aug 30 17:48 chromium-oYQIbj
drwx------  3 kibana        kibana        4096 Jun 30 21:56 chromium-yoV4hi
drwx------  2 elasticsearch elasticsearch 4096 Jun 23 11:02 elasticsearch-7976603994365740536
drwxr-xr-x  2 elasticsearch elasticsearch 4096 Jun 23 11:08 hsperfdata_elasticsearch
drwxr-xr-x  2 logstash      logstash      4096 Sep  3 15:10 hsperfdata_logstash
-rw-r--r--  1 logstash      logstash         0 Sep  3 15:10 jffi5340943425578139866.so
drwxr-xr-x  2 logstash      logstash      4096 Jul 18 14:23 jruby-13497
drwxr-xr-x  2 logstash      logstash      4096 Jul 18 14:31 jruby-18491
drwxr-xr-x  2 logstash      logstash      4096 Sep  3 14:56 jruby-22196
drwxr-xr-x  2 logstash      logstash      4096 Jun 23 16:55 jruby-26919
drwxr-xr-x  2 logstash      logstash      4096 Aug 11 22:23 jruby-29518
drwxr-xr-x  2 logstash      logstash      4096 Aug 31 13:31 jruby-31745
drwxr-xr-x  2 logstash      logstash      4096 Jun 23 10:35 jruby-4791
drwx------  3 root          root          4096 Jun 23 09:05 systemd-private-6e7f7ba50c0249c8878a561b157cd2cd-systemd-timesyncd.service-SKjW27

You have no disk space left in /tmp.

df -h

You need to free up disk space

1 Like

I see a partition that is at 100%

df -h
Filesystem      Size  Used Avail Use% Mounted on
udev             16G     0   16G   0% /dev
tmpfs           3.2G  306M  2.9G  10% /run
/dev/sda1        30G   29G     0 100% /
tmpfs            16G   28K   16G   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            16G     0   16G   0% /sys/fs/cgroup
/dev/sdb1        63G   53M   60G   1% /mnt/resource
tmpfs           3.2G     0  3.2G   0% /run/user/1000
/dev/sdc1       4.0T  3.1T  704G  82% /opt

Yep, you need to clean up and make some disk space on /

1 Like

actually that was the reason

Thank you very much for your help

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.