You are not logged in.
Getting this error even after system reboot
:> systemctl --user enable monitor-g
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)But these env vars seem to be defined :
:> echo $UID
1000
:> echo $DBUS_SESSION_BUS_ADDRESS
unix:path=/run/user/1000/bus
:> echo $XDG_RUNTIME_DIR
/run/user/1000Last edited by hwallace (2021-10-20 23:31:05)
Offline
What is the output of:
file /run/user/1000/bus
loginctl session-status
systemctl statusOffline
You've shown us that those variables are set in the environment that is calling systemctl, but this says nothing about whether they are set in the systemd-user process which, if you haven't explicitly imported them, they likely aren't:
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
What is the output of:
file /run/user/1000/bus loginctl session-status systemctl status
file /run/user/1000/bus :
/run/user/1000/bus: socketloginctl session status https://pastebin.com/6CxiN9Ec
systemctl status https://pastebin.com/rCQBM3iC
Last edited by hwallace (2021-10-20 22:02:57)
Offline
Did you use `su - ` before the failed `systemctl --user enable monitor-g`?
Offline
Did you use `su - ` before the failed `systemctl --user enable monitor-g`?
no
Offline
Woh!
After running your queries the enable and start are running fine.
Offline
Oct 20 14:10:44 meer sudo[6340]: stephen : TTY=pts/1 ; PWD=/home/stephen ; USER=root ; COMMAND=/usr/bin/systemctl --user enable monitor-gimpOffline
Oct 20 14:10:44 meer sudo[6340]: stephen : TTY=pts/1 ; PWD=/home/stephen ; USER=root ; COMMAND=/usr/bin/systemctl --user enable monitor-gimp
Please look at my first entry to this topic. There is no 'sudo' there yet there's the error. The prompt is not the root prompt. So...
But there it is. Weird. If it happens again I know where to look but even so... It's happened before and been fixed by rebooting. You have any idea?
Offline
Check the permissions on /run/user/1000/bus if you had executed the command with root and that failed then you executed it again without root and it still failed.
Offline
Check the permissions on /run/user/1000/bus if you had executed the command with root and that failed then you executed it again without root and it still failed.
Ah yes.The permissions are okay now but that would be it. I have an alias for systemctl to 'sudo systemctl' and then another for 'systemctl --user'. Not a wise strategy I see now. I mistakenly used the first alias on the first run.
I always thought it a bit reckless but didn't realise that errors could have such consequences.
So. Thank you.
Last edited by hwallace (2021-10-20 23:32:34)
Offline