Getting elasticsearch “can not run as root” error after upgrading from SonarQube 6.5 to 6.6. Nothing else changed

前端 未结 4 1679
我在风中等你
我在风中等你 2021-02-19 00:24

Getting elasticsearch \"can not run as root\" error after upgrading from SonarQube 6.5 to 6.6. Nothing else changed.

CentOS release 6.8 (Final) Java(TM) SE Runtime Envir

相关标签:
4条回答
  • 2021-02-19 01:01

    I also experienced this problem, running SonarQube, as root, on Centos 7, not inside docker. As mentioned in previous comments, the problem comes from SonarQube upgrading ElasticSearch, and the new version no longer allows itself to be run as root.

    In my environment the fix was easy enough: I had already created a user ("sonar") and group ("sonar") to "own" the sonarqube files. Since my SonarQube process had been running as root, it had left the logs and temp files owned by root.
    1. I stopped the service.
    2. Reassigned all the ownserships ("chown -R sonar:sonar /opt/sonarqube-6.6")
    3. Changed #RUN_AS_USER= in /opt/sonarqube-6.6/bin/linux-x86-64/sonar.sh line 48 to RUN_AS_USER=sonar and both the sonarqube service and its elasticsearch service restarted without further problems. I was left having to go to http://<sonarhost:port>/setup to upgrade the database and from there everything worked fine.

    0 讨论(0)
  • 2021-02-19 01:12

    Change in systemd:

    User=sonar
    Group=sonar
    

    and change all source and #RUN_AS_USER=sonar It will run. It seem the error in enviroment when run in root then su to sonar

    0 讨论(0)
  • 2021-02-19 01:18

    Faced the same issue, do some changes in my sonar service file and it start working. below is my sonar service file

    [Unit]
    Description=SonarQube service
    After=syslog.target network.target
    
    [Service]
    Type=forking
    #Type=simple
    User=sonar
    Group=sonar
    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
    
    [Install]
    WantedBy=multi-user.target
    

    Also follow change the home directory of sonar user

    $ usermod -d /opt/sonarqube sonar
    
    0 讨论(0)
  • 2021-02-19 01:19

    I downloaded sonarqube-6.5 and tried setting up a new user "sonar" but still es fails for me with the same reason - Ubuntu 16.4.

    0 讨论(0)
提交回复
热议问题