SonarQube installation and configuration issues

Installation details

OS: Rocky 9.4

RAM < 500G

Disk Space < 110G

Postgres : postgresql-13.16-1

SonarQube : 10.3

Java : 17

I follow the instruction on

Error on sonar.log

2024.11.15 02:11:29 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: [127.0.0.1:9001](http://127.0.0.1:9001/), TCP: [127.0.0.1:38951](http://127.0.0.1:38951/)]
2024.11.15 02:11:29 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [/opt/sonarqube/elasticsearch]: /usr/lib/jvm/java-17-openjdk-17.0.13.0.11-3.el9.x86_64/bin/java -Xms4m -Xmx64m -XX:+UseSerialGC -Dcli.name=server -Dcli.script=./bin/elasticsearch -Dcli.libs=lib/tools/server-cli -Des.path.home=/opt/sonarqube/elasticsearch -Des.path.conf=/opt/sonarqube/temp/conf/es -Des.distribution.type=tar -cp /opt/sonarqube/elasticsearch/lib/*:/opt/sonarqube/elasticsearch/lib/cli-launcher/* org.elasticsearch.launcher.CliToolLauncher
2024.11.15 02:11:29 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2024.11.15 02:11:35 INFO app[][o.s.a.SchedulerImpl] Process[es] is up
2024.11.15 02:11:35 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[WEB_SERVER] from [/opt/sonarqube]: /usr/lib/jvm/java-17-openjdk-17.0.13.0.11-3.el9.x86_64/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -XX:-OmitStackTraceInFastThrow --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/[java.io](http://java.io/)=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/[sun.nio.ch](http://sun.nio.ch/)=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED -Dcom.redhat.fips=false -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/sonar-application-10.3.0.82913.jar:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.6.0.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process16651067653035475557properties
2024.11.15 02:11:37 INFO app[][o.s.a.SchedulerImpl] Process[Web Server] is stopped
2024.11.15 02:11:37 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 143
2024.11.15 02:11:37 INFO app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2024.11.15 02:11:37 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped ```

**es.log**

```:logs $ tail -f /opt/sonarqube/logs/es.log
2024.11.15 03:50:18 ERROR es[][o.e.b.Elasticsearch] fatal exception while booting Elasticsearch
java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Elasticsearch.initializeNatives(Elasticsearch.java:282) ~[elasticsearch-8.11.0.jar:?]
at org.elasticsearch.bootstrap.Elasticsearch.initPhase2(Elasticsearch.java:167) ~[elasticsearch-8.11.0.jar:?]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:72) ~[elasticsearch-8.11.0.jar:?]
2024.11.15 03:52:05 ERROR es[][o.e.b.Elasticsearch] fatal exception while booting Elasticsearch
java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Elasticsearch.initializeNatives(Elasticsearch.java:282) ~[elasticsearch-8.11.0.jar:?]
at org.elasticsearch.bootstrap.Elasticsearch.initPhase2(Elasticsearch.java:167) ~[elasticsearch-8.11.0.jar:?]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:72) ~[elasticsearch-8.11.0.jar:?]```

I have checked the folder permissions and removed sonarqube user from sudoers and tried but still the error is below

/usr/bin/java
Running SonarQube...
2024.11.20 18:49:51 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /var/sonarqube/temp
2024.11.20 18:49:51 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:41919]
2024.11.20 18:49:51 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [/opt/sonarqube/elasticsearch]: /usr/lib/jvm/java-17-openjdk-17.0.13.0.11-3.el9.x86_64/bin/java -Xms4m -Xmx64m -XX:+UseSerialGC -Dcli.name=server -Dcli.script=./bin/elasticsearch -Dcli.libs=lib/tools/server-cli -Des.path.home=/opt/sonarqube/elasticsearch -Des.path.conf=/var/sonarqube/temp/conf/es -Des.distribution.type=tar -cp /opt/sonarqube/elasticsearch/lib/*:/opt/sonarqube/elasticsearch/lib/cli-launcher/* org.elasticsearch.launcher.CliToolLauncher
2024.11.20 18:49:51 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2024.11.20 18:50:25 INFO  es[][o.e.n.Node] version[8.11.0], pid[1093], build[tar/d9ec3fa628c7b0ba3d25692e277ba26814820b20/2023-11-04T10:04:57.184859352Z], OS[Linux/5.14.0-427.13.1.el9_4.x86_64/amd64], JVM[Red Hat, Inc./OpenJDK 64-Bit Server VM/17.0.13/17.0.13+11-LTS]
2024.11.20 18:50:25 INFO  es[][o.e.n.Node] JVM home [/usr/lib/jvm/java-17-openjdk-17.0.13.0.11-3.el9.x86_64], using bundled JDK [false]
2024.11.20 18:50:25 INFO  es[][o.e.n.Node] JVM arguments [-Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -Djava.security.manager=allow, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j2.formatMsgNoLookups=true, -Djava.locale.providers=SPI,COMPAT, --add-opens=java.base/java.io=org.elasticsearch.preallocate, -XX:+UseG1GC, -Djava.io.tmpdir=/var/sonarqube/temp, -XX:ErrorFile=/opt/sonarqube/logs/es_hs_err_pid%p.log, -Xlog:disable, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djna.tmpdir=/var/sonarqube/temp, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j2.formatMsgNoLookups=true, -Djava.locale.providers=COMPAT, -Dcom.redhat.fips=false, -Des.enforce.bootstrap.checks=true, -Xmx512m, -Xms512m, -XX:MaxDirectMemorySize=256m, -XX:+HeapDumpOnOutOfMemoryError, -XX:G1HeapRegionSize=4m, -XX:InitiatingHeapOccupancyPercent=30, -XX:G1ReservePercent=15, -Des.distribution.type=tar, --module-path=/opt/sonarqube/elasticsearch/lib, --add-modules=jdk.net, --add-modules=ALL-MODULE-PATH, -Djdk.module.main=org.elasticsearch.server]
2024.11.20 18:50:29 INFO  es[][o.e.p.PluginsService] loaded module [x-pack-core]
2024.11.20 18:50:29 INFO  es[][o.e.p.PluginsService] loaded module [old-lucene-versions]
2024.11.20 18:50:29 INFO  es[][o.e.p.PluginsService] loaded module [parent-join]
2024.11.20 18:50:29 INFO  es[][o.e.p.PluginsService] loaded module [lang-painless]
2024.11.20 18:50:29 INFO  es[][o.e.p.PluginsService] loaded module [rest-root]
2024.11.20 18:50:29 INFO  es[][o.e.p.PluginsService] loaded module [x-pack-redact]
2024.11.20 18:50:29 INFO  es[][o.e.p.PluginsService] loaded module [reindex]
2024.11.20 18:50:29 INFO  es[][o.e.p.PluginsService] loaded module [analysis-common]
2024.11.20 18:50:29 INFO  es[][o.e.p.PluginsService] loaded module [x-pack-security]
2024.11.20 18:50:29 INFO  es[][o.e.p.PluginsService] loaded module [transport-netty4]
2024.11.20 18:50:29 INFO  es[][o.e.p.PluginsService] loaded module [apm]
2024.11.20 18:50:29 INFO  es[][o.e.p.PluginsService] loaded module [aggregations]
2024.11.20 18:50:36 INFO  es[][o.e.e.NodeEnvironment] using [1] data paths, mounts [[/ (/dev/mapper/rl_vbox-root)]], net usable_space [14gb], net total_space [16.9gb], types [xfs]
2024.11.20 18:50:36 INFO  es[][o.e.e.NodeEnvironment] heap size [512mb], compressed ordinary object pointers [true]
2024.11.20 18:50:36 INFO  es[][o.e.n.Node] node name [sonarqube], node ID [vUyzHxkqTlGGef_nJljW6w], cluster name [sonarqube], roles [transform, data_content, data_warm, master, remote_cluster_client, data, data_cold, ingest, data_frozen, ml, data_hot]
2024.11.20 18:50:39 INFO  es[][o.e.x.s.Security] Security is disabled
2024.11.20 18:50:39 INFO  es[][o.e.t.n.NettyAllocator] creating NettyAllocator with the following configs: [name=unpooled, suggested_max_allocation_size=1mb, factors={es.unsafe.use_unpooled_allocator=null, g1gc_enabled=true, g1gc_region_size=4mb, heap_size=512mb}]
2024.11.20 18:50:39 INFO  es[][o.e.i.r.RecoverySettings] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]
2024.11.20 18:50:40 INFO  es[][o.e.d.DiscoveryModule] using discovery type [single-node] and seed hosts providers [settings]
2024.11.20 18:50:41 INFO  es[][o.e.n.Node] initialized
2024.11.20 18:50:41 INFO  es[][o.e.n.Node] starting ...
2024.11.20 18:50:51 INFO  es[][o.e.t.TransportService] publish_address {127.0.0.1:41919}, bound_addresses {127.0.0.1:41919}
2024.11.20 18:50:52 INFO  es[][o.e.b.BootstrapChecks] explicitly enforcing bootstrap checks
2024.11.20 18:50:52 ERROR es[][o.e.b.Elasticsearch] node validation exception
[1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch. For more information see [https://www.elastic.co/guide/en/elasticsearch/reference/8.11/bootstrap-checks.html]
bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]; for more information see [https://www.elastic.co/guide/en/elasticsearch/reference/8.11/_maximum_map_count_check.html]
ERROR: Elasticsearch did not exit normally - check the logs at /opt/sonarqube/logs/sonarqube.log
2024.11.20 18:50:52 WARN  es[][o.e.n.Node] unexpected exception while waiting for http server to close
java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Can't move to stopped state when not started
	at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:?]
	at java.util.concurrent.FutureTask.get(FutureTask.java:191) ~[?:?]
	at org.elasticsearch.node.Node.prepareForClose(Node.java:1776) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.bootstrap.Elasticsearch.shutdown(Elasticsearch.java:468) ~[elasticsearch-8.11.0.jar:?]
	at java.lang.Thread.run(Thread.java:840) ~[?:?]
Caused by: java.lang.IllegalStateException: Can't move to stopped state when not started
	at org.elasticsearch.common.component.Lifecycle.canMoveToStopped(Lifecycle.java:128) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.common.component.AbstractLifecycleComponent.stop(AbstractLifecycleComponent.java:73) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.node.Node.lambda$prepareForClose$59(Node.java:1768) ~[elasticsearch-8.11.0.jar:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	... 1 more
2024.11.20 18:50:52 INFO  es[][o.e.n.Node] stopping ...
2024.11.20 18:50:52 INFO  es[][o.e.n.Node] stopped
2024.11.20 18:50:52 INFO  es[][o.e.n.Node] closing ...
2024.11.20 18:50:52 INFO  es[][o.e.n.Node] closed

ERROR: Elasticsearch exited unexpectedly, with exit code 78
2024.11.20 18:50:52 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 78
2024.11.20 18:50:52 INFO  app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2024.11.20 18:50:52 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped```

Hi,

What user is running SonarQube?

 
Ann

Not running on root. created seperate user sonarqube and running from that.
Sonarqube user was in sudoers. I have removed that too.

Hi,

Okay. We’re on to the next error now:

 
HTH,
Ann

hi Thanks,
Errors resolved now.
Added with that, I had re-do for Postgres user creation, Granting access and updating the same details in sonar.conf
This cleared the error