I have installed /usr/local/stata/xstata-mp as root, permissions 755.
When I try to run this program from a non-root account via the terminal, I get:
user@host ~ % /usr/local/stata/xstata-mp
(xstata-mp:8030): Gtk-WARNING **: 10:09:24.384: cannot open display: 0
"That's odd," I think, I just know I set DISPLAY=0
in my .zshrc, "Well, maybe I need to explicitly do so when running this command?" So I try:
user@host ~ % DISPLAY=0 /usr/local/stata/stata-mp
(xstata-mp:8201): Gtk-WARNING **: 10:13:28.638: cannot open display: 0
Edit: per @steeldriver 's comment I have also tried DISPLAY=:0
I have a gander around, and find Why don't gksu/gksudo or launching a graphical application with sudo work with Wayland? which seems promising (although I am not using Wayland, I am on Ubuntu 18.10 and Wayland remains installed). I try the below command as user@host, and as su in an administrative account:
user@host ~ % xhost -si:localuser:root
xhost: unable to open display "0"
I get desperate, and try:
user@host ~ % DISPLAY=0 xhost -si:localuser:root
xhost: unable to open display "0"
I try other display numbers all to no avail. I think "I am a newb, maybe localhost
really means [LOCAL USER] and try with the permutations mentioned above.
user@host ~ % xhost -si:user:root
xhost: unable to open display "0"
It turns out I am a newb, but that didn't help. :)
How can I make the xhost magic happen so that Gtk doesn't throw a fit and I can just launch my application (as user@host)?
EDIT 3-22-2019:
pgrep -a Xorg
3907 /usr/lib/xorg/Xorg vt1 -displayfd 3 -auth /run/user/123/gdm/Xauthority -background none -noreset -keeptty -verbose 3
7370 /usr/lib/xorg/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -background none -noreset -keeptty -verbose 3
DISPLAY
variable would usually have the form:0
rather than plain0
- also you could check that the X server is running on display:0
(bypgrep -a Xorg
for example) – steeldriver Jan 11 '19 at 19:28pgrep -a Xorg
in my most recent edit – Lexible Mar 22 '19 at 21:06