LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-10-2018, 02:20 AM   #1
needanswers
LQ Newbie
 
Registered: Feb 2018
Posts: 4

Rep: Reputation: Disabled
cannot open display


Hi,

I have the following scenario:

I ran the vncserver command on my Linux machine.

From my Windows laptop, i connect to that VNC session using vncviewer.

For a while, i'm able to launch "xterm", "gnome-terminal", "firefox", or any Gui app without any problems within that VNC session.

As of today, when i try to launch "xterm", "gnome-terminal", "firefox", or any Gui app within that VNC session, i get:

cannot open display: :1

and i have never made any changes to the DISPLAY env var.

Even the "xhost" command shows:

$ xhost

xhost: unable to open display ":1"

(just to be clear, every single command i'm running is inside the vnc session that i am accessing using vncviewer)

Is there a way to fix this error, other than restarting my VNC server (because i don't want to lose the dozens of terminals i currently have opened)?

I already closed a few terminals, but that didn't seem to help.

Also, what causes this problem?

Thanks
--Andrew

Last edited by needanswers; 02-10-2018 at 02:39 AM.
 
Old 02-11-2018, 05:04 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
I don't think it is related to VNC. I would try to set DISPLAY=:0 (which is usually the default). I don't really understand why do you have :1 set.
 
Old 02-11-2018, 06:07 AM   #3
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,597

Rep: Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691
Quote:
Originally Posted by pan64 View Post
I don't think it is related to VNC. I would try to set DISPLAY=:0 (which is usually the default). I don't really understand why do you have :1 set.
He gets that if he has more than one session of X running.
If a single X session is running locally, and one is running under VNC, then the local would normally be display :0 and the first VNC session might be :1 or :10 depending upon the settings. A second VNC session might be :2 or :11.

If the display value being in the command does not match the display number of the session is ONE of the ways you might get that message. There are others, but I would check that early.
Another is if you are running the session as one user, and you sudo to another user to run the command. The logon user ONLY for the session has ownership and control of that display: any other user must be granted access or jump through an extra hoop to run things on the display. Do it wrong, and that is the warning that you see.
Let us know where thinking about thost things gets you. I am very interested in what you find.
 
Old 02-12-2018, 01:00 PM   #4
needanswers
LQ Newbie
 
Registered: Feb 2018
Posts: 4

Original Poster
Rep: Reputation: Disabled
Display :1 is the one that corresponds to the vnc session i've been using.

Quote:
$ /bin/ps -efa | grep Xvnc
bwayne 12103 1 0 Jan08 ? 04:22:37 /bin/Xvnc :1 -desktop centos7-bwayne.wayne_enterprises.com:1 (bwayne) -httpd /usr/share/vnc/classes -auth /auto/home/bwayne/.Xauthority -geometry 1650x900 -rfbwait 30000 -rfbauth /auto/home/bwayne/.vnc/passwd -rfbport 5901 -fp catalogue:/etc/X11/fontpath.d -pn -alwaysshared -pn -nolisten local
Like i said, i did NOT change the value of the DISPLAY env var. I am running every single command as myself (user "bwayne") in that VNC session ( :1 )

I don't understand why i'm getting this error, so i went ahead and ran "vncserver -kill :1" to kill that VNC session and restart the vncserver.

After killing my vncserver and restarting, i connected to that session ( :1 ) using vncviewer and am able to open various windows inside that session ( :1 ).

However, i'd like to understand why i'm encountering this error in the first place. Restarting the vncserver is not an ideal solution as i lose all of my terminals/windows.

--Andrew

Last edited by needanswers; 02-12-2018 at 01:03 PM.
 
Old 02-13-2018, 12:52 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
that VNC server is started by another user, or it has already died or it is a firewall issue or .....
Unable to open :1 means that display does not exist at all (or at least not available from the client side). -nolisten restricts where is is reachable from.
 
Old 02-13-2018, 02:12 PM   #6
needanswers
LQ Newbie
 
Registered: Feb 2018
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks for the reply...

Quote:
that VNC server is started by another user, or it has already died or it is a firewall issue or .....
Sorry if i wasn't clear. Everything is run as the same user ("bwayne") :
1. vncserver is started as "bwayne"
2. from Windows, i connect to that vnc session ( :1 ) and from the existing xterm windows, i try to launch "firefox", other xterms, and other GUI apps as user "bwayne"

I'm not sure how the problem could be firewall-related. Both the vncviewer (running on Windows laptop) and the vncserver (Linux machine) are at my company.

Quote:
Unable to open :1 means that display does not exist at all (or at least not available from the client side). -nolisten restricts where is is reachable from.
The display STILL exists because i can still connect to that vnc session ( :1 ) via vncviewer. After i am connected, i still see the MATE desktop, the menus ("Applications", "Places", "System") and various panels.

However, from an existing xterm window running inside that vnc session ( :1 ), i get "cannot open display: :1" when i try to launch "mate-calc" (the MATE calculator), "firefox", "xterm", etc... as user "bwayne".

After not finding any solutions, I went ahead and restarted the vncserver and everything is fine for now. However, this problem happened before and it's just a matter of time before it happens again.

Any other insights would be greatly appreciated.

Thanks
--Andrew

Last edited by needanswers; 02-13-2018 at 03:35 PM.
 
Old 02-14-2018, 12:46 AM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
There is no "The display". There is a display which still exists and you can connect to it and there is :1 which is unavailable. And I still don't know what's happening. Probably that is another display (:0, :2 or ...), probably blocked by firewall/whatever, probably created by someone else I have no idea. Or just the vnc server itself died. did you check the log files already?
 
Old 02-14-2018, 01:45 AM   #8
needanswers
LQ Newbie
 
Registered: Feb 2018
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
There is no "The display". There is a display which still exists and you can connect to it and there is :1 which is unavailable.
Apologies, i guess i'm still not being clear. By "The display", i meant the :1 display.

In the "VNC Server:" text field of the vncviewer application, i type in "<the_linux_machine_name>:1" (without the quotes) to connect to the VNC server.

Quote:
Or just the vnc server itself died.
If the vncserver was dead, then i wouldn't be connected to <the_linux_machine_name>:1 via vncviewer where i see the MATE desktop, etc.... and everything is still working (other than not being able to open additional GUI apps/windows)

The DISPLAY env var has always had the value of ":1" (without the quotes and i assume this value is set by the VNC server)

Quote:
Probably that is another display (:0, :2 or ...), probably blocked by firewall/whatever,
yes... there is a :2 display. When i connect to "<the_linux_machine_name>:2" (without quotes) via vncviewer, i can open xterms, etc... inside that session ( :2 ) and the DISPLAY env var is set to ":2" (without quotes) and the :2 VNC session was started by userid "bwayne" ("bwayne" is also the userid that started the :1 VNC session)

There is no firewall issue as far as i can tell.

As far as i can tell, nothing stood out in the log files.

Anyway, i guess this is one of those mysteries that cannot be solved.

Thanks
--Andrew

Last edited by needanswers; 02-14-2018 at 01:54 AM.
 
Old 02-14-2018, 05:24 AM   #9
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,597

Rep: Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691
Not every mystery gets solved, and not every mystery SHOULD be solved, but every mystery CAN be solved. This one should leave a trail in a log file indicating WHY the desktop cannot be addressed. Have you tried bouncing the acceptance using xauth during the session?
 
Old 02-14-2018, 06:09 AM   #10
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
there are several things you check:
:1 is local and does not require real network connection.
<host>:1 will go thru the net, so probably vncserver still listens on hostort, but not on localhostort. It looks like - at least for me - xnvc related (internal) error and probably you can find some related logs - if configured at all. But this can be a locked thread too, which is not logged.
xnvc itself is relatively complex because it contains the x server itself and the vnc server too.
But if you have two (or more sessions) using the same user id probably the servers conflict with each other and one of them will die (just because the second one will remove something which is unnecessary for this "second" server - for example a socket - and that will kill the connection to the first one.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] -display = "Xt error: Can't open display"? drewhead Slackware 5 11-15-2017 04:41 PM
X: display remote session or "Can't open display" DBabo Linux - General 1 07-06-2015 12:28 AM
[SOLVED] try to open xclock and get Error: Can't open display thohogan Linux - Newbie 3 10-07-2013 04:19 PM
export display and Gtk-WARNING **: cannot open display: zimma Linux - Server 0 04-24-2009 02:51 AM
xterm -display remote:0.0 Can't open display - xterm from tru64 to debian 3.1 loopy69 Linux - Software 2 04-01-2008 06:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration