2

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+.

2
  • What happens when you the same sequence of commands of manually that are in the playbook? Have you tried ansible-playbook --step? Jun 27, 2017 at 19:35
  • 1
    @MarkStosberg Thank you for your reply. both --step and doing it manually gives the same results, so I will need to investigate further into if the user account is set up correctly. Jun 28, 2017 at 11:26

1 Answer 1

0

What worked was to install libpam-systemd as the first step of the playbook.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.