I am too facing issue in starting Sonarqube 7.9.1 community edition.
I am using ubuntu LTS 18.04 operatig system and PostgreSQL 11.6 database.
Below are the steps i followed:
Already have postgresql database running in my machine:
-
Switch to the postgres user.
su - postgres
-
Create a new user by typing:
createuser sonarqube
-
Switch to the PostgreSQL shell.
psql
-
Set a password for the newly created user for SonarQube database.
ALTER USER sonarqube WITH ENCRYPTED password âsome_secure_passwordâ;
-
Create a new database for PostgreSQL database by running:
CREATE DATABASE sonarqube OWNER sonarqube;
-
Exit from the psql shell:
\q
-
Switch back to the sudo user by running the exit command.
exit
Sonarqube Installation:
-
Downloaded sonarqube 7.9.1 community edition from:
https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-7.9.1.zip
-
Extracted the zip file.
-
Moved all the contents inside the extracted folder sonarqube-7.9.1, to /opt/sonarqube
-
create the sonarqube user:
sudo adduser --system --no-create-home --group --disabled-login sonarqube
-
Finally, update the permissions so that the sonarqube user will own these files, and be able to read and write files in this directory:
sudo chown -R sonarqube:sonarqube /opt/sonarqube
-
sudo nano /sonarqube/conf/sonar.properties
sonar.jdbc.username=sonarqube
sonar.jdbc.password=some_secure_password
sonar.jdbc.url=jdbc:postgresql://localhost/sonarqube
sonar.web.javaAdditionalOpts=-server
Configure Systemd service:
-
sudo nano /etc/systemd/system/sonarqube.service
-
Included below scripts
[Unit]
Description=SonarQube service
After=syslog.target network.target
[Service]
Type=simple
User=sonarqube
Group=sonarqube
PermissionsStartOnly=true
ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh start
ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop
StandardOutput=syslog
LimitNOFILE=65536
LimitNPROC=8192
TimeoutStartSec=5
Restart=always
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
-
Start the application by running:
sudo systemctl start sonarqube
-
Enable the SonarQube service to automatically start at boot time.
sudo systemctl enable sonarqube
-
To check if the service is running, run:
sudo systemctl status sonarqube
sonarqube.service - SonarQube service
Loaded: loaded (/etc/systemd/system/sonarqube.service; enabled; vendor preset: enabled)
Active: deactivating (stop-sigterm) (Result: exit-code) since Sat 2019-11-16 21:08:12 IST; 1s ago
Process: 20140 ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop (code=exited, status=1/FAILURE)
Process: 20058 ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh start (code=exited, status=0/SUCCESS)
Main PID: 20058 (code=exited, status=0/SUCCESS)
Tasks: 49 (limit: 4915)
CGroup: /system.slice/sonarqube.service
ââ20108 /opt/sonarqube/bin/linux-x86-64/./wrapper /opt/sonarqube/bin/linux-x86-64/../../conf/wrapper.conf wrapper.syslog.ident=SonarQube wrapper.pidfile=/opt/sonarqube/bin/linux-x86-64/./SonarQube.pid
ââ20110 java -Dsonar.wrapped=true -Djava.awt.headless=true -Xms8m -Xmx32m -Djava.library.path=./lib -classpath ../../lib/jsw/wrapper-3.2.3.jar:../../lib/common/jackson-dataformat-smile-2.8.11.jar:../.
ââ20208 /usr/lib/jvm/java-11-openjdk-amd64/bin/java -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Des.networkaddress.cache.ttl=60 -Des.networkaddres
Nov 16 21:08:11 yuvarajvelmurugan-B250M-D3H systemd[1]: Started SonarQube service.
Nov 16 21:08:11 yuvarajvelmurugan-B250M-D3H sonar.sh[20058]: Starting SonarQube...
Nov 16 21:08:12 yuvarajvelmurugan-B250M-D3H sonar.sh[20058]: Started SonarQube.
Nov 16 21:08:12 yuvarajvelmurugan-B250M-D3H su[20188]: Successful su for sonarqube by root
Nov 16 21:08:12 yuvarajvelmurugan-B250M-D3H su[20188]: + ??? root:sonarqube
Nov 16 21:08:12 yuvarajvelmurugan-B250M-D3H su[20188]: pam_unix(su:session): session opened for user sonarqube by (uid=0)
Nov 16 21:08:12 yuvarajvelmurugan-B250M-D3H su[20188]: pam_unix(su:session): session closed for user sonarqube
Nov 16 21:08:12 yuvarajvelmurugan-B250M-D3H sonar.sh[20140]: This account is currently not available.
Nov 16 21:08:12 yuvarajvelmurugan-B250M-D3H systemd[1]: sonarqube.service: Control process exited, code=exited status=1
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.
TERM trapped. Shutting down.
2019.11.16 20:33:22 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2019.11.16 20:33:22 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.11.16 20:33:22 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2019.11.16 20:33:22 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.11.16 20:33:22 INFO app[][o.e.p.PluginsService] no modules loaded
2019.11.16 20:33:22 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2019.11.16 20:33:24 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143
2019.11.16 20:33:24 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped
2019.11.16 20:33:24 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
<-- Wrapper Stopped
After Debugging enabled in log level:
--> 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.
TERM trapped. Shutting down.
2019.11.16 20:03:44 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2019.11.16 20:03:44 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.11.16 20:03:44 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2019.11.16 20:03:45 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.11.16 20:03:45 INFO app[][o.e.p.PluginsService] no modules loaded
2019.11.16 20:03:45 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2019.11.16 20:03:45 DEBUG app[][o.e.t.ThreadPool] created thread pool: name [force_merge], size [1], queue size [unbounded]
2019.11.16 20:03:45 DEBUG app[][o.e.t.ThreadPool] created thread pool: name [fetch_shard_started], core [1], max [8], keep alive [5m]
2019.11.16 20:03:45 DEBUG app[][o.e.t.ThreadPool] created thread pool: name [listener], size [2], queue size [unbounded]
2019.11.16 20:03:45 DEBUG app[][o.e.t.ThreadPool] created thread pool: name [index], size [4], queue size [200]
2019.11.16 20:03:45 DEBUG app[][o.e.t.ThreadPool] created thread pool: name [refresh], core [1], max [2], keep alive [5m]
2019.11.16 20:03:45 DEBUG app[][o.e.t.ThreadPool] created thread pool: name [generic], core [4], max [128], keep alive [30s]
2019.11.16 20:03:45 DEBUG app[][o.e.t.ThreadPool] created thread pool: name [warmer], core [1], max [2], keep alive [5m]
2019.11.16 20:03:45 DEBUG app[][o.e.c.u.c.QueueResizingEsThreadPoolExecutor] thread pool [_client_/search] will adjust queue by [50] when determining automatic queue size
2019.11.16 20:03:45 DEBUG app[][o.e.t.ThreadPool] created thread pool: name [search], size [7], queue size [1k]
2019.11.16 20:03:45 DEBUG app[][o.e.t.ThreadPool] created thread pool: name [flush], core [1], max [2], keep alive [5m]
2019.11.16 20:03:45 DEBUG app[][o.e.t.ThreadPool] created thread pool: name [fetch_shard_store], core [1], max [8], keep alive [5m]
2019.11.16 20:03:45 DEBUG app[][o.e.t.ThreadPool] created thread pool: name [management], core [1], max [5], keep alive [5m]
2019.11.16 20:03:45 DEBUG app[][o.e.t.ThreadPool] created thread pool: name [get], size [4], queue size [1k]
2019.11.16 20:03:45 DEBUG app[][o.e.t.ThreadPool] created thread pool: name [analyze], size [1], queue size [16]
2019.11.16 20:03:45 DEBUG app[][o.e.t.ThreadPool] created thread pool: name [write], size [4], queue size [200]
2019.11.16 20:03:45 DEBUG app[][o.e.t.ThreadPool] created thread pool: name [snapshot], core [1], max [2], keep alive [5m]
2019.11.16 20:03:45 DEBUG app[][o.e.c.u.c.QueueResizingEsThreadPoolExecutor] thread pool [_client_/search_throttled] will adjust queue by [50] when determining automatic queue size
2019.11.16 20:03:45 DEBUG app[][o.e.t.ThreadPool] created thread pool: name [search_throttled], size [1], queue size [100]
2019.11.16 20:03:45 DEBUG app[][i.n.u.i.PlatformDependent0] -Dio.netty.noUnsafe: false
2019.11.16 20:03:45 DEBUG app[][i.n.u.i.PlatformDependent0] Java version: 11
2019.11.16 20:03:45 DEBUG app[][i.n.u.i.PlatformDependent0] sun.misc.Unsafe.theUnsafe: available
2019.11.16 20:03:45 DEBUG app[][i.n.u.i.PlatformDependent0] sun.misc.Unsafe.copyMemory: available
2019.11.16 20:03:45 DEBUG app[][i.n.u.i.PlatformDependent0] java.nio.Buffer.address: available
2019.11.16 20:03:45 DEBUG app[][i.n.u.i.PlatformDependent0] direct buffer constructor: unavailable
java.lang.UnsupportedOperationException: Reflective setAccessible(true) disabled
at io.netty.util.internal.ReflectionUtil.trySetAccessible(ReflectionUtil.java:31)
at io.netty.util.internal.PlatformDependent0$4.run(PlatformDependent0.java:224)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:218)
at io.netty.util.internal.PlatformDependent.isAndroid(PlatformDependent.java:212)
at io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:80)
at io.netty.util.ConstantPool.<init>(ConstantPool.java:32)
at io.netty.util.AttributeKey$1.<init>(AttributeKey.java:27)
at io.netty.util.AttributeKey.<clinit>(AttributeKey.java:27)
at org.elasticsearch.transport.netty4.Netty4Transport.<clinit>(Netty4Transport.java:219)
at org.elasticsearch.transport.Netty4Plugin.getSettings(Netty4Plugin.java:57)
at org.elasticsearch.plugins.PluginsService.lambda$getPluginSettings$0(PluginsService.java:89)
at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:271)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at org.elasticsearch.plugins.PluginsService.getPluginSettings(PluginsService.java:89)
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:147)
at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:277)
at org.sonar.application.es.EsConnectorImpl$MinimalTransportClient.<init>(EsConnectorImpl.java:103)
at org.sonar.application.es.EsConnectorImpl.buildTransportClient(EsConnectorImpl.java:89)
at org.sonar.application.es.EsConnectorImpl.getTransportClient(EsConnectorImpl.java:74)
at org.sonar.application.es.EsConnectorImpl.getClusterHealthStatus(EsConnectorImpl.java:61)
at org.sonar.application.process.EsManagedProcess.checkStatus(EsManagedProcess.java:88)
at org.sonar.application.process.EsManagedProcess.checkOperational(EsManagedProcess.java:73)
at org.sonar.application.process.EsManagedProcess.isOperational(EsManagedProcess.java:58)
at org.sonar.application.process.ManagedProcessHandler.refreshState(ManagedProcessHandler.java:201)
at org.sonar.application.process.ManagedProcessHandler$EventWatcher.run(ManagedProcessHandler.java:258)
2019.11.16 20:03:45 DEBUG app[][i.n.u.i.PlatformDependent0] java.nio.Bits.unaligned: available, true
2019.11.16 20:03:45 DEBUG app[][i.n.u.i.PlatformDependent0] jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable
java.lang.IllegalAccessException: class io.netty.util.internal.PlatformDependent0$6 cannot access class jdk.internal.misc.Unsafe (in module java.base) because module java.base does not export jdk.internal.misc to unnamed module @515f550a
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:591)
at java.base/java.lang.reflect.Method.invoke(Method.java:558)
at io.netty.util.internal.PlatformDependent0$6.run(PlatformDependent0.java:334)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:325)
at io.netty.util.internal.PlatformDependent.isAndroid(PlatformDependent.java:212)
at io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:80)
at io.netty.util.ConstantPool.<init>(ConstantPool.java:32)
at io.netty.util.AttributeKey$1.<init>(AttributeKey.java:27)
at io.netty.util.AttributeKey.<clinit>(AttributeKey.java:27)
at org.elasticsearch.transport.netty4.Netty4Transport.<clinit>(Netty4Transport.java:219)
at org.elasticsearch.transport.Netty4Plugin.getSettings(Netty4Plugin.java:57)
at org.elasticsearch.plugins.PluginsService.lambda$getPluginSettings$0(PluginsService.java:89)
at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:271)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at org.elasticsearch.plugins.PluginsService.getPluginSettings(PluginsService.java:89)
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:147)
at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:277)
at org.sonar.application.es.EsConnectorImpl$MinimalTransportClient.<init>(EsConnectorImpl.java:103)
at org.sonar.application.es.EsConnectorImpl.buildTransportClient(EsConnectorImpl.java:89)
at org.sonar.application.es.EsConnectorImpl.getTransportClient(EsConnectorImpl.java:74)
at org.sonar.application.es.EsConnectorImpl.getClusterHealthStatus(EsConnectorImpl.java:61)
at org.sonar.application.process.EsManagedProcess.checkStatus(EsManagedProcess.java:88)
at org.sonar.application.process.EsManagedProcess.checkOperational(EsManagedProcess.java:73)
at org.sonar.application.process.EsManagedProcess.isOperational(EsManagedProcess.java:58)
at org.sonar.application.process.ManagedProcessHandler.refreshState(ManagedProcessHandler.java:201)
at org.sonar.application.process.ManagedProcessHandler$EventWatcher.run(ManagedProcessHandler.java:258)
2019.11.16 20:03:45 DEBUG app[][i.n.u.i.PlatformDependent0] java.nio.DirectByteBuffer.<init>(long, int): unavailable
2019.11.16 20:03:45 DEBUG app[][i.n.u.i.PlatformDependent] sun.misc.Unsafe: available
2019.11.16 20:03:45 DEBUG app[][i.n.u.i.PlatformDependent] maxDirectMemory: 33554432 bytes (maybe)
2019.11.16 20:03:45 DEBUG app[][i.n.u.i.PlatformDependent] -Dio.netty.tmpdir: /tmp (java.io.tmpdir)
2019.11.16 20:03:45 DEBUG app[][i.n.u.i.PlatformDependent] -Dio.netty.bitMode: 64 (sun.arch.data.model)
2019.11.16 20:03:45 DEBUG app[][i.n.u.i.PlatformDependent] -Dio.netty.maxDirectMemory: -1 bytes
2019.11.16 20:03:45 DEBUG app[][i.n.u.i.PlatformDependent] -Dio.netty.uninitializedArrayAllocationThreshold: -1
2019.11.16 20:03:45 DEBUG app[][i.n.u.i.CleanerJava9] java.nio.ByteBuffer.cleaner(): available
2019.11.16 20:03:45 DEBUG app[][i.n.u.i.PlatformDependent] -Dio.netty.noPreferDirect: false
2019.11.16 20:03:46 DEBUG app[][o.s.a.SchedulerImpl] Stopping [ce]...
2019.11.16 20:03:46 DEBUG app[][o.s.a.SchedulerImpl] Stopping [web]...
2019.11.16 20:03:46 DEBUG app[][o.s.a.SchedulerImpl] Stopping [es]...
2019.11.16 20:03:46 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143
2019.11.16 20:03:46 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped
2019.11.16 20:03:46 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
<-- Wrapper Stopped