[solved] Failing to Use SDK due to permissions Error Fixed

This has been fixed in an over 2h unblocking call with @kdaud

For a few days, I struggled with setting up the SDK but it was failing with servers being created but with no Openmrs-runtime.properties which makes it unable to connect to the database on running

This was bypassed by using Docker (first installing docker, run a hello world to test and then mvn openmrs-sdk:setup and then choosing 2) MySQL 5.6 and above in SDK docker container (requires pre-installed Docker)

This failed at some point due to Acees denied to /var/run/docker.sock This was fixed with sudo chmod -R 777 /var/run/docker.sock

After this, All runs fine. the server is created and able to run openmrs on localhost

thanks @kdaud

1 Like

This is concerned with your file system set up which is set during OS installation. This especially happens on unix systems if you prompt the OS during installation to encrypt sensitive directories. So your database directory is by default encrypted by the file system and this makes the initial setup of the sdk instance impossible to connect to the database and it hugs :stuck_out_tongue: while seeking permission for db connection.

Running chmod -R 777 /db-directory paves the way and setting the server using option 1 should work pretty well too!

Rather than running chmod 777 /var/run/docker.sock (which is potentially a security issue), it would be better to setup Docker to either run in rootless mode or, at the very least, setup a group to access it.

The issue is that if the Docker daemon is running as root, then setting the permissions to 777 (allow read + write by everyone) essentially means that anyone can execute Docker commands…

2 Likes