Trying to start sonarqube but getting this error as Removed stale pid file: ./

I have installed latest version of sonarqube and given full permissions with user sonar.
but while trying to start sonar server getting error as " Removed stale pid file: ./"
i have checked in logs no issue found in that.
can someone help me in this .

thanks in advance

Hey there.

That’s not an error – just a fact of what has been done!

Are there really no log messages in any of your SonarQube installation folder’s /logs/ directory? See the documentation on Checking the logs.

thanks for replying and i have gone through your suggestions i didnot see any error in the logs
for your reference i am pasting the logs here

[root@sonarqube logs]# cat sonar.log
2023.04.10 08:09:28 INFO app[o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonar/temp
2023.04.10 08:09:28 INFO app[] Elasticsearch listening on [HTTP:, TCP:]
2023.04.10 08:09:28 INFO app[o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [/opt/sonar/elasticsearch]: /opt/sonar/elasticsearch/bin/elasticsearch
2023.04.10 08:09:28 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2023.04.10 08:09:31 WARN app[o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 1
2023.04.10 08:09:31 INFO app[o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2023.04.10 08:09:31 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped

There should be something in the es.log file.

please find the below es logs

    at org.elasticsearch.cli.EnvironmentAwareCommand.execute( ~[elasticsearch-7.17.8.jar:7.17.8]
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling( ~[elasticsearch-cli-7.17.8.jar:7.17.8]
    at org.elasticsearch.cli.Command.main( ~[elasticsearch-cli-7.17.8.jar:7.17.8]
    at org.elasticsearch.bootstrap.Elasticsearch.main( ~[elasticsearch-7.17.8.jar:7.17.8]
    at org.elasticsearch.bootstrap.Elasticsearch.main( ~[elasticsearch-7.17.8.jar:7.17.8]

Caused by: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives( ~[elasticsearch-7.17.8.jar:7.17.8]
at org.elasticsearch.bootstrap.Bootstrap.setup( ~[elasticsearch-7.17.8.jar:7.17.8]
at org.elasticsearch.bootstrap.Bootstrap.init( ~[elasticsearch-7.17.8.jar:7.17.8]
at org.elasticsearch.bootstrap.Elasticsearch.init( ~[elasticsearch-7.17.8.jar:7.17.8]

java.lang.RuntimeException: can not run elasticsearch as root

There’s your issue! You can’t start as a root user (no sudo / start, for example).

I have created a sonar user and given the permissions and with sonar user am trying to run sonarqube but still it is failing. The same error am getting

What command are you running to start the server? You might also want to try running whoami immediately before running that command.

[sonar@sonarqube linux-x86-64]$ ls
[sonar@sonarqube linux-x86-64]$ ./ start
Starting SonarQube…
./ line 161: …/…/logs/nohup.log: Permission denied
Removed stale pid file: ./
Failed to start SonarQube.
[sonar@sonarqube linux-x86-64]$ whoami
[sonar@sonarqube linux-x86-64]$

That seems like a different issue than before.

Caused by: java.lang.RuntimeException: can not run elasticsearch as root

Are you still facing this issue, or do you only receive the ./ line 161: …/…/logs/nohup.log: Permission denied issue now?

Now it is showing as permission denied and also as removed pid file. Dont no what’s happening exactly am unable to solve the error.

If you have created a new user, you probably need to give permissions to that user recursively in the SonarQube install directly (think chown -R)

I have given the permissions recurresively.still unable to start, after that i posted it on community for assistance

And you’re receiving the same error as before?

./ line 161: …/…/logs/nohup.log: Permission denied

It’s really important that you are detailed in your responses – the commands you run, the logs you get… We cannot make guesses.

So what would you Suggest me to solve this issue

I’m getting the same error, please find below.

[sonar@ip-172-31-45-225 linux-x86-64]$ ./ start
Starting SonarQube…
Removed stale pid file: ./
Started SonarQube.
[sonar@ip-172-31-45-225 linux-x86-64]$ ./ status
SonarQube is running (2241).

Also, its keep on going into “Not Running status” even though we start it. I’ve added sonar user into sudoers file. changed the owner form root to sonar and files permissions to Recursive.

➜ linux-x86-64 sudo ./ start
Starting SonarQube…
Started SonarQube.
➜ linux-x86-64 sudo ./ status
Removed stale pid file: ./
SonarQube is not running.

I am getting the same error trying to go with sonar user. The details are below:

[root@ip-172-31-59-163 ~]# su - sonar
Last login: Sun Sep 3 06:21:25 UTC 2023 on pts/0
Last failed login: Sun Sep 3 06:26:28 UTC 2023 on pts/0
There was 1 failed login attempt since the last successful login.
[sonar@ip-172-31-59-163 ~]$ whoami
[sonar@ip-172-31-59-163 ~]$ pwd
[sonar@ip-172-31-59-163 ~]$ cd /opt/sonarqube/bin/linux-x86-64/
[sonar@ip-172-31-59-163 linux-x86-64]$ ls -lrt
total 8
-rwxrwxr-x. 1 sonar sonar 7133 Aug 29 2022
[sonar@ip-172-31-59-163 linux-x86-64]$ sh start
Starting SonarQube…
Started SonarQube.
[sonar@ip-172-31-59-163 linux-x86-64]$ sh status
Removed stale pid file: ./
SonarQube is not running.

Please help out if anyone fixed it

1 Like

Open the SonarQube configuration file
sudo nano /opt/sonarqube/conf/
find the following lines :

change it as


then save that file
Edit the sonar script file and set RUN_AS_USER
sudo nano /opt/sonarqube/bin/linux-x86-64/
then save that file and
now switch to — sudo su sonar
then move to cd /opt/sonarqube/bin/linux-x86-64/
./ start
./ status