You are not logged in.

#1 2011-07-19 19:39:54

BinaryMan
Member
Registered: 2011-07-19
Posts: 14

xhost/xrandr "No protocol specified, cannot open display :0"

I've spent part of last night and most of today working on this problem.

So, I have a laptop with an external VGA port. For the sake of argument, let's say I'm trying to extend my desktop onto another monitor. I run 'xrandr' and get the following.

No protocol specified

Okay. The display isn't set to the $DISPLAY variable when the X server starts. 'ps aux | grep X' shows that /usr/bin/Xorg is running on :0. 'export DISPLAY=:0' takes care of this. Let's run xrandr again.

No protocol specified
Can't open display :0

Now I'm stuck. So googling around, I read something about using xhost + to fix this. So I run 'xhost +'. Same error.

No protocol specified
xhost: Can't open display :0

Now, here's the real stumper. I'm going to stop GDM and run startx. Now, GDM uses the /usr/bin/Xorg binary to run the X server. When I run startx, the X server is using the /usr/bin/X binary, also on :0. Except when I do this, the $DISPLAY variable is automatically set for me and both xrandr and xhost don't give me this "Can't open display" error.

Help? If you need to see a debug log or config file, just ask.

Offline

#2 2011-07-23 10:33:55

Spider.007
Member
Registered: 2004-06-20
Posts: 1,175

Re: xhost/xrandr "No protocol specified, cannot open display :0"

Where do you run the xrandr command from? From a tty, or a terminal from within the running X application?

Can't open display :0

This usually indicates a permission problem; so it would be interesting to know as which user you are logged in, and as which user you are executing the xrandr command that results in this error.

Now, GDM uses the /usr/bin/Xorg binary to run the X server. When I run startx, the X server is using the /usr/bin/X binary, also on :0. Except when I do this, the $DISPLAY variable is automatically set for me and both xrandr and xhost don't give me this "Can't open display" error.

This seems highly unlikely to be related, /usr/bin/X is simply a symlink to Xorg, so it runs the exact same program smile

Offline

#3 2011-09-22 18:46:10

RicoTux
Member
Registered: 2011-09-12
Posts: 3

Re: xhost/xrandr "No protocol specified, cannot open display :0"

Thanks for the hint Spider.007 permissions was right on the mark.
I was trying to let Udev run Xrandr by script adding the following solved it for me:

export XAUTHORITY=/home/<user>/.Xauthority

Last edited by RicoTux (2011-09-22 18:46:54)

Offline

Board footer

Powered by FluxBB