The Ansible playbook does several things, but these are the ones I think are relevant to the problem:
- creates an account for user test
- enable lingering for that account
- copy script to
~/bin
and make service in~/.config/systemd/user
systemctl --user daemon-reload
- flush_handlers
- enable services
It is during the enable services that I get the
Failed to get D-Bus connection: No such file or directory
The enable services command are run with:
become: yes
become_user: "{{ user }}"
environment:
XDG_RUNTIME_DIR: "/run/user/{{ uid }}"
DBUS_SESSION_BUS_ADDRESS: "unix:path=${XDG_RUNTIME_DIR}/bus"
After checking, I found that the file /usr/lib/systemd/system/dbus.socket
was not present. I did a touch to add it, and then I get
connection refused
What is the proper way to set up a new user and enable scripts as services on Raspbian? I am running Raspbian 4.4.50-v7 on a Raspberry Pi 3 Model B+.
ansible-playbook --step?