[Cialug] systemctl user ; environment variables

Shane Nehring shane at ntoast.com
Mon Mar 14 19:01:19 UTC 2022


Are you su-ed as the user? Systemd is getting really picky about that
anymore due to how much setup is done by logind. If that's the case login
as the user in question, or do the systemd su thing I can't remember off
the top of my head.

On Mon, Mar 14, 2022, 13:15 Todd Walton <tdwalton at gmail.com> wrote:

> I have a problem. I can't run systemctl --user. I get an error about
> environment variables not being set.
>
> $ systemctl --user
> Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR
> not defined
>
> Both of those *are* defined. I can echo them and if I run 'export -p'
> they're listed as being defined *and* exported. So systemctl should be
> seeing them.
>
> $ export -p | grep -P "(XDG_RUNTIME_DIR|DBUS_SESSION_BUS_ADDRESS)"
> declare -x DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus"
> declare -x XDG_RUNTIME_DIR="/run/user/1000"
>
> If I set the machine argument to systemctl, i.e. 'systemctl --user
> --machine=todd at .host status', it works.
>
> What do you figure might be causing this problem?
>
> --
> Todd
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> https://www.cialug.org/cgi-bin/mailman/listinfo/cialug
>


More information about the Cialug mailing list