XDG_RUNTIME_DIR not set in the environment
7,649
I was able to make it work, I just set the following environment variables on the script before calling the binary.
export XAUTHORITY=/var/run/lightdm/root/:0
export DISPLAY=:0
Please tell me if this is safe.
Related videos on Youtube
Author by
flyingknee
Updated on September 18, 2022Comments
-
flyingknee over 1 year
I am running Ubuntu 14.04 LTS. I wanted to run a GUI application during log-in in the LightDM, I did this by adding this line on
/etc/pam.d/lightdm
auth required pam_exec.so debug log=/path/to/file.log /path/to/script.sh
The script will then call the binary. I know the script is being called as I have added some logs. The problem is, I am getting this error when the script calls the binary.
error: XDG_RUNTIME_DIR not set in the environment. (binary:3781): Gtk-WARNING **: cannot open display:
Upon checking the logs also, I've found out the script is being called by root.
In the log I also tried to echo DISPLAY and XAUTHORITY and both are blank. I tried using gksudo to call the binary in the script, same error, Do you have any safe workaround for this?