Score:1

systemctl: Failed to connect to bus

cn flag

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.

Raffa avatar
jp flag
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.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.