docker-ubuntu1804-ansible icon indicating copy to clipboard operation
docker-ubuntu1804-ansible copied to clipboard

systemctl command: Failed to connect to bus: No such file or directory

Open kozicpetar opened this issue 3 years ago • 3 comments

Hi, I'm using this image for a while for my ansible roles and now I have issue which I didn't get before.

I get error:

fatal: [Ubuntu-18.04]: FAILED! => {"changed": false, "cmd": "/bin/systemctl", "msg": "Failed to connect to bus: No such file or directory", "rc": 1, "stderr": "Failed to connect to bus: No such file or directory\n", "stderr_lines": ["Failed to connect to bus: No such file or directory"], "stdout": "", "stdout_lines": []}

This is my molecule file, with privileged and ro cgroup:

platforms:
  - name: Ubuntu-18.04
    image: geerlingguy/docker-ubuntu1804-ansible:latest
    command: ${MOLECULE_DOCKER_COMMAND:-""}
    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
    privileged: true
    pre_build_image: true

When I login to container and run systemctl I get error:

Failed to connect to bus: No such file or directory

Same error I get for container geerlingguy/docker-debian10-ansible:latest

kozicpetar avatar Jan 27 '22 14:01 kozicpetar

Looks like that is related with this issue for 20.04 also: https://github.com/geerlingguy/docker-ubuntu2004-ansible/issues/6

and if I understood that is related with new version of Docker.

Can we do something on image to bypass this problem?

kozicpetar avatar Jan 28 '22 14:01 kozicpetar

What version of Docker are you using? I've got the same problem on macOS with Docker Desktop 4.5.0 on Apple Silicon. Its currently the latest version.

p3l1 avatar Feb 23 '22 18:02 p3l1

For now I found another solution using docker-systemctl-replacement. It's quite easy to integreate in an existing Molecule test. Here are the documentation and the instructions i followed.

p3l1 avatar Feb 23 '22 22:02 p3l1