Elasticsearch listening on /127.0.0.1:9001 . Also shows Main PID: 12471 (code=exited, status=1/FAILURE) error messages- ubuntu server 16.04.3

Hi

I am not been able to run sonarqube due to below mentioned log issue. Please advise how can i solved the issue

root@storage:/opt/sonar/logs# more sonar.log 
--> Wrapper Started as Daemon
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

2018.01.07 15:23:08 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonar/temp
**2018.01.07 15:23:08 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001**
2018.01.07 15:23:08 INFO  app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonar/elasticsea
rch]: /opt/sonar/elasticsearch/bin/elasticsearch -Epath.conf=/opt/sonar/temp/conf/es
2018.01.07 15:23:08 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2018.01.07 15:23:08 INFO  app[][o.e.p.PluginsService] no modules loaded
2018.01.07 15:23:08 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2018.01.07 15:23:08 WARN  app[][o.s.a.p.AbstractProcessMonitor] Process exited with exit value [es]: 1
2018.01.07 15:23:08 INFO  app[][o.s.a.SchedulerImpl] Process [es] is stopped
2018.01.07 15:23:08 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped
<-- Wrapper Stopped
--> Wrapper Started as Daemon
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

2018.01.07 15:29:05 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonar/temp
2018.01.07 15:29:05 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2018.01.07 15:29:05 INFO  app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonar/elasticsea
rch]: /opt/sonar/elasticsearch/bin/elasticsearch -Epath.conf=/opt/sonar/temp/conf/es
2018.01.07 15:29:05 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2018.01.07 15:29:05 INFO  app[][o.e.p.PluginsService] no modules loaded
2018.01.07 15:29:05 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2018.01.07 15:29:06 WARN  app[][o.s.a.p.AbstractProcessMonitor] Process exited with exit value [es]: 1
2018.01.07 15:29:06 INFO  app[][o.s.a.SchedulerImpl] Process [es] is stopped
2018.01.07 15:29:06 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped
<-- Wrapper Stopped
--> Wrapper Started as Daemon
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.''

root@storage:/opt/sonar/elasticsearch/config# sudo service elasticsearch status

● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2018-01-10 14:07:27 +0545; 4s ago
     Docs: http://www.elastic.co
  Process: 12471 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -Des.pidfile=${PID_DIR}/elasticsearch.pid -Des.default.path.home=${ES_HOME} -De
  Process: 12469 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec (code=exited, status=0/SUCCESS)
 **Main PID: 12471 (code=exited, status=1/FAILURE)**

Jan 10 14:07:27 storage elasticsearch[12471]:         at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1071)
Jan 10 14:07:27 storage elasticsearch[12471]:         at org.elasticsearch.common.settings.Settings$Builder.loadFromPath(Settings.java:1058)
Jan 10 14:07:27 storage elasticsearch[12471]:         at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareEnvironment(InternalSettings
Jan 10 14:07:27 storage elasticsearch[12471]:         at org.elasticsearch.bootstrap.Bootstrap.initialSettings(Bootstrap.java:202)
Jan 10 14:07:27 storage elasticsearch[12471]:         at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:241)
Jan 10 14:07:27 storage elasticsearch[12471]:         at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Jan 10 14:07:27 storage elasticsearch[12471]: Refer to the log for complete error details.
Jan 10 14:07:27 storage systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Jan 10 14:07:27 storage systemd[1]: elasticsearch.service: Unit entered failed state.
Jan 10 14:07:27 storage systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
lines 1-18/18 (END)

What’s Sonarqube?

SonarQube is an open source platform for continuous inspection of code quality to perform automatic reviews with static analysis of code to detect bugs, code smells and security vulnerabilities

Please format your code. I edited your post.
What are elasticsearch logs?

Please find the log output from below

**oot@storage:/opt/sonar/elasticsearch/logs# more elasticsearch.log**
[2018-01-09T17:10:20,404][ERROR][o.e.b.Bootstrap          ] Exception
java.lang.RuntimeException: can not run elasticsearch as root
	at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-5.6.3.jar:5.6.3]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:195) ~[elasticsearch-5.6.3.jar:5.6.3]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) [elasticsearch-5.6.3.jar:5.6.3]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) [elasticsearch-5.6.3.jar:5.6.3]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:123) [elasticsearch-5.6.3.jar:5.6.3]
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:70) [elasticsearch-5.6.3.jar:5.6.3]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) [elasticsearch-5.6.3.jar:5.6.3]
	at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-5.6.3.jar:5.6.3]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) [elasticsearch-5.6.3.jar:5.6.3]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) [elasticsearch-5.6.3.jar:5.6.3]
[2018-01-09T17:10:20,409][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-5.6.3.jar:5.6.3]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:123) ~[elasticsearch-5.6.3.jar:5.6.3]
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:70) ~[elasticsearch-5.6.3.jar:5.6.3]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) ~[elasticsearch-5.6.3.jar:5.6.3]
	at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-5.6.3.jar:5.6.3]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.6.3.jar:5.6.3]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.6.3.jar:5.6.3]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
	at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-5.6.3.jar:5.6.3]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:195) ~[elasticsearch-5.6.3.jar:5.6.3]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) ~[elasticsearch-5.6.3.jar:5.6.3]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) ~[elasticsearch-5.6.3.jar:5.6.3]
	... 6 more

root@storage:/opt/sonar/elasticsearch/logs# pwd

/opt/sonar/elasticsearch/logs
root@storage:/opt/sonar/elasticsearch/logs#
Just incase if you need to see sonar.log then below is here with
root@storage:/opt/sonar/logs# more sonar.log

--> Wrapper Started as Daemon
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

2018.01.07 15:23:08 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonar/temp
2018.01.07 15:23:08 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2018.01.07 15:23:08 INFO  app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonar/elasticsea
rch]: /opt/sonar/elasticsearch/bin/elasticsearch -Epath.conf=/opt/sonar/temp/conf/es
_**2018.01.07 15:23:08 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running**_
_**2018.01.07 15:23:08 INFO  app[][o.e.p.PluginsService] no modules loaded**_
_**2018.01.07 15:23:08 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]**_
_**2018.01.07 15:23:08 WARN  app[][o.s.a.p.AbstractProcessMonitor] Process exited with exit value [es]: 1**_
_**2018.01.07 15:23:08 INFO  app[][o.s.a.SchedulerImpl] Process [es] is stopped**_
_**2018.01.07 15:23:08 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped**_
<-- Wrapper Stopped
--> Wrapper Started as Daemon
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

Please format your logs with </>.

Caused by: java.lang.RuntimeException: can not run elasticsearch as root
Don't run elasticsearch as root.

Hi Dadoonet

I trigger as following commandfrom example user but it ask for root. How do

i change the user previlege so that i can run it from example user
example@storage:/opt/sonar/elasticsearch/bin$ /etc/init.d/elasticsearch

stopt

You need root privileges to run this script
example@storage:/opt/sonar/elasticsearch/bin$ /etc/init.d/elasticsearch stop

You need root privileges to run this script
example@storage:/opt/sonar/elasticsearch/bin$ /etc/init.d/elasticsearch

start

You need root privileges to run this script
example@storage:/opt/sonar/elasticsearch/bin$ sudo

/etc/init.d/elasticsearch start

[sudo] password for bsaitechnosales:

[ ok ] Starting elasticsearch (via systemctl): elasticsearch.service.

example@storage:/opt/sonar/elasticsearch/bin$
example@storage:/opt/sonar/elasticsearch/bin$ /etc/init.d/elasticsearch

status


You need root privileges to run this script
example@storage:/opt/sonar/elasticsearch/bin$ sudo

/etc/init.d/elasticsearch status


● elasticsearch.service - Elasticsearch

Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled;

vendor preset: enabled)

Active: failed (Result: exit-code) since Wed 2018-01-10 17:53:34 +0545;

2min 34s ago

Docs: http://www.elastic.co

Process: 20633 ExecStart=/usr/share/elasticsearch/bin/elasticsearch

-Des.pidfile=${PID_DIR}/elasticsearch.pid -Des.default.path.home=${ES_HOME}

-Des.default.path.logs=${LOG_DIR} -Des.default.path.data=${DATA_DIR}

-Des.default.path.conf=${CONF_DIR} (code=exited, status=1/FAILURE)

Process: 20630

ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec

(code=exited, status=0/SUCCESS)

Main PID: 20633 (code=exited, status=1/FAILURE)
Jan 10 17:53:33 storage systemd[1]: Starting Elasticsearch…

Jan 10 17:53:33 storage systemd[1]: Started Elasticsearch.

Jan 10 17:53:34 storage elasticsearch[20633]: Exception in thread “main”

SettingsException[Failed to load settings from [elasticsearch.yml]]; nest…

Jan 10 17:53:34 storage elasticsearch[20633]: in ‘reader’, line 96, column

1:

Jan 10 17:53:34 storage systemd[1]: elasticsearch.service: Main process

exited, code=exited, status=1/FAILURE

Jan 10 17:53:34 storage systemd[1]: elasticsearch.service: Unit entered

failed state.

Jan 10 17:53:34 storage systemd[1]: elasticsearch.service: Failed with

result ‘exit-code’.

Hint: Some lines were ellipsized, use -l to show in full.

bsaitechnosales@storage:/opt/sonar/elasticsearch/bin$

Please format your code using </> icon as explained in this guide. It will make your post more readable.
Or use markdown style like:

```
CODE
```

Is it ok if i paste in this way

Please don’t post images of text as they are hardly readable and not searchable.
Instead paste the text and format it with </> icon. Check the preview window.