Unable to start SonarQube with PostGreSQL 12

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

    • sonarqube-developer-8.2.0.32929
    • sonar-scanner-cli-4.2.0.1873-linux.zip
    • build-wrapper-linux-x86
    • sonar-cfamily-plugin-6.8.0.16475
      I’m using a standalone CentOS 7 machine.
  • what are you trying to achieve
    I’m new to SonarQube.

Recently with help from Massimo Paladin I got SonarQube to run and completed a scan of the sample C/C++ project (thank you Massimo). At that time I used the default sonar.properties from the download.

Now I’m trying to use PostGreSQL instead of the embedded H2 database. But after I modified sonar.properties SonarQube cannot start.

  • what have you tried so far to achieve this
    Here is my current sonar.properties:
    sonar.jdbc.username=anguyen sonar.jdbc.password=xxxxxxxx sonar.jdbc.url=jdbc:postgresql://localhost/sonarqube?currentSchema=public
    Here is the list of postgres users and databases:
    `
    postgres=# \du
    List of roles
    Role name | Attributes | Member of
    -----------±-----------------------------------------------------------±----------
    anguyen | Create DB | {}
    postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------±---------±---------±------------±------------±----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
sonar | anguyen | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)
And here is the output from trying to launch Sonarqube:
~$sonar.sh console
Running SonarQube…
wrapper | --> Wrapper Started as Console
wrapper | Launching a JVM…
jvm 1 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
jvm 1 | Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
jvm 1 |
jvm 1 | 2020.04.15 10:26:33 INFO app[o.s.a.AppFileSystem] Cleaning or creating temp directory /home/anguyen/sonarqube/temp
jvm 1 | 2020.04.15 10:26:34 INFO app[o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
jvm 1 | 2020.04.15 10:26:34 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘es’, ipcIndex=1, logFilenamePrefix=es]] from [/home/anguyen/sonarqube/elasticsearch]: /home/anguyen/sonarqube/elasticsearch/bin/elasticsearch
jvm 1 | 2020.04.15 10:26:34 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
jvm 1 | 2020.04.15 10:26:36 INFO app[o.e.p.PluginsService] no modules loaded
jvm 1 | 2020.04.15 10:26:36 INFO app[o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
jvm 1 | OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
jvm 1 | 2020.04.15 10:26:59 INFO app[o.s.a.SchedulerImpl] Process[es] is up
jvm 1 | 2020.04.15 10:26:59 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘web’, ipcIndex=2, logFilenamePrefix=web]] from [/home/anguyen/sonarqube]: /usr/lib/jvm/java-11-openjdk-11.0.6.10-1.el7_7.x86_64/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/home/anguyen/sonarqube/temp --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.|[::1] -cp ./lib/common/:/home/anguyen/sonarqube/lib/jdbc/postgresql/postgresql-42.2.8.jar org.sonar.server.app.WebServer /home/anguyen/sonarqube/temp/sq-process1189623219480529768properties
jvm 1 | 2020.04.15 10:27:09 INFO app[o.s.a.SchedulerImpl] Process[web] is stopped
jvm 1 | 2020.04.15 10:27:09 WARN app[o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143
jvm 1 | 2020.04.15 10:27:09 INFO app[o.s.a.SchedulerImpl] Process[es] is stopped
jvm 1 | 2020.04.15 10:27:09 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped
wrapper | <-- Wrapper Stopped
~$sonar.sh status
SonarQube is not running.
`

Thank you very much

What’s in your web.log file under $SONARQUBE_HOME/logs/? Anything interesting?

There are some interesting error messages
I will upload the file

web.log.txt (35.0 KB)

Caused by: org.postgresql.util.PSQLException: FATAL: Ident authentication failed for user “anguyen”

I’d guess your user doesn’t have enough rights over the sonarqube database, or you’ve only provided a username and not a password. I’d double check your database permissions and sonar.jdbc.* settings.

Hello Colin,
Thanks so much for your quick reply.

I made postgres the jdbc user, my sonar.properties is now
~/sonarqube$cat conf/sonar.properties sonar.jdbc.username=postgres sonar.jdbc.password=xxxxxxxx sonar.jdbc.url=jdbc:postgresql://localhost/sonarqube?currentSchema=public
I double checked the password.

But sonarqube will still not start:
~/sonarqube$sonar.sh console Running SonarQube... wrapper | --> Wrapper Started as Console wrapper | Launching a JVM... jvm 1 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org jvm 1 | Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved. jvm 1 | jvm 1 | 2020.04.15 13:16:54 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /home/anguyen/sonarqube/temp jvm 1 | 2020.04.15 13:16:54 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001 jvm 1 | 2020.04.15 13:16:54 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/home/anguyen/sonarqube/elasticsearch]: /home/anguyen/sonarqube/elasticsearch/bin/elasticsearch jvm 1 | 2020.04.15 13:16:54 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running jvm 1 | 2020.04.15 13:16:55 INFO app[][o.e.p.PluginsService] no modules loaded jvm 1 | 2020.04.15 13:16:55 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin] jvm 1 | OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release. jvm 1 | 2020.04.15 13:17:21 INFO app[][o.s.a.SchedulerImpl] Process[es] is up jvm 1 | 2020.04.15 13:17:21 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [/home/anguyen/sonarqube]: /usr/lib/jvm/java-11-openjdk-11.0.6.10-1.el7_7.x86_64/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/home/anguyen/sonarqube/temp --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/common/*:/home/anguyen/sonarqube/lib/jdbc/postgresql/postgresql-42.2.8.jar org.sonar.server.app.WebServer /home/anguyen/sonarqube/temp/sq-process17913648623752682467properties jvm 1 | 2020.04.15 13:17:30 INFO app[][o.s.a.SchedulerImpl] Process[web] is stopped jvm 1 | 2020.04.15 13:17:31 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143 jvm 1 | 2020.04.15 13:17:31 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped jvm 1 | 2020.04.15 13:17:31 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped wrapper | <-- Wrapper Stopped
web.log is attached:
web.log.txt (51.0 KB)

Am I missing some configuration step?

Thanks again!

This looks like a useful StackOverflow Post for the error you’re receiving.

FATAL: Ident authentication failed for user “postgres”

I’m not a Postgres expert, but it looks like something might be configured for your Postgres database to only accept authentication over the Ident protocol, not using username/password.

I don’t think you’re running into a SonarQube issue, but something specific to your Postgres setup.

I will look into it
Thank you for the hint
Any additional hints would be greatly appreciated of course

Do I have to create a database and/or schema for sonarqube, or is that done by sonarqube itself?

Hello Colin,

I found a problem in my sonar.properties.
SonarQube came up fine now.
I’m going to close this issue, thanks so much for your help!

Ai

Can you suggest what you did. I am also facing same issue.