[SonarQube 9.6.1 - Community] I can't upgrade to the new version of SonarQube Community

We want to migrate to version 9.6.1-community. For this, we use a docker image.
But we always get an error in the ElasticSearch variable. (ES_JAVA_HOME).
I leave you the docker file that we use to build the image:

FROM nexus-proxy-docker.server/sonarqube:9.6.1-community

ARG http_proxy=http://myproxy:8080
ARG https_proxy=http://myproxy:8080
ARG no_proxy=.corp


ENV LANG='en_GB.UTF-8' \
    LANGUAGE='en_GB:en' \
    LC_ALL='en_GB.UTF-8'
    
COPY scripts/ $SONARQUBE_HOME/scripts
COPY certificates/ $SONARQUBE_HOME/certificates
COPY run.sh $SONARQUBE_HOME/bin/
COPY sonar.sh $SONARQUBE_HOME/bin/

RUN chown sonarqube:sonarqube ${SONARQUBE_HOME}/bin/run.sh
RUN chown sonarqube:sonarqube ${SONARQUBE_HOME}/bin/sonar.sh
 

    # apk add openjdk11

RUN  apk update \
  && apk upgrade \
  && apk add ca-certificates \
  && update-ca-certificates \
  && apk add --update coreutils && rm -rf /var/cache/apk/*   \ 
  && apk add --update openjdk11 tzdata openssl curl fontconfig gzip tar unzip bash \
  && apk add --no-cache nss \
  && rm -rf /var/cache/apk/*
  
ENV JAVA_VERSION jdk11u 
    
    
ARG BINARY_URL='https://nexus/repository/almuk-files/jdk/OpenJDK11U-jdk_x64_linux_hotspot_2021-05-07-07-34.tar.gz'
ARG ESUM='2219cf4ec181453d7ce07b91b295f78c71933bc8b01c5ba9f2fbe74bc2b978f4' 
RUN set -eux; \
    curl --insecure --fail --location --output /tmp/openjdk.tar.gz --silent --show-error ${BINARY_URL}; \
    echo "${ESUM} */tmp/openjdk.tar.gz" | sha256sum -c -; \
    mkdir -p /opt/java/openjdk; \
    cd /opt/java/openjdk; \
    tar -xf /tmp/openjdk.tar.gz --strip-components=1; \
    rm -rf /tmp/openjdk.tar.gz;
	
	# SonarQube setup & Include ElasticSearch variable

RUN apk add curl	

ARG SONARQUBE_VERSION=9.6.1.59531
ENV JAVA_HOME='/usr/lib/jvm/java-11-openjdk' \
    ES_JAVA_HOME='/usr/lib/jvm/java-11-openjdk' \
    PATH=$PATH:$JAVA_HOME/bin:$ES_JAVA_HOME/bin \
    SONARQUBE_HOME=/opt/sonarqube \
    SONAR_VERSION="${SONARQUBE_VERSION}" \
    SQ_DATA_DIR="/opt/sonarqube/data" \
    SQ_EXTENSIONS_DIR="/opt/sonarqube/extensions" \
    SQ_LOGS_DIR="/opt/sonarqube/logs" \
    SQ_TEMP_DIR="/opt/sonarqube/temp" \
    SQ_BIN_DIR="/opt/sonarqube/bin"

RUN set -eux; \
    apk add --no-cache --virtual build-dependencies gnupg unzip curl; \
    apk add --no-cache bash su-exec openjdk11-jre; \
    cd /opt; \
    ls; \
    # this 777 will be replaced by 700 at runtime (allows semi-arbitrary "--user" values)
    chmod -R 777 "${SQ_DATA_DIR}" "${SQ_EXTENSIONS_DIR}" "${SQ_LOGS_DIR}" "${SQ_TEMP_DIR}" "${SQ_BIN_DIR}"; \
    apk del --purge build-dependencies; \
    cd /opt/sonarqube; \
    ls -ltr; \
    cd /opt/sonarqube/scripts; \
    ls -ltr; \
    cd /opt/sonarqube/bin; \
    ls -ltr; \
    chmod 777 ${SONARQUBE_HOME}/bin/run.sh; \
    chmod 777 ${SONARQUBE_HOME}/bin/sonar.sh;

RUN sh $SONARQUBE_HOME/scripts/install-plugins.sh $SONARQUBE_HOME/scripts/plugins.txt
USER root

RUN sh $SONARQUBE_HOME/scripts/install-certificates.sh $SONARQUBE_HOME/certificates

COPY scripts/sonar-backup.sh /usr/local/bin/

RUN export http_proxy=http://myproxy:8080 && export https_proxy=http://myproxy:8080 && apk update && apk add tar \
        && rm -rf /var/lib/apt/lists/* \
        && chmod 4755 /usr/sbin/crond \
        && chmod 700 /usr/local/bin/sonar-backup.sh \
        && chown -R sonarqube:sonarqube $SQ_EXTENSIONS_DIR \
        && touch crontab.tmp \
        && echo "0 4  * * * /usr/local/bin/sonar-backup.sh > /var/log/sonar_backup.log 2>&1" > crontab.tmp \
        && crontab crontab.tmp \
        && rm -rf crontab.tmp \
        && echo "crond -L15" >> $SONARQUBE_HOME/bin/run.sh

USER sonarqube
WORKDIR ${SONARQUBE_HOME}
EXPOSE 9000

ENTRYPOINT ["/opt/sonarqube/bin/run.sh"]
CMD ["/opt/sonarqube/bin/sonar.sh"]

And this is the log we always get:

root@sonarserver:/opt/docker-logs/almlogs/docker/containers/sonar_sonarqube_local$ tail -f sonar_sonarqube_local.stdout.log
Sep 27 17:29:16 sonarserver docker/sonar_sonarqube_local[2069]: 2022.09.27 16:29:16 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
Sep 27 17:29:16 sonarserver docker/sonar_sonarqube_local[2069]: 2022.09.27 16:29:16 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped
Sep 27 17:30:12 sonarserver docker/sonar_sonarqube_local[2069]: could not find java in ES_JAVA_HOME at /usr/lib/jvm/java-11-openjdk/bin/java
Sep 27 17:30:12 sonarserver docker/sonar_sonarqube_local[2069]: 2022.09.27 16:30:12 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
Sep 27 17:30:12 sonarserver docker/sonar_sonarqube_local[2069]: 2022.09.27 16:30:12 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 1

The generation of the image does not give an error, nor does it display it with the playbooks.
Whatever recommendation or help is welcome!!

Hi,

Welcome to the community!

Have you tried the official docker image? The docs may help.

 
Ann

1 Like

Hi Ann
Thanks for your suggestion.I follow the documentation, and the docker image is created without issues.
But, when I deploy the image, appear the issue with 'ElasticSearch variable (ES_JAVA_HOME)', even so, this variable exists.
I don’t know if could be a problem with the java installation or other things.
I would like to resolve it, but there isn’t any info regarding this problem.
Regards

This should help

could not find java in ES_JAVA_HOME

could not find java in ES_JAVA_HOME at /usr/lib/jvm/java-11-openjdk/bin/java is a known error message when the container runtime is too old to be aware of the faccessat2 syscall. This issue is tracked with SONAR-15167 including some worarounds if a update of the container runtime is not possible.

2 Likes