[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1198
  • Last Modified:

xhost/XDM errors

I get the following message when I attempt to start an X session from a kde konsole session under either a user or root account:  "Cannot connect to X server 0:0"

I have read that typing "xhost local:" or "xhost +" would resolve this, however whenever I execute either of those commands (as root OR as a normal user), I see "xhost: unable to open display 0:0"

This apparently results in some console apps like "vi" to take very long to invoke, apparently because of a problem with XDM or whatever.

This is with a harddisk install of knoppix 3.4 (a debian flavor of linux).  Funny thing is that I can start (with no problems) X apps with the "run dialog" hitting alt-F2, or from menu.  And I dont get the errors when I type vi from a fullscreen console session.  Furthermore this problem does not happen when knoppix is run as a bootable CD (LiveCD), only after being installed to harddrive.

Ideas?
0
reds55
Asked:
reds55
  • 8
  • 7
  • 7
  • +2
2 Solutions
 
CaseybeaCommented:
I am taking a stab in the dark here, based on a similar problem I had with GNOME and RedHat--   which is, the desktop managers often have problems if the HOSTS entries are not 100% correct.

Therefore, my suggestion is that you verify the content of /etc/hosts matches the output of "hostname", and that the entry in /etc/hosts also matches the IP address from "ifconfig".

If this isn't your problem, then I will have to leave it to the other experts to resolve?   Give it a shot, let me know what you find.

0
 
reds55Author Commented:
I checked but having no luck yet... my hostname is "debian" and the first line of my /etc/hosts/file is
[code]
127.0.0.1       debian localhost
[/code]
ifconfig gives my eth0 address (connected to hardware router) as 192.168.2.3 and the lo (local loopback) is 127.0.0.1 of course.

Any other suggestions?
0
 
reds55Author Commented:
increasing point value...ideas anyone?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
gheistCommented:
can this knoppix thing resolve your another host with x server ???
0
 
reds55Author Commented:
I don't understand your question, can you rephrase that please?
0
 
gheistCommented:
one server supports one X session.
you can run Xnest inside this session to get another server

what do you want to accomplish???

are you sure anything ever is started your way ??? I personally doubt...
0
 
reds55Author Commented:
Can you be more specific with what you want me to check?

when I typed "Xnest" it says:
[code]
Fatal server error:
Server is already active for display 0
[/code
0
 
gheistCommented:
Xnest :1

etc.

but you can run all apps within your session, Xnest will provide additional server in window for another session, same can be accomplished using Xvnc, which lets you connnect to some sort of virtual display using another protocol etc, but no X app gains from a separate session
0
 
GnsCommented:
Are you sure you are running the "xhost + localhost" etc as the user who started the session?
I you just run a terminal emulator (not the "root shell") and do the xhost bit, then you shouldn't see any errors.

-- Glenn
0
 
reds55Author Commented:
GNS:  you may have stumbled onto something...

With this Knoppix installation,  when the computer is turned on, it boots into the KDE login screen, which is where I choose a login and enter the password.

Since nobody logs on before X (KDE) starts, what user is the user that started the X (KDE) session?  

All I know is that "xhost local:"  gives the error message regardless of if I am doing it as the user I logged into KDE as, or as root.
0
 
rindiCommented:
nobody has actually started kde yet when you get the login screen. At this part you are using a login or session manager (kdm, gdm,...). Xserver has started too. and depending on your config, the Xserver session is 0. When you login you authenticate yourself to linux and you also start the GUI you have selected (KDE, Gnome, tvm...).

I think what you are trying to do is start another Xserver Session but, without extra parameters you are telling it to use session 0 which is already active for your current session. You may have to try something like xhost:1 in order to open a new xserver session (this time session 1).

Knoppix on CD I think doesn't use session 0, but another, possibly 4.
0
 
GnsCommented:
True rindi, the display manager runs an X server for the greeter screen (the login screen), as the user the DM is started as (usually root). When the user "logs in" s/he actually start the X session and (usually) become the owner of the session... This usually prevent even that (local) user from accessing the display unless the X app is started with the correct session/auth credentials... Which basically mean that you have to start things acting on that diaply/screen from within the session. All X apps are affected ... even xhost;-).
The display manager will not allow anything other than the greeter screen (as it should:-), you need to start a session before "allowing localhost" to "connect to the display".

Now, "xhost local:0" is simply the wrong syntax. It should be "xhost + localhost" (or "xhost + 127.0.0.1"), nothing else.
And you need run the command as the logged on user (not the "knoppix root shell" thing, but either "K->run" or in a terminal window).
Read "man xhost" if you don't beleive me:-).

> Knoppix on CD I think doesn't use session 0, but another, possibly 4.
Hm, no that's not it rindi, I think you are confusing this with the fact that live-cd knoppix will start the X server running on the 4:th virtual console (which is the first free one, since it runs textmode "logins" on the first three). Still is the :0 display though.

-- Glenn
0
 
reds55Author Commented:
I'm seeing some good info here but nothing that tells me what to try next... I kno very little about X, I'm just trying to get it working and need to know things to type in...

when I type "xhost + localhost", it says "xhost:  unable to open display "0:0", and the same applies if I type xhost + 127.0.0.1.  I am doing this as the logged on user. echo $DISPLAY returns 0:0

0
 
rindiCommented:
You could well have X missconfigured. Inspect your log files for any indications as to what is causing this (could be the mouse, the driver for grafics card, etc).

reconfigure X using one of the tools you have, or edit the xconfig file. If knoppix loads ok frem cd compare that xconfig file with your current one, or copy it to /etc/X11.
0
 
GnsCommented:
> when I type "xhost + localhost", it says "xhost:  unable to open display "0:0", and the same applies if I type xhost +
> 127.0.0.1.  I am doing this as the logged on user. echo $DISPLAY returns 0:0
Well, as I've been saying, you need do it from within the X session you've started by "logging in" (using some terminal (or "Run..." dialog/mechanism) started from within the session...). Are you doing that? If not, could you please quote the verbatim commands and their result here?

I'm guessing all you really need do is "alt-F2->xhost + localhost";-).

> I get the following message when I attempt to start an X session from a kde konsole session under either a user or root
> account:  "Cannot connect to X server 0:0"
I finally really read the initial question (:-).... "kde console session" is the "kconsole" terminal emulator, right? and "X session" is (erroneously) any X application?

-- Glenn
0
 
GnsCommented:
Oh and rindi, I suspect reds55 really has X running;-). This is likely not a config error, so should not need any reconfiguring.

-- Glenn
0
 
gheistCommented:
Yes - X is configured perfectly, basically there is misperception of X that leads to attempt to run two display managers on one display, which will not work.
0
 
GnsCommented:
Probably gheist, we'll see when reds55 gets back to us;)

-- Glenn
0
 
reds55Author Commented:
The reason why its a few days in between my responses is since the computer in question is usually running a different OS and being used by my wife, so I usually only boot it into this particular Linux install a couple times a week.

Just to clarify, like my first post said, I am able to boot into KDE with no problem, and start X apps from the menu, or ALT-F2.  Just unable to launch from the KDE konsole terminal emulator, so whatever is causing the problem causes problems with any X app that needs to be invoked from the konsole session.

BTW, I fixed the slow bootup of vi by changing my TERM environment variable from xterm to linux.  

I tried hitting alt-F2 and typing "xhost + localhost", then typing "kwrite" at a konsole prompt, and it said "kwrite: cannot connect to X server 0:0"

ok, I tried something...If I hit ALT-F2 and log into a new console session (as the same user or root), I also get the same response when typing "xhost + localhost" or typing "xhost +" or just "xhost local:").  

Any more ideas?
0
 
gheistCommented:
I start konsole from KDE panel
Type in kwrite

it works

is there anything different with your command sequence ???
0
 
GnsCommented:
CC gheist. Even checked on some debian installs.

-- Glenn
0
 
gheistCommented:
hmm
do you use ssh with X forwarding for your wifes computer ???
0
 
gheistCommented:
gns: how did you know that i did not check on anything called linux ????

-- Andrew
0
 
GnsCommented:
> gns: how did you know that i did not check on anything called linux ????
? (Perhaps since you're a freebsd huff:-):-)
I'm just saying that _I_ did check on a debian (deduced from the above that reds55 uses that), and there really were no problems. As expected.

I'm not sure, but feasibly this could be a problem with the users .Xauthority file (or somesuch).
Reds55, if you add a brand new user, start X (and "log in to KDE") as that user, does the problem persist?

> -- Andrew
Andrew? No wonder you had fun when I misstook you for being french:-).

-- Glenn
0
 
GnsCommented:
A good thread that leads nowhere. Sigh. Well, rereading it, one thing jumps out.... The DISPLAY setting of 0:0 isn't exactly standard, nor probably right. Trying with setting DISPLAY=:0 (or localhost:0, or 127.0.0.1:0) would perhaps work better...

-- Glenn (on vacation, so nothing tested...)
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 8
  • 7
  • 7
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now