Failed to get D-Bus connection: No such file or directory
When I was running my playbook/role tests within Molecule, using the ansible service module I was greeted by the following error:
1
fatal: [instance]: FAILED! => {"changed": false, "cmd": "/usr/bin/systemctl", "msg": "Failed to get D-Bus connection: No such file or directory", "rc": 1, "stderr": "Failed to get D-Bus connection: No such file or directory\n", "stderr_lines": ["Failed to get D-Bus connection: No such file or directory"], "stdout": "", "stdout_lines": []}
Apperently since version 4.3.0
of Docker Desktop they have switched to Cgroupv2. If the version of systemd in your containers is not 249
or above you will get the error above.
The solution I found was adding the following to my settings.json
file within ~/Library/Group Containers/group.com.docker/
:
1
"deprecatedCgroupv1": true
After adding the above setting within the settings.json
file and restarting Docker for Desktop on my Mac everything worked again.
Solution found in: https://github.com/docker/for-mac/issues/6073