Warning: Unable to open display ':0' and cannot connect to X server :0

Bug #250712 reported by Risto H. Kurppa
32
This bug affects 3 people
Affects Status Importance Assigned to Milestone
network-manager (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

up-to-date Hardy 32-bit Kubuntu

Suddenly the system refuses to start new X applications and when trying to do it on the command line (=konsole that has been running all the time, otherwise you're not able to start it when the bug appears) it gives the message:

No protocol specified
No protocol specified
Warning: Unable to open display ':0'. You will not be able to display graphics on the screen.

Katapult or Alt+F2 says: 'KDEInit cannot start the program 'kate'

The only solution is to restart.

Some discussion about this: http://ubuntuforums.org/showthread.php?t=446720

Revision history for this message
Matthew Carpenter (matt-eisgr) wrote :

I'm not sure if it is the same problem, but lately I have been getting this error in .xsession-errors:

Maximum number of clients reachedkonqueror: cannot connect to X server :1.0

which I can only guess means:
Maximum number of clients reached
konqueror: cannot connect to X server :1.0

<replace konqueror with *any* GUI application>
If I try to open new konqueror windows from ALT-F2, I get nothing, if I try to open Kate from Kontact, I get "KDEInit cannot start the program 'kate'", etc....
If I close applications (eg. open Konqueror windows) I can then open new apps/have new X clients connect.

This has been going on for a few weeks or more. I regularly run with 20-30 apps open and have never run into this. It seems either something is causing X-client handles to be connected but never released, or that Xorg is configured to an insanely low number of accepted clients??

Revision history for this message
yoav (yavitzour) wrote :

Can confirm similar behavior on Ubuntu Hardy 32 bit. Suddenly connection to the X server is lost and I am unable to open any application. Trying to open xterm from the command line results in:

#$> xterm
No protocol specified
xterm Xt error: Can't open display: :1.0

However, I don't see anything interesting in the .xsession-errors file.

Revision history for this message
Steven Hirsch (snhirsch) wrote :

Started happening almost immediately after new install of Kubuntu 8.04.1 'Hardy Heron'. Never seen this with any prior release, and I've been using Ubuntu/Kubuntu for almost 2 years.

A quick:

$ xhost +MY_HOSTNAME

fixes it, but what is causing the loss in permissions in the first place?

Revision history for this message
Chris Samuel (chris-csamuel) wrote :

I'm now starting to come across this too having moved to KDE 4.1 recently. I get the same error just doing:

chris@quad:~$ xhost
Maximum number of clients reachedxhost: unable to open display ":0"

That error is being returned by the X server when the client tries to send it the xauth information.

socket(PF_FILE, SOCK_STREAM, 0) = 3
connect(3, {sa_family=AF_FILE, path="/tmp/.X11-unix/X0"}, 110) = 0
[...]
writev(3, [{"l\0\v\0\0\0\22\0\20\0", 10}, {"\0\0", 2}, {"MIT-MAGIC-COOKIE-1", 18}, {"\0\0", 2}, {"\336gNSW\305\253H\230\20\263\361\265w\n@", 16}, {"", 0}], 6) = 48
read(3, 0x1a3eb50, 8) = -1 EAGAIN (Resource temporarily unavailable)
select(4, [3], NULL, NULL, NULL) = 1 (in [3])
read(3, "\0!\v\0\0\0\t\0", 8) = 8
read(3, "Maximum number of clients reache"..., 36) = 36

cheers,
Chris

Revision history for this message
Chris Samuel (chris-csamuel) wrote :

Looking at my X server it has 256 open file descriptors at present, could that be related ?

# ls -1 /proc/`pidof X`/fd | wc -l
256

cheers,
Chris

Revision history for this message
Steven Hirsch (snhirsch) wrote :

I have conclusively traced this down. It starts happening as soon as the automounter times out (typically 10 minutes of inactivity) and unmounts my home directory (accessed over NFS v3). I have no idea what changed in 8.04 to cause this symptom, as I've been using an NFS home directory for over ten years with perhaps a dozen or more Linux distributions and NEVER saw it.

The remote directory is exported using "no_root_squash", which means that root processes can (and do) trigger the mounter and are able to apply their expected permssions on the far end. I can only suspect that the xorg folks changed something or tightened something up with regard to how the X server accesses ~/.Xauthority.

Whenever this occurs, all I have to do is go to an xterm (or the console if none is open) and do 'ls'. That triggers the mount again and X permission work correctly - until the next time. Very annoying and I hope it's corrected soon.

Revision history for this message
Chris Samuel (chris-csamuel) wrote :

No NFS or automounter here, just a local home directory using XFS.

Revision history for this message
Chris Samuel (chris-csamuel) wrote :

Question - is everyone affected here using KDE 4 (I'm using 4.1 for example) ?

I've noticed my work box (32-bit Hardy install) which runs KDE 3.5.9 is reports less file descriptors open by the X server:

# ls -1 /proc/`pidof X`/fd | wc -l
53

Both are Intel graphics with the same up to date xserver-xorg-video-intel package (2:2.2.1-1ubuntu13.6).

Also strange is that xlsclients on this KDE4.1 system reports:

quad konqueror
quad xosview
quad konqueror
quad konqueror
quad kopete
quad konqueror
quad konqueror
quad konqueror
quad kontact
quad konqueror
quad konqueror
quad konsole
quad plasma
quad npviewer.bin
quad npviewer.bin
quad firefox

Whilst the KDE 3.5.9 one only lists:

dell006 xosview
dell006 kicker
dell006 kwalletmanager

Even though there are lots of Konquerors and Konsole's running on that too.

Revision history for this message
Brian Roberg (robergb) wrote : Re: [Bug 250712] Re: Warning: Unable to open display ':0' and cannot connect to X server :0

On Aug 9, 2008, at 9:31 AM, Chris Samuel wrote:
> Question - is everyone affected here using KDE 4 (I'm using 4.1 for
> example) ?

No, we're using Gnome under Hardy. (I work for the same organization
as Tom Hallman, who posted to the ubuntuforums thread referenced here
using the name elwell642. He provided details as to what we're seeing
there.)

Brian

Revision history for this message
Steven Hirsch (snhirsch) wrote :

I'm running KDE 3.5.9 on x86_64 Hardy.

Is KDE the common thread? I seem to be the only person using the automounter, for example.

Revision history for this message
Dan Woodard (dan-e-woodard) wrote :

I am running ubuntu 8.04 on amd64 box. I have the same problem and I confirmed that reloading the automounter (/etc/init.d/autofs reload) recovers and I am able to start X applications.

Revision history for this message
Steven Hirsch (snhirsch) wrote :

I've gotten in the habit of periodically doing an 'ls' in my home directory whenever an X app fails to appear. Not holding my breath for a fix.

Revision history for this message
Bryce Harrington (bryce) wrote :

Hi risto.kurppa,

Please attach the output of `lspci -vvnn`, and attach your /var/log/Xorg.0.log file from after reproducing this issue. If you've made any customizations to your /etc/X11/xorg.conf please attach that as well.

Changed in xorg:
status: New → Incomplete
Revision history for this message
Risto H. Kurppa (risto.kurppa) wrote :

Hi Bruce!

I haven't faced this problem for a while now so it might be that the report doesn't apply to me any more. But I'll try to remember to post the information you requested when I go back to work on Monday.

Revision history for this message
Chris Samuel (chris-csamuel) wrote :

Still happening here, just had to kill off nspluginviewer to release some file descriptors. :-(

"Maximum number of clients reached"

Revision history for this message
Steven Hirsch (snhirsch) wrote :

I think we have two distinct underlying issues. In some cases, the problem is related to running out of file descriptors. In others (mine, for example) it's due to the automounter timing out the users's home directory, rendering .Xauthority unreachable.

But, since it's getting no attention from the maintainers I suppose it's moot either way.

On the odd chance that someone from Ubuntu ever looks at this, I am attaching the requested information (which I'm quite convinced has nothing to do with my problem)

Revision history for this message
Risto H. Kurppa (risto.kurppa) wrote :

xorg.conf and lspci -vvnn included in the attachment. As said, i can't reproduce this any more.

Revision history for this message
Matthew Carpenter (matt-eisgr) wrote :
Download full text (14.2 KiB)

Well I certainly can.

$ lspci -vvnn
00:00.0 Host bridge [0600]: Intel Corporation Mobile 945GM/PM/GMS, 943/940GML and 945GT Express Memory Controller Hub [8086:27a0] (rev 03)
        Subsystem: Hewlett-Packard Company Unknown device [103c:30bb]
        Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B-
        Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort+ >SERR- <PERR-
        Latency: 0
        Capabilities: <access denied>

00:01.0 PCI bridge [0604]: Intel Corporation Mobile 945GM/PM/GMS, 943/940GML and 945GT Express PCI Express Root Port [8086:27a1] (rev 03) (prog-if 00 [Normal decode])
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
        Latency: 0, Cache Line Size: 64 bytes
        Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
        Memory behind bridge: dc000000-ddffffff
        Prefetchable memory behind bridge: 00000000c0000000-00000000cfffffff
        Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort+ <SERR- <PERR-
        BridgeCtl: Parity- SERR- NoISA- VGA+ MAbort- >Reset- FastB2B-
        Capabilities: <access denied>

00:1b.0 Audio device [0403]: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller [8086:27d8] (rev 02)
        Subsystem: Hewlett-Packard Company Unknown device [103c:30bb]
        Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
        Latency: 0, Cache Line Size: 64 bytes
        Interrupt: pin A routed to IRQ 21
        Region 0: Memory at de300000 (64-bit, non-prefetchable) [size=16K]
        Capabilities: <access denied>

00:1c.0 PCI bridge [0604]: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 [8086:27d0] (rev 02) (prog-if 00 [Normal decode])
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
        Latency: 0, Cache Line Size: 64 bytes
        Bus: primary=00, secondary=02, subordinate=02, sec-latency=0
        I/O behind bridge: 00002000-00002fff
        Memory behind bridge: d8000000-d9ffffff
        Prefetchable memory behind bridge: 00000000d2000000-00000000d3ffffff
        Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- <SERR- <PERR-
        BridgeCtl: Parity- SERR- NoISA+ VGA- MAbort- >Reset- FastB2B-
        Capabilities: <access denied>

00:1c.1 PCI bridge [0604]: Intel Corporation 82801G (ICH7 Family) PCI Express Port 2 [8086:27d2] (rev 02) (prog-if 00 [Normal decode])
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
        Latency: 0, Cache Line Size: 64 bytes
        Bus: primary=00, secondary=03, subordina...

Revision history for this message
Matthew Carpenter (matt-eisgr) wrote :
Revision history for this message
Timo Aaltonen (tjaalton) wrote :

this is not a bug in X, but some client that fails to clean up the connections. gnome-screensaver suffered from this recently.

Revision history for this message
Steven Hirsch (snhirsch) wrote :

Then there are definitely two underlying issues producing similar symptoms. In my case: When the NFS automount times out, the next X client that tries to check .Xauthority is unable to do so. I can only assume that it used to attempt a read (which would trigger the mounter) and has been changed to be "clever" now and simply try to stat() the file (which will not trigger the mounter).

Anyway, it's obviously never going to be fixed so I don't know why I bother even responding here...

Revision history for this message
Matthew Carpenter (matt-eisgr) wrote :

(copied from my comment to bug 263211: https://bugs.launchpad.net/ubuntu/+source/gnome-screensaver/+bug/263211 )

It seems that "Maximum clients reached" is more a symptom of it's own bug classification, which is indicative of any application not managing its X resources carefully.
All applications (in all distributions) should undergo testing to prove they have no "X resource leakage" so to speak. Clearly writing a desktop systray-applet that misses reclaiming an X window here and there doesn't seem like that big a deal.... but apparently many apps are causing a big problem.
How do we proceed???

Revision history for this message
Traksius (traksius) wrote :

I'm running Intrepid Ibex (gnome) and noticed this issue after reinstalling NetworkManager. After logging into gnome, not able to get anything requiring a window to run. I stopped networking (via networkmanager-applet) and everything is ok. Turn on networking, no programs allowed.

Workaround for me was to stop network, open term, "xhost +", then restart networking.

Hope this helps anyone.

Revision history for this message
Matteo Bertini (naufraghi) wrote :
Revision history for this message
dzs (dzsabor) wrote :

I also have this bug and it drives me crazy...

It started when I changed to Intrepid. I still used KDE 3 for a while and thought that it may be connected to that. Now I changed to KDE4, meanwhile changed hardware but still got this.

I tried to nail it down to any application, no success. In fact, I just log in to KDE (no apps started), leave it there and if I'm coming back after 2 hours I already can't start any X app. Maybe some timeout? (I've no screensaver now)

I also installed Xfce where - guess what - this bug does not appear! May this be connected to some service running in both KDE and Gnome?

Though I have no problems with Xfce, I'd still perfer KDE4 after all.

Is there any chance someone could solve this?

Revision history for this message
Steven Hirsch (snhirsch) wrote :

My sympathies. I finally gave up and started running a little shell script in the background that does an 'ls $HOME > /dev/null 2>&1' every 60 seconds. Total kludge, but it eliminates the symptoms. Clearly none of the maintainers feel this is of any particular importance so I guess I'll have to live with the workaround.

Revision history for this message
starchild7778 (starchild7778) wrote :

I saw the same thing "Traksius" reported a few comments above. I couldn't open any gui app w/ root priviledges with "gksudo" or "gksu". I could not open Synaptic from the menu after entering my password, either. However, after stopping networking, I could successfully use "gksudo", "gksu", and open Synaptic as root with no problems. If I restart networking and retry, the problem returns.

I installed "kubuntu-desktop" and signed into a KDE session. I successfully opened gui apps with "kdesudo". I rebooted and signed into a Gnome session. Again, "kdesudo" would work, but "gksudo" and "gksu" would not. I changed Synaptic in the menu to use "kdesudo" instead of "gksu" and can now open Synaptic with root priviledges, even without stopping networking.

Revision history for this message
Tv (tv42) wrote :

Happens for in a fresh install of Ubuntu 9.10 with encrypted home directories. I'm thinking ecryptfs might behave "wrong" in similar ways as above-mentioned automounter.

Revision history for this message
niranjan (niranjan-bhalerao) wrote :

to solve the X forwarding problem i googled a lot as i wanted to install Oracle 11g on my kubuntu 9.10 machine

i found out the solution that did work

To resolve this problem, you have to let X server listen on tcp port

modify file /etc/kde4/kdm/kdmrc

You will see

“ServerArgsLocal=-br -nolisten tcp”

Change that line to

“ServerArgsLocal=-br”

or comment the line as follows:

# ServerArgsLocal=-br -nolisten tcp

Restart X server (/etc/init.d/kdm restart or CTRL+ALT+backspace or restart OS)
Now you can run remote X application on your X server.

testing

disable access control of your x server use following command:

$xhost +

(you can disable access control for specific ip address with $xhost + ip_address)

$ssh user@remote_pc

$export DISPLAY=your_ip_address:0

$xclock

annnnnnnnnnnnnnnnnddddddddddd its done :)

Changed in network-manager (Ubuntu):
status: Incomplete → Fix Committed
Revision history for this message
Tv (tv42) wrote :

"xhost +" is not the solution, "xhost +" is another problem.. undid the status change, this is definitely not fixed.

Changed in network-manager (Ubuntu):
status: Fix Committed → Incomplete
Revision history for this message
kenorb (kenorb) wrote :

Sorry, where is the solution?

> xhost +
Maximum number of clients reachedxhost: unable to open display ":0.0"
???

I'm using gdm (Gnome 2.30).

I've the same problem, but on FreeBSD 8.1-STABLE
See: http://forums.freebsd.org/showthread.php?p=106367

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for network-manager (Ubuntu) because there has been no activity for 60 days.]

Changed in network-manager (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.