X “Can’t open display: :0” while DISPLAY variable is correct

I’m not able to start any GUI applications as a root user:

# pgrep -lf Xorg
1590 /usr/bin/Xorg -br -nolisten tcp :0 vt7 -auth /var/lib/xdm/authdir/authfiles/A:0-PNnJzp
# echo $DISPLAY
:0
# xeyes
No protocol specified
Error: Can't open display: :0
# firefox
No protocol specified
No protocol specified
Error: cannot open display: :0
# xcalc
No protocol specified
Error: Can't open display: :0
#

Distribution is openSUSE 11.2(2.6.31.5-0.1-default) and X.Org X Server version is 1.6.5. My DISPLAY variable is set correctly, isn’t it? Any ideas what might cause this problem?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

:0 should work as should :0.0 (normal default) as also localhost:0 etc. Permissions are most likely problem.

Try disabling xhost with: xhost +

(This is unlikely to work but easier to do than the following which is required if it didn’t).

So if that fails it’s probably xauth.

Follow the first answer on here:

How to use xauth to run graphical application via other user on linux | Server Fault

To add the xauth key from your user logged into X to the root user.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments