New issue
Advanced search Search tips

Issue 917598 link

Starred by 4 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Jan 1
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug



Sign in to add a comment

DISPLAY is set to ':0', but it's actually :20

Project Member Reported by js...@chromium.org, Dec 22

Issue description

When I made a Chrome remote desktop connection to Linux host (from macOS client), I found that 'DISPLAY' environment variable is set to ':0' which is a physical X session running on the host. 

When I started xterm or any other X applications, they didn't show up in Chrome Remote desktop session.  Apparently, they went to DISPLAY :0 (physical monitor attached to the host). 'xdpyinfo' has the same information (the host monitor's resolution, etc: 3820x1xxx )

I looked at chrome-remote-desktop (in /opt/google/chrome-remote-desktop) to find the following line:

FIRST_X_DISPLAY_NUMBER = 20

So, I set DISPLAY to ':20' and X11 applications began to show up in Chrome remote desktop session. 

I wonder why the environment variable DISPLAY is set to ':0'.  
 
Chrome Remote Desktop sets the value of DISPLAY to :20 (or whatever number it chooses for the session if :20 is unavailable).
If DISPLAY is :0, that means something else is overriding it.
It's unusual for scripts to modify the value of DISPLAY. That would break many things (SSH + X11-forwarding, multi-seat setups, ...)
Maybe something in your own startup files (such as ~/.bashrc) is hard-coding DISPLAY=:0 ?

Status: WontFix (was: Untriaged)
Thanks for the explanation. 

>  Maybe something in your own startup files (such as ~/.bashrc) is hard-coding DISPLAY=:0 ?


I was using screen and I may have done something stupid there. 
You haven't done anything stupid! :) This is a general problem with 'screen' and other terminal multiplexers. If you create a 'screen' session on DISPLAY :0, and you attach to it from Chrome Remote Desktop (CRD), that session will still have the old value of $DISPLAY.

It isn't just $DISPLAY that causes issues with 'screen'. CRD also sets up some other variables:

LD_LIBRARY_PATH is set so that programs running in CRD use software-rendered OpenGL.

CHROME_USER_DATA_DIR is set so that Chrome uses a separate profile. When you run Chrome inside CRD, it will run a new browser session and won't try to connect to any pre-existing Chrome session on :0 .

PULSE_... variables are set to ensure that programs running in CRD use a virtual audio output device, so that audio gets remoted through CRD.

If any of these variables are captured in a 'screen' session, it can affect programs that rely on them. For example, if you start a session within CRD, and try to attach to the session on your physical display :0, and try to run Chrome, you will find that Chrome behaves as if it's running in CRD. And programs won't play any sound, because they try to use CRD's audio device. And GPU hardware-acceleration will stop working for those programs.

It's better to avoid starting graphical apps from a 'screen' session. If you have to do this, you need to manage the DISPLAY variable yourself.

Sign in to add a comment