XDG_RUNTIME_DIR not set when using sudo -i

Bug #1548300 reported by Sam Mousa
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
sudo
New
Undecided
Unassigned
sudo (Debian)
New
Undecided
Unassigned
sudo (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

According to the man page `sudo -i` will run the command with an environment "similar" to the one a user would receive at log in.

When trying to use tools that use D-Bus, specifically: systemctl --user, it will be impossible to control them via sudo.

While there is a workaround; setting the XDG_RUNTIME_DIR manually, this means any configuration change that causes the XDG_RUNTIME_DIR to change will have to be applied in several locations.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in sudo (Ubuntu):
status: New → Confirmed
Revision history for this message
Benpro (benpro82) wrote :

As a temporary patch, you could set this to /etc/profile:
export XDG_RUNTIME_DIR="/run/user/$UID"

Revision history for this message
user (meta1729-deactivatedaccount) wrote :

Isn't sudo supposed to use libpam-systemd which performs all these tasks involved in registering user sessions with the systemd login manager logind?

tags: added: sudo
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.