Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bitnami/sonarqube] Elasticsearch fails to start: AccessDeniedException on /opt/bitnami/sonarqube/elasticsearch/plugins #78282

Open
eduardosilva opened this issue Feb 21, 2025 · 8 comments
Assignees
Labels
in-progress sonarqube tech-issues The user has a technical issue about an application

Comments

@eduardosilva
Copy link

eduardosilva commented Feb 21, 2025

Name and Version

bitnami/sonarqube:25

What architecture are you using?

None

What steps will reproduce the bug?

While running SonarQube 25 using the Bitnami Docker image with Docker Compose, Elasticsearch fails to start due to a permissions issue accessing the elasticsearch/plugins directory. This occurs during the bootstrap phase with a java.nio.file.AccessDeniedException.

Steps to Reproduce:

  1. Set up the provided docker-compose.yml with the .env file configuration (see below).
    
  2. Run docker-compose up -d sonarqube sonarqube-db.
    
  3. Check the logs using docker logs sonarqube or cat /opt/bitnami/sonarqube/logs/es.log inside the container.
    

Docker compose file

services:
  sonarqube-db:
    image: ${POSTGRES_IMAGE:-docker.io/bitnami/postgresql}:${POSTGRE_TAG:-17}
    container_name: sonarqube-db
    environment:
      - POSTGRESQL_USERNAME=${SONARQUBE_DB_USER:-postgres}
      - POSTGRESQL_PASSWORD=${SONARQUBE_DB_PASSWORD:-postgres}
      - POSTGRESQL_DATABASE=${SONARQUBE_DB_NAME:-bitnami_sonarqube}
    ports:
      - '${SONARQUBE_DB_PORT:-5432}:5432'
    volumes:
      - 'sonarqube_db_data:/bitnami/postgresql'

  sonarqube:
    container_name: sonarqube
    image: ${SONARQUBE_IMAGE:-docker.io/bitnami/sonarqube}:${SONARQUBE_TAG:-25}
    ports:
      - '${SONARQUBE_PORT:-9001}:9000'
    volumes:
      - 'sonarqube_data:/bitnami/sonarqube'
    working_dir: /app
    depends_on:
      sonarqube-db:
        condition: service_healthy
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
      - SONARQUBE_DATABASE_HOST=${SONARQUBE_DB_HOST:-sonarqube-db}
      - SONARQUBE_DATABASE_USER=${SONARQUBE_DB_USER:-postgres}
      - SONARQUBE_DATABASE_PASSWORD=${SONARQUBE_DB_PASSWORD:-postgres}
      - SONARQUBE_DATABASE_NAME=${SONARQUBE_DB_NAME:-bitnami_sonarqube}

Env file

SONARQUBE_IMAGE=docker.io/bitnami/sonarqube
SONARQUBE_TAG=25
SONARQUBE_PORT=9001

SONARQUBE_DB_HOST=sonarqube-db
SONARQUBE_DB_USER=postgres
SONARQUBE_DB_PASSWORD=postgres
SONARQUBE_DB_NAME=bitnami_sonarqube
SONARQUBE_DB_PORT=5433

POSTGRES_IMAGE=docker.io/bitnami/postgresql
POSTGRE_TAG=17

What is the expected behavior?

Sonarqube running using this docker compose.

What do you see instead?

Observed Behavior:
Elasticsearch crashes with the following error:

sonarqube@49b19f8e4c7f:/app$ cat /opt/bitnami/sonarqube/logs/es.log 
2025.02.21 17:05:06 INFO  es[][o.e.n.NativeAccess] Using [jna] native provider and native methods for [Linux]
2025.02.21 17:05:07 ERROR es[][o.e.b.Elasticsearch] fatal exception while booting Elasticsearch
java.lang.IllegalStateException: Unable to access 'path.home' (/opt/bitnami/sonarqube/elasticsearch/plugins)
        at org.elasticsearch.bootstrap.FilePermissionUtils.addDirectoryPath(FilePermissionUtils.java:67) ~[elasticsearch-8.16.3.jar:?]
        at org.elasticsearch.bootstrap.Security.addFilePermissions(Security.java:342) ~[elasticsearch-8.16.3.jar:?]
        at org.elasticsearch.bootstrap.Security.createPermissions(Security.java:195) ~[elasticsearch-8.16.3.jar:?]
        at org.elasticsearch.bootstrap.Security.configure(Security.java:141) ~[elasticsearch-8.16.3.jar:?]
        at org.elasticsearch.bootstrap.Elasticsearch.initPhase2(Elasticsearch.java:202) ~[elasticsearch-8.16.3.jar:?]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:74) ~[elasticsearch-8.16.3.jar:?]
Caused by: java.nio.file.AccessDeniedException: /opt/bitnami/sonarqube/elasticsearch/plugins
        at sun.nio.fs.UnixException.translateToIOException(Unknown Source) ~[?:?]
        at sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source) ~[?:?]
        at sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source) ~[?:?]
        at sun.nio.fs.UnixFileSystemProvider.createDirectory(Unknown Source) ~[?:?]
        at java.nio.file.Files.createDirectory(Unknown Source) ~[?:?]
        at java.nio.file.Files.createAndCheckIsDirectory(Unknown Source) ~[?:?]
        at java.nio.file.Files.createDirectories(Unknown Source) ~[?:?]
        at org.elasticsearch.bootstrap.Security.ensureDirectoryExists(Security.java:454) ~[elasticsearch-8.16.3.jar:?]
        at org.elasticsearch.bootstrap.FilePermissionUtils.addDirectoryPath(FilePermissionUtils.java:65) ~[elasticsearch-8.16.3.jar:?]
        ... 5 more

Additional information

I've already have setup vm.max_map_count as recommend and others issues:

sudo sysctl -w vm.max_map_count=262144
@eduardosilva eduardosilva added the tech-issues The user has a technical issue about an application label Feb 21, 2025
@github-actions github-actions bot added the triage Triage is needed label Feb 21, 2025
@starlessboi
Copy link

Hi, I have the same problem, my functional instance gives this error after upgrading image to latest version

@javsalgar
Copy link
Contributor

Hi @eduardosilva, were you upgrading from an instance or does the issue occur on a fresh instance?

@eduardosilva
Copy link
Author

Hi @javsalgar , this issue occurs on a fresh instance.

@jaloszek
Copy link

Hi, I recreated the same error on a fresh instance on both Windows Docker Desktop and Ubuntu Server, downgrading to 24.12.0 helps as a workaround.

@github-actions github-actions bot removed the triage Triage is needed label Feb 25, 2025
@github-actions github-actions bot assigned fmulero and unassigned javsalgar Feb 25, 2025
@fmulero
Copy link
Collaborator

fmulero commented Feb 27, 2025

Hi

I was trying to reproduce the issue but I had no luck. I used the this docker-compose.yml file with fresh volumes and the images resolved are:

  • bitnami/sonarqube:25.1.0-debian-12-r1
  • bitnami/postgresql:17.4.0-debian-12-r2

@fmulero
Copy link
Collaborator

fmulero commented Feb 27, 2025

I've just reproduce it with the image bitnami/sonarqube:25.2.0-debian-12-r4. The directory /opt/bitnami/sonarqube/elasticsearch/pluginsdoesn't exist

@fmulero
Copy link
Collaborator

fmulero commented Feb 27, 2025

Could you give a try to the latest image (25.2.0-debian-12-r5)? I don't know how, the folder elasticsearch/plugins was missing in the original package donwloaded from https://www.sonarsource.com/products/sonarqube/downloads/ when the image was created. Latest package has this folder and the issue is gone.

@eduardosilva
Copy link
Author

eduardosilva commented Feb 27, 2025

@fmulero Confirmed! Using the image 25.2.0-debian-12-r5 works perfectly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in-progress sonarqube tech-issues The user has a technical issue about an application
Projects
None yet
Development

No branches or pull requests

5 participants