Unable to start sonarqube service in EC2

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube sonarqube-9.2.1.49989, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve: Start sonarqube
  • what have you tried so far to achieve this: sudo /opt/sonarqube/bin/linux-x86-64/sonar.sh start

Error log:

TERM trapped. Shutting down.

2021.11.27 08:56:47 INFO app[o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp

2021.11.27 08:56:47 INFO app[o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:39681]

2021.11.27 08:56:47 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘es’, ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch

2021.11.27 08:56:47 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running

2021.11.27 08:56:49 INFO app[o.s.a.SchedulerImpl] Stopping SonarQube

2021.11.27 08:56:49 INFO app[o.s.a.SchedulerImpl] Process[es] is stopped

2021.11.27 08:56:49 WARN app[o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143

2021.11.27 08:56:49 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.

TERM trapped. Shutting down.

2021.11.27 08:56:51 INFO app[o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp

2021.11.27 08:56:51 INFO app[o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:39465]

2021.11.27 08:56:51 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘es’, ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch

2021.11.27 08:56:51 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running

2021.11.27 08:56:53 INFO app[o.s.a.SchedulerImpl] Stopping SonarQube

2021.11.27 08:56:53 WARN app[o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143

2021.11.27 08:56:53 INFO app[o.s.a.SchedulerImpl] Process[es] is stopped

2021.11.27 08:56:53 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped

← Wrapper Stopped

→ Wrapper Started as Daemon

Hi @Prosenjit_Manna ,

sonarqube can not be run as root. this is a security measure. you need to create a dedicated user for sonarqube with less privileges, change the owner of the sonarqube installation directory to this user and execute the start.sh script as this user.

hope that helps :slight_smile:

Able to fix by this command

sudo sysctl -w vm.max_map_count=262144