geerlingguy/ansible-role-apache

/bin/systemctl Failed to connect to bus: No such file or directory

basictheprogram opened this issue · 9 comments

Attempting to use this role with Ubunu Bionic 18.04 and ran molecule converge to understand how it works. The converge throws an error

TASK [geerlingguy.apache : Ensure Apache has selected state and enabled on boot.] ***
fatal: [instance]: 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": []}
Docker Desktop 4.3.1 (72247)
$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.14.6
BuildVersion:   18G9323
$ ansible --version
ansible 2.9.16.post0
  config file = None
  configured module search path = ['/Users/tanner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/tanner/projects/py3-ansible/src/ansible/lib/ansible
  executable location = /Users/tanner/projects/py3-ansible/src/ansible/bin/ansible
  python version = 3.9.7 (default, Oct 13 2021, 06:43:37) [Clang 11.0.0 (clang-1100.0.33.17)]
 $ MOLECULE_DISTRO=ubuntu1804 molecule converge
molecule login to the image reports
# lsb_release --all
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.6 LTS
Release:	18.04
Codename:	bionic

I thought the molecule.yml volumes and privileged took care of thole dbus, systemd problem?

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

Did you just clone this repository then run molecule converge inside of it? Or are you trying to incorporate this role into your own playbook with your own molecule configuration? This role's seems to work fine in CI and in my local testing (https://github.com/geerlingguy/ansible-role-apache/blob/master/molecule/default/molecule.yml)

Cloned on Dec 12 and the repo is pristine.

ansible-role-apache$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

Forgot to put molecule version

$ molecule --version
molecule 3.5.2 using python 3.9
    ansible:2.9.16.post0
    delegated:3.5.2 from molecule
    docker:1.1.0 from molecule_docker requiring collections: community.docker>=1.9.1

Here is the molecule converge output
https://gist.github.com/basictheprogram/8d5d2552fca4b1b8a9b174dd8a9337d3

Very strange... the CI runs (even 2 days ago) have not had an issue: https://github.com/geerlingguy/ansible-role-apache/actions

Are you possibly running Podman, or Docker with some extra restrictions set up?

Docker Desktop 4.3.1 (72247) on macOS 10.14.6 (older release of macOS). Docker Desktop was an all default install on macOS.

Here are what I think are relevant docker things from a ps -ef and I'm not seeing anything overly restrictive.

com.docker.vpnkit --ethernet fd:3 --diagnostics fd:4 --pcap fd:5 --vsock-path vms/0/connect --host-names host.docker.internal,docker.for.mac.host.internal,docker.for.mac.localhost --listen-backlog 32 --mtu 1500 --allowed-bind-addresses 0.0.0.0 --http /Users/tanner/Library/Group Containers/group.com.docker/http_proxy.json --dhcp /Users/tanner/Library/Group Containers/group.com.docker/dhcp.json --port-max-idle-time 300 --max-connections 2000 --gateway-ip 192.168.65.1 --host-ip 192.168.65.2 --lowest-ip 192.168.65.3 --highest-ip 192.168.65.254 --gc-compact-interval 1800
 com.docker.hyperkit -A -u -F vms/0/hyperkit.pid -c 4 -m 2048M -s 0:0,hostbridge -s 31,lpc -s 1:0,virtio-vpnkit,path=vpnkit.eth.sock,uuid=58894dae-ea5e-4e49-a6c3-a0c603722b55 -U 6b664dbc-907b-44a7-9d3f-2e2eb5b8681f -s 2:0,virtio-blk,/Users/tanner/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw -s 3,virtio-sock,guest_cid=3,path=vms/0,guest_forwards=2376;1525 -s 4,virtio-rnd -l com1,null,asl,log=vms/0/console-ring -f kexec,/Applications/Docker.app/Contents/Resources/linuxkit/kernel,/Applications/Docker.app/Contents/Resources/linuxkit/initrd.img,earlyprintk=serial linuxkit.unified_cgroup_hierarchy=1 page_poison=1 vsyscall=emulate panic=1 nospec_store_bypass_disable noibrs noibpb no_stf_barrier mitigations=off console=ttyS0 console=ttyS1  vpnkit.connect=connect://2/1999
$ docker ps
CONTAINER ID   IMAGE                                          COMMAND                  CREATED        STATUS        PORTS     NAMES
b716d48cba9c   geerlingguy/docker-ubuntu1804-ansible:latest   "/lib/systemd/systemd"   12 hours ago   Up 12 hours             instance

Any specific information you want?

Everything seems to be the same, though you're running Ansible 2.9, that's the main difference I can spot. Not sure why that would result in the Failed to connect to bus.

One other thing to try, run it with other base OSes, like MOLECULE_DISTRO=ubuntu2004 molecule converge (make sure you molecule destroy first though).

$ MOLECULE_DISTRO=ubuntu2004 molecule converge
<snip>
TASK [geerlingguy.apache : Ensure Apache has selected state and enabled on boot.] ***
fatal: [instance]: FAILED! => {"changed": false, "cmd": "/usr/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": []}
$ MOLECULE_DISTRO=-centos7 molecule converge
TASK [geerlingguy.apache : Ensure Apache has selected state and enabled on boot.] ***
fatal: [instance]: FAILED! => {"changed": false, "cmd": "/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": []}

I had the same issue on Docker Desktop 4.4.2 (Docker 20.10.12).

molecule 3.5.2 using python 3.9
    ansible:2.12.1
    delegated:3.5.2 from molecule
    docker:1.1.0 from molecule_docker requiring collections: community.docker>=1.9.1

It is related to the Docker Desktop 4.3 release: docker/for-mac#6073 (comment)

I've set "deprecatedCgroupsv1": true in ~/Library/Group\ Containers/group.com.docker/settings.json and that fixed the issue

stale commented

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

stale commented

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.