If you are trying to run a systemctl --user command as a non root user and getting "Failed to connect to bus: No medium found" this is probably because a few things are out of place.
First make sure you have linger turned on "sudo loginctl enable-linger $USER". This ensures that your services will hang around when you are not logged in.
Next, use the env command to make sure you have XDG_SESSION_ID and XDG_RUNTIME_DIR defined in your environment. If you do not see them, then you probably did not do a proper login. My guess is that you logged in as a different user and use the su command to change to your current user.
In that case, you pretty much have two choices.
- You can define XDG_RUNTIME_DIR manually with the following command: export XDG_RUNTIME_DIR=/run/user/$(id -u $USER)
- Log out and ssh back in directly as the desired user. This should trigger the PAM module that sets up the correct session variables.
No comments:
Post a Comment