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

config.json failed: no such file or directory #95

Closed
fredericrous opened this issue May 23, 2020 · 4 comments
Closed

config.json failed: no such file or directory #95

fredericrous opened this issue May 23, 2020 · 4 comments

Comments

@fredericrous
Copy link

fredericrous commented May 23, 2020

I get the following error in docker logs when I run the container

starting container failed: oci runtime error: container_linux.go:265: starting container process caused "chdir to cwd (\"/var/lib/ldap-account-manager/config\") set in config.json failed: no such file or directory"

Here is a stripped version of my compose configuration

  ldapaccountmanager:
    image: ldapaccountmanager/lam:stable
    volumes:
      - ${SHARED_FOLDER}/ldap/lam/etc:/etc/ldap-account-manager
      - ${SHARED_FOLDER}/ldap/lam/var:/var/lib/ldap-account-manager
    environment:
      - LDAP_DOMAIN=mydomain.com
      - LDAP_SERVER=ldap://ldap:389
      - LDAP_USER=cn=admin,dc=mydomain,dc=com
      - LAM_PASSWORD=password
      - LDAP_ORGANISATION=myOrg
      - LDAP_ADMIN_PASSWORD=mypass

I can reproduce the same issue if I mount the subfolders config and sess directly

    volumes:
      - ${SHARED_FOLDER}/ldap/lam/etc/:/etc/ldap-account-manager
      - ${SHARED_FOLDER}/ldap/lam/config/:/var/lib/ldap-account-manager/config
      - ${SHARED_FOLDER}/ldap/lam/session/:/var/lib/ldap-account-manager/sess

reprodution workflow:

  • spawn the container on docker swarm with the volumes mounted to file system. (choose one of the configs provided above. SHARED_FOLDER can be an environment variable that targets any directory of your choosing)
  • with docker service ps and docker service logs commands, diagnose the file config.cfg must be created
sed: can't read /etc/ldap-account-manager/config.cfg: No such file or directory
  • use docker run and docker cp command to get the file from a fresh container that has no volume mounted. Put the file at ${SHARED_FOLDER}/ldap/lam/etc/config.cfg
  • diagnose the error from docker service logs
sed: can't read /var/lib/ldap-account-manager/config/lam.conf: No such file or director
  • use docker run and docker cp command to get the file from a fresh container that has no volume mounted. put the file at ${SHARED_FOLDER}/ldap/lam/config/lam.conf
  • run the container again. notice with docker service logs that the container is running.
  • try to access the container without success
  • check docker logs to notice the error
starting container failed: oci runtime error: container_linux.go:265: starting container process caused "chdir to cwd (\"/var/lib/ldap-account-manager/config\") set in config.json failed: no such file or directory"

I noticed another user got a similar issue: #83

@gruberroland
Copy link
Contributor

This looks more like a docker error. Maybe the volume folder does not exist?
Does this work for you?
https://github.com/LDAPAccountManager/lam/blob/develop/lam-packaging/docker/docker-compose.yml

@fredericrous
Copy link
Author

Hi @gruberroland I tried mounting directly config and sess folders as suggested in the compose file you linked. I get the same issue. I edited my first message to try to give a better explanation of the reproduction workflow

@gruberroland
Copy link
Contributor

gruberroland commented May 25, 2020

I guess your folders ${SHARED_FOLDER}/ldap/lam/etc/ and ${SHARED_FOLDER}/ldap/lam/var are empty. This is an issue because then LAM cannot configure itself with defaults. Even the default templates are located in /var/lib/ldap-account-manager/config.

This means you need to

  • run the instance with LAM_SKIP_PRECONFIGURE=false and without volumes
  • copy over the /var/lib/ldap-account-manager/config folder to your ${SHARED_FOLDER}
  • start the instance with the volumes
  • same as above with /etc/ldap-account-manager/config.cfg

LAM uses a large set of config files that cannot be created from scratch in case the whole /var/lib/ldap-account-manager/config is empty. You can also extract the config folder from the tar.bz2 file.

@gruberroland
Copy link
Contributor

Closed because inactive for > 14 days. Please reopen if there is still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants