-   Linux - General (
-   -   Problem with "xrandr" (

caspian 08-05-2005 04:12 PM

Problem with "xrandr"
I'm editing my /etc/acpi/ script to change my screen resolution when I suspend (My graphics card gets unhappy unless I change my screen resolution before I suspend)

The following command works fine:

xrandr -s 1
But when I'm root, I get this error:

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

Can't open display (null)
Is there something I'm doing wrong? Or, is there a better command to use other than xrandr?


acid_kewpie 08-06-2005 10:24 AM

it's not root's xserver, it's your users. don't run it as someone who doesn't own the server.

caspian 08-08-2005 02:59 PM

I would run xrandr as my normal user, except that when I run /etc/acpi/, I need to be root. "sudo -u {username} xrandr..." doesn't work either.

Is there a better way to do this other than using xrandr?

choffee 01-03-2008 04:47 AM

Setting display and Xauth
if you run the following befor xrandr it should work.

export DISPLAY=:0
export XAUTHORITY=/home/<user>/.Xauthority

Replacing <user> with your user. You could even do some checking to see which user is logged in to X and set it that way but it's only me that uses this computer so that's okay for me.

Then when you run xrandr it knows to talk to the local display 0 and use your Xauthority to authenticate.

Works for me anyway.

acid_kewpie 01-03-2008 04:48 AM

why did you reply to a thread that hadn't been touched for over 2 years?? please don't.

m_runwal 05-13-2009 10:08 AM

I also have similar problem
I also had similar problem.
1. I tried to connect from another machine and try to use the command
xrandr -o normal
but got same error as specified earlier.

so I did one trick. I hope this might help you guys.
I had problem when I tried to login with GNOME. screen led blinks.
Then you have to Press ALT+F2 this will bring up Run command (though nothing will be seen on screen.) and type without making any spelling error.


xrand -o normal
This bring back screen to normal.

All times are GMT -5. The time now is 03:31 AM.