-
xlib connection refused by server when doing xhost +
Hi Everyone,
I just finished installing Knoppix 3.4 to my hard drive after my HDD died last week and I am pretty impressed with it. However I am having a wierd problem with it and I am hoping you people can help me with it.
I logged into the system using my regular username and password and opened a Konsole to get a command prompt. Then I did a 'su -' to become root to edit some files as root. Now the problem is that when I try to launch an application like kedit or synaptic which has a GUI I get the following error:
Code:
root@StarKnight:~# kedit
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified
kedit: cannot connect to X server :0.0
On my redhat machine I used to type xhost + at the command prompt and that would fix the problem, however if I type it at the prompt now I get the same error again.
Code:
root@StarKnight:~# xhost +
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified
I tried searching on the web but couldn't find anything relevent.
Any idea on how to fix this? I have done a apt-get dist-upgrade but that didn't fix the problem.
Thanks for the help.
- Suramya
--------------------------------------------------
My Website: http://www.suramya.com
My Blog: http://www.suramya.com/blog
Registered Linux User #: 309391
--------------------------------------------------
*************************************************
Disclaimer:
Any errors in spelling, tact, or fact are transmission errors.
*************************************************
-
Slackware + *BSD :: RLU 301327
-
su loses your DISPLAY variable. after su you need to
export DISPLAY=:0
-
Thanks for the replies...
I tried your suggestions but unfortunately none of them worked. here is a transcript of my session:
Code:
suramya@StarKnight:~$ su -
Password:
root@StarKnight:~# xhost +
xhost: unable to open display ""
root@StarKnight:~# export DISPLAY=:0
root@StarKnight:~# xhost +
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified
xhost: unable to open display ":0"
root@StarKnight:~# xhost + localhost
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified
xhost: unable to open display ":0"
root@StarKnight:~#
root@StarKnight:~# kedit
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified
kedit: cannot connect to X server :0
root@StarKnight:~# export DISPLAY=0:0
root@StarKnight:~# kedit
kedit: cannot connect to X server 0:0
root@StarKnight:~# export DISPLAY=1:0
root@StarKnight:~# kedit
kedit: cannot connect to X server 1:0
root@StarKnight:~# export DISPLAY=0:1
root@StarKnight:~# kedit
kedit: cannot connect to X server 0:1
root@StarKnight:~# export DISPLAY=0:0
root@StarKnight:~# kedit
kedit: cannot connect to X server 0:0
--------------------------------------------------
My Website: http://www.suramya.com
My Blog: http://www.suramya.com/blog
Registered Linux User #: 309391
--------------------------------------------------
*************************************************
Disclaimer:
Any errors in spelling, tact, or fact are transmission errors.
*************************************************
-
try to remove the .Xauthority file in the /root directory (if peresent), then run xauth. It will present you with an
xauth> prompt at which type an ? to see the list of commands, generate to generate a new file.
man xauth
Slackware + *BSD :: RLU 301327
-
There was no .Xauthority file for root. I ran Xauth and generated a new authority file but that didn't fix the problem.
Any other ideas?
--------------------------------------------------
My Website: http://www.suramya.com
My Blog: http://www.suramya.com/blog
Registered Linux User #: 309391
--------------------------------------------------
*************************************************
Disclaimer:
Any errors in spelling, tact, or fact are transmission errors.
*************************************************
-
You must do these commands as the normal user first, then su -. Example:
capnbry@benny> xhost +
access control disabled, clients can connect from any host
capnbry@benny> su -
Password:
root@benny #
At that point you should be good to go. The .Xauthority you need to modify would be in your user directory, not /root/ too.
If you want it to be persistent, you need to get the cookie from your user file into your root's .Xauthority file:
root@benny # xauth -f ~USER/.Xauthority extract - `hostname`/unix:0 | xauth merge -
replace USER with the user name of the user whose X server you want to connect to (capnbry in the above example)
Last edited by CapnBry; 06-24-2004 at 08:03 AM.
-
Hi Everyone,
Thanks for the replies. I finally fixed the problem by combining all the advice I got from here. Here are the steps I followed:
1. As a normal user do a xhost + to allow anyone to connect to the local display.
2. become root using su -
3. Do an export DISPLAY=:0.0
4. Run the program
5. Grin like an idiot when it finally workes
I added export DISPLAY=:0.0 to root's .bashrc to allow it to always use the current display.
Thanks for the help.
- Suramya
--------------------------------------------------
My Website: http://www.suramya.com
My Blog: http://www.suramya.com/blog
Registered Linux User #: 309391
--------------------------------------------------
*************************************************
Disclaimer:
Any errors in spelling, tact, or fact are transmission errors.
*************************************************
-
WooHoo!!1
Last edited by P. N. Guin; 11-13-2004 at 09:53 PM.
May the Flux be with you!
"The road of life is rocky, and you may stumble too. So while you point your finger; someone else is judging you." --Bob Marley
Registered Linux User: 322454
-
Re: WooHoo!!1
Glad to know that this works for others also... It was driving me nuts too before I figured it out...
--------------------------------------------------
My Website: http://www.suramya.com
My Blog: http://www.suramya.com/blog
Registered Linux User #: 309391
--------------------------------------------------
*************************************************
Disclaimer:
Any errors in spelling, tact, or fact are transmission errors.
*************************************************
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|