0

I'm trying to spin up a galera cluster based on the official MariaDB 11.2 docker image. My dockerfile is below. When I start the node, I'm getting a permission denied error that is preventing the wsrep provider from starting. What is the most appropriate way to fix this?

The error
2024-02-13 16:39:25 0 [Warning] Can't create test file '/var/lib/mysql/5d02c9009974.lower-test' (Errcode: 13 "Permission denied")
2024-02-13 16:39:25 0 [Note] Starting MariaDB 11.2.3-MariaDB-1:11.2.3+maria~ubu2204 source revision 79580f4f96fc2547711f674eb8dd514abd312b4a as process 1
2024-02-13 16:39:25 0 [Note] WSREP: Loading provider /usr/lib/libgalera_smm.so initial position: 00000000-0000-0000-0000-000000000000:-1
2024-02-13 16:39:25 0 [Note] WSREP: wsrep_load(): loading provider library '/usr/lib/libgalera_smm.so'
2024-02-13 16:39:25 0 [Note] WSREP: wsrep_load(): Galera 26.4.16(r7dce5149) by Codership Oy <[email protected]> loaded successfully.
2024-02-13 16:39:25 0 [Note] WSREP: Initializing allowlist service v1
2024-02-13 16:39:25 0 [Note] WSREP: Initializing event service v1
2024-02-13 16:39:25 0 [Note] WSREP: CRC-32C: using 64-bit x86 acceleration.
2024-02-13 16:39:25 0 [Warning] WSREP: Could not open state file for reading: '/var/lib/mysql//grastate.dat'
2024-02-13 16:39:25 0 [ERROR] WSREP: Could not open state file for writing: '/var/lib/mysql//grastate.dat'. Check permissions and/or disk space.: 13 (Permission denied)
         at ./galera/src/saved_state.cpp:SavedState():52
2024-02-13 16:39:25 0 [ERROR] WSREP: Failed to create a new provider '/usr/lib/libgalera_smm.so' with options '': Failed to initialize wsrep provider
2024-02-13 16:39:25 0 [ERROR] WSREP: Failed to load provider
2024-02-13 16:39:25 0 [ERROR] Aborting
The dockerfile
FROM mariadb:11.2

# remove all existing configuration so we can replace it with our new config
RUN find /etc/mysql -type f -delete

# embed custom leaf configuration parameters
COPY leaf.cnf /etc/mysql/mariadb.cnf

# CREDIT Ashraf Sharif (Several Nines) @ https://severalnines.com/blog/how-deploy-galera-cluster-mysql-using-docker-containers
EXPOSE 3306 4444 4567 4568

USER mysql:mysql

# expose the data directory
VOLUME /var/lib/mysql
VOLUME /var/backups/mariadb
The docker compose configuration I'm using to start the node

Note: irrelevant compose configuration excluded

  node-3:
    image: <my custom image name>:0.0.4
    command: --wsrep-cluster-address="gcomm://node-1,node-2,node-3" --wsrep-node-address=node-3
3
  • "What is the most appropriate way to fix this?" Set up permissions correctly, perhaps?
    – mustaccio
    Feb 13 at 20:16
  • Great, thank you. Now, since the permission error is occurring inside the official MariaDB image, could you explain why a permissions error is occurring in the first place and how I need to apply those permissions and to what user?
    – CrossBound
    Feb 13 at 22:52
  • The error is reported from inside the image, but the volume is actually on the host, so perhaps the host's selinux configuration or something messes things up. Can you successfully run the unmodified MariaDB image? Perhaps something in the configuration file you are replacing doesn't work the way you expect?
    – mustaccio
    Feb 14 at 0:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.