Sonarqube 7.9.1 Community edition: Service starts and listening on localhost and port 9000 but not accessible in browser

Sonarqube 7.9.1 Community edition, open jdk 11, with mysql 5.7.27
I am trying to setup and install sonarqube community edition on Ubuntu 18.04
The service gets started but is not reachable on browser interface.
Below is the service status:

    `devsecops@ubuntu:~$ sudo service sonarqube status
    [sudo] password for devsecops: 
    ● sonarqube.service - SonarQube service
       Loaded: loaded (/etc/systemd/system/sonarqube.service; enabled; vendor preset
       Active: active (running) since Fri 2019-09-06 09:38:51 PDT; 16s ago
      Process: 9379 ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop (code=exi
      Process: 9426 ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh start (code=e
     Main PID: 9475 (wrapper)
        Tasks: 112 (limit: 3513)
       CGroup: /system.slice/sonarqube.service
               β”œβ”€9475 /opt/sonarqube/bin/linux-x86-64/./wrapper /opt/sonarqube/bin/l
               β”œβ”€9477 java -Dsonar.wrapped=true -Djava.awt.headless=true -Xms8m -Xmx
               β”œβ”€9508 /usr/lib/jvm/java-11-openjdk-amd64/bin/java -XX:+UseConcMarkSw
               └─9615 /usr/lib/jvm/java-11-openjdk-amd64/bin/java -Djava.awt.headles

    Sep 06 09:38:50 ubuntu systemd[1]: sonarqube.service: Scheduled restart job, res
    Sep 06 09:38:50 ubuntu systemd[1]: Stopped SonarQube service.
    Sep 06 09:38:50 ubuntu systemd[1]: Starting SonarQube service...
    Sep 06 09:38:50 ubuntu sonar.sh[9426]: Starting SonarQube...
    Sep 06 09:38:51 ubuntu sonar.sh[9426]: Started SonarQube.
    Sep 06 09:38:51 ubuntu systemd[1]: Started SonarQube service.
**sonar.properties file** 
    `sonar.jdbc.username=sonarqube
    sonar.jdbc.password=some_secure_password
    sonar.jdbc.url=jdbc:mysql://localhost:3306/sonarqube?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false`

sonarqube service file

   `[Unit]
Description=SonarQube service
After=syslog.target network.target

[Service]
Type=forking


ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh start
ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop

User=sonarqube
Group=sonarqube
Restart=always

[Install]
WantedBy=multi-user.target` 

sonar url on localhost
sonar

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.

2019.09.06 10:29:20 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2019.09.06 10:29:20 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.09.06 10:29:20 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2019.09.06 10:29:20 INFO  app[ ][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2019.09.06 10:29:20 INFO  app[][o.e.p.PluginsService] no modules loaded
2019.09.06 10:29:20 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]

Hi,

see

Gilbert

1 Like

Hi Thanks for responding,

I have tried installing sonar almost 10 times with different settings but I am highly frustrated right now.
It just wont come up. As you have mentioned MySQL support is stopped now. So i have tried using PostgreSQL now. If you can please direct me towards a solution or blog which is latest.

Below is my sonar.log file

β†’ 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.
2019.10.06 08:38:11 INFO app[o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2019.10.06 08:38:11 INFO app[o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.10.06 08:38:11 INFO app[o.s.a.p.ProcessLauncherImpl] Launch process[[key=β€˜es’, ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch -Epath.conf=/opt/sonarqube/temp/conf/es
2019.10.06 08:38:11 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2019.10.06 08:38:12 INFO app[o.e.p.PluginsService] no modules loaded
2019.10.06 08:38:12 INFO app[o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/opt/sonarqube/lib/common/netty-common-4.1.13.Final.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2019.10.06 08:38:25 INFO app[o.s.a.SchedulerImpl] Process[es] is up
2019.10.06 08:38:25 INFO app[o.s.a.p.ProcessLauncherImpl] Launch process[[key=β€˜web’, ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonarqube]: /usr/lib/jvm/java-11-openjdk-amd64/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -cp ./lib/common/*:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.5.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process418097564170168984properties
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/opt/sonarqube/lib/common/netty-common-4.1.13.Final.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2019.10.06 08:38:40 INFO app[o.s.a.SchedulerImpl] Process [web] is stopped
2019.10.06 08:38:41 WARN app[o.s.a.p.AbstractProcessMonitor] Process exited with exit value [es]: 143
2019.10.06 08:38:41 INFO app[o.s.a.SchedulerImpl] Process [es] is stopped
2019.10.06 08:38:41 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped
← Wrapper Stopped

Hi,

this is ES related

2019.10.06 08:38:41 WARN app[o.s.a.p.AbstractProcessMonitor] Process exited with exit value [es]: 143

Check $SONARQUBE_HOME/logs/es.log for further details.
Also see https://docs.sonarqube.org/latest/requirements/requirements/ => Platform notes Linux
and check whether all requirements are fullfilled.

Gilbert

1 Like

Hi Gilbert,

Thanks for your prompt support, I have already done the changes in below values as prescribed in sonarqube documentation page you shared.

sysctl -w vm.max_map_count=262144
sysctl -w fs.file-max=65536
ulimit -n 65536
ulimit -u 4096

But there is still some issue can you or anyone in the community help me troubleshoot this.
Attaching some logs and outputs for your reference here.
Below is the output of my sonar.sh file.

sonar@ubuntu:/opt/sonarqube/bin/linux-x86-64$ ./sonar.sh start
Starting SonarQube...
Started SonarQube.
sonar@ubuntu:/opt/sonarqube/bin/linux-x86-64$ ./sonar.sh status
SonarQube is running (2320).
sonar@ubuntu:/opt/sonarqube/bin/linux-x86-64$ ./sonar.sh status
SonarQube is not running.
sonar@ubuntu:/opt/sonarqube/bin/linux-x86-64$

`
Also below are some latest logs from es.log file

2019.10.07 14:09:54 INFO  es[][o.e.n.Node] initializing ...
2019.10.07 14:09:54 INFO  es[][o.e.e.NodeEnvironment] using [1] data paths, mounts [[/ (/dev/sda1)]], net usable_space [11.2gb], net total_space [19.5gb], spins? [possibly], types [ext4]
2019.10.07 14:09:54 INFO  es[][o.e.e.NodeEnvironment] heap size [503.6mb], compressed ordinary object pointers [true]
2019.10.07 14:09:54 INFO  es[][o.e.n.Node] node name [sonarqube], node ID [SMgqu5CET2qyGck3m9NFrQ]
2019.10.07 14:09:54 INFO  es[][o.e.n.Node] version[5.6.3], pid[2344], build[1a2f265/2017-10-06T20:33:39.012Z], OS[Linux/5.0.0-31-generic/amd64], JVM[Ubuntu/OpenJDK 64-Bit Server VM/11.0.4/11.0.4+11-post-Ubuntu-1ubuntu218.04.3]
2019.10.07 14:09:54 INFO  es[][o.e.n.Node] JVM arguments [-XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -Xms512m, -Xmx512m, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/opt/sonarqube/elasticsearch]
2019.10.07 14:09:55 INFO  es[][o.e.p.PluginsService] loaded module [aggs-matrix-stats]
2019.10.07 14:09:55 INFO  es[][o.e.p.PluginsService] loaded module [ingest-common]
2019.10.07 14:09:55 INFO  es[][o.e.p.PluginsService] loaded module [parent-join]
2019.10.07 14:09:55 INFO  es[][o.e.p.PluginsService] loaded module [percolator]
2019.10.07 14:09:55 INFO  es[][o.e.p.PluginsService] loaded module [reindex]
2019.10.07 14:09:55 INFO  es[][o.e.p.PluginsService] loaded module [transport-netty4]
2019.10.07 14:09:55 INFO  es[][o.e.p.PluginsService] no plugins loaded
2019.10.07 14:09:58 INFO  es[][o.e.d.DiscoveryModule] using discovery type [zen]
2019.10.07 14:09:59 INFO  es[][o.e.n.Node] initialized
2019.10.07 14:09:59 INFO  es[][o.e.n.Node] starting ...
2019.10.07 14:09:59 INFO  es[][o.e.t.TransportService] publish_address {127.0.0.1:9001}, bound_addresses {127.0.0.1:9001}
2019.10.07 14:10:02 INFO  es[][o.e.c.s.ClusterService] new_master {sonarqube}{SMgqu5CET2qyGck3m9NFrQ}{S6deqD2zQuyF8hjdzhFZmA}{127.0.0.1}{127.0.0.1:9001}{rack_id=sonarqube}, reason: zen-disco-elected-as-master ([0] nodes joined)
2019.10.07 14:10:02 INFO  es[][o.e.n.Node] started
2019.10.07 14:10:02 INFO  es[][o.e.g.GatewayService] recovered [0] indices into cluster_state
2019.10.07 14:10:10 INFO  es[][o.e.n.Node] stopping ...
2019.10.07 14:10:10 INFO  es[][o.e.n.Node] stopped
2019.10.07 14:10:10 INFO  es[][o.e.n.Node] closing ...
2019.10.07 14:10:10 INFO  es[][o.e.n.Node] closed

sonar.log file

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.

2019.10.07 14:09:49 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2019.10.07 14:09:49 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.10.07 14:09:49 INFO  app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch -Epath.conf=/opt/sonarqube/temp/conf/es
2019.10.07 14:09:49 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2019.10.07 14:09:50 INFO  app[][o.e.p.PluginsService] no modules loaded
2019.10.07 14:09:50 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/opt/sonarqube/lib/common/netty-common-4.1.13.Final.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2019.10.07 14:10:03 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2019.10.07 14:10:03 INFO  app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonarqube]: /usr/lib/jvm/java-11-openjdk-amd64/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -cp ./lib/common/*:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.5.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process15825974849717185881properties
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/opt/sonarqube/lib/common/netty-common-4.1.13.Final.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2019.10.07 14:10:10 INFO  app[][o.s.a.SchedulerImpl] Process [web] is stopped
2019.10.07 14:10:10 WARN  app[][o.s.a.p.AbstractProcessMonitor] Process exited with exit value [es]: 143
2019.10.07 14:10:10 INFO  app[][o.s.a.SchedulerImpl] Process [es] is stopped
2019.10.07 14:10:10 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped
<-- Wrapper Stopped

Hi,

not an ES expert, i compared with my logs - though running on Windows.
I’m surprised your es.log has this jvm arguments:

2019.10.07 14:09:54 INFO es[o.e.n.Node] JVM arguments [-XX:+UseConcMarkSweepGC, … -Xms512m, -Xmx512m, -XX:+HeapDumpOnOutOfMemoryError, -…

AFAIK, the default setting - if not set otherwise in …/conf/sonarqube.properties via sonar.search.javaOpts property - is Xms and Xmx = 2G, 512MB seems too low.

I would try = stop Sonarqube, increase xms / xmx for ES, then delete $SONARQUBE_HOME/data/es6 for rebuilding the indices, afterwards restart.

Also, as you are running Sonarqube as a service via systemd, see
Operating the server =>
Running SonarQube as a Service on Linux with SystemD
i.e. you cannot run Sonarqube as root

HTH,
Gilbert