![](https://seccdn.libravatar.org/avatar/a895f78a81a109471893519443e4d933.jpg?s=120&d=mm&r=g)
http://bugzilla.opensuse.org/show_bug.cgi?id=1205109
http://bugzilla.opensuse.org/show_bug.cgi?id=1205109#c4
--- Comment #4 from Zim Tsui
just try
sudo /usr/bin/emacs-nox
and then try with installed emacs-x11
sudo /usr/bin/emacs-gtk
and see what happens ... I see e.g.
If I run `sudo emacs-nox` directly, no errors occurred. Only if I run `sudo emacs`, it prints errors. This is because the script `/usr/bin/emacs` set the variable `XDG_RUNTIME_DIR` to `/run/user/0` when I run `sudo emacs`, while the directory `/run/user/0` doesn't exist. The reason why `/run/user/0` doesn't exist is that `sudo` doesn't create a new real session to login as root(UID:0), it merely SIMULATES a login shell. The systemd is not aware of someone loging in as root, and will not create the directory `/run/user/0`.
The aim is to replace XDG_RUNTIME_DIR to the correct one
The variable `XDG_RUNTIME_DIR` should be managed only by systemd rather than by user scripts, because only systemd knows what to do else with the variable, such as creating the corresponding directories. It's dangerous to set the XDG_ variables manually. The simplist solution to this issue is not to set the XDG variables in `/usr/bin/emacs`, as if the variables are not set when `emacs-nox` is run directly. -- You are receiving this mail because: You are on the CC list for the bug.