1

On Ubuntu 22.04, I'm trying to set up xscreensaver as a daemon using systemctl. Following these instructions, I've created the following at ~/.config/systemd/user/xscreensaver.service:

[Unit]
Description=XScreenSaver
[Service]
ExecStart=/usr/bin/xscreensaver -nosplash
[Install]
WantedBy=default.target

and run

systemctl --user enable xscreensaver

However, I get the error

Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to connect to bus of other user)

I saw this answer and tried

systemctl --user --global enable xscreensaver

That worked. However, when I tried to start the service with

systemctl --user --global start xscreensaver

I got the Failed to connect to bus error again.

Daniel W.
  • 191
  • 2
  • 12
  • Related: [Unable to create SystemD user service "Failed to connect to bus: Permission denied"](https://askubuntu.com/q/1470010/968501) ... Bus addresses(*inter-processes communication paths*) are handled by a socket file that is part of the user-runtime environment that should be available first ... Read the **notice** part in my answer to the linked post above. – Raffa Jun 02 '23 at 08:25

0 Answers0