(Updated for 18.04)To show the same display session in Ubuntu by Chrome Remote Desktop

The default configuration of Chrome Remote Desktop in Ubuntu opens a new session instead the same desktop currently running.

To fix this, please follow these steps:

Stop it:
/opt/google/chrome-remote-desktop/chrome-remote-desktop –stop

Back it up:
cp /opt/google/chrome-remote-desktop/chrome-remote-desktop /opt/google/chrome-remote-desktop/chrome-remote-desktop.orig

Edit: /opt/google/chrome-remote-desktop/chrome-remote-desktop

Change this to the size I wanted.
DEFAULT_SIZES = “1920×1080”

Set the X display number to the current display number (obtain it with echo $DISPLAY from any terminal).

FIRST_X_DISPLAY_NUMBER = 0

Comment out sections that look for additional displays:

#while os.path.exists(X_LOCK_FILE_TEMPLATE % display):
# display += 1
Reuse the existing X session instead of launching a new one. Alter launch_session() by commenting out launch_x_server() and launch_x_session() and instead setting the display environment variable, so that the function definition ultimately looks like the following:

def launch_session(self, x_args):
self._init_child_env()
self._setup_pulseaudio()
self._setup_gnubby()
#self._launch_x_server(x_args)
#self._launch_x_session()
display = self.get_unused_display_number()
self.child_env[“DISPLAY”] = “:%d” % display #Pls change the quotes to plain quotes

Start it:
/opt/google/chrome-remote-desktop/chrome-remote-desktop –start

DONE. Now it attaches to Unity’s existing X Server on display :0.

Credit to the discussion of these post  https://productforums.google.com/forum/#!topic/chrome/LJgIh-IJ9Lk

https://superuser.com/questions/778028/configuring-chrome-remote-desktop-with-ubuntu-gnome-14-04

8 thoughts on “(Updated for 18.04)To show the same display session in Ubuntu by Chrome Remote Desktop

  1. Try using alternative tools like logmein, gosupportnow, teamviewer, R-HUB remote support servers etc. and check if the issue still persists.

    Like

  2. It works! (Ubuntu 16.04)

    Please also mention to add lines:

    display = self.get_unused_display_number()
    self.child_env[“DISPLAY”] = “:%d” % display

    Like

  3. Hurrah! Ubuntu 16.04 FINALLY works! This fixed my long troubling display nightmare. I wasn’t able to see the whole desktop, but now I don’t need fckn’ TeamV***er anymore.

    Thank you, Yichao and Nickson!

    As a reference, if you copy and paste from the blog, you might get error from the special character “. You might want to type it yourself. Maybe, : % too.

    Like

  4. This works for me on Ubuntu 18.04.3 LTS


    diff –git a/chrome-remote-desktop.orig b/chrome-remote-desktop
    index a40063b..de1b3b0 100755
    — a/chrome-remote-desktop.orig
    +++ b/chrome-remote-desktop
    @@ -66,11 +66,11 @@ XORG_DUMMY_VIDEO_RAM = 1048576 # KiB
    # with large or multiple monitors. This is a comma-separated list of
    # resolutions that will be made available if the X server supports RANDR. These
    # defaults can be overridden in ~/.profile.
    -DEFAULT_SIZES = "1600×1200,3840×2560"
    +DEFAULT_SIZES = "1920×1080"
    # If RANDR is not available, use a smaller default size. Only a single
    # resolution is supported in this case.
    -DEFAULT_SIZE_NO_RANDR = "1600×1200"
    +DEFAULT_SIZE_NO_RANDR = "1920×1080"
    SCRIPT_PATH = os.path.abspath(sys.argv[0])
    SCRIPT_DIR = os.path.dirname(SCRIPT_PATH)
    @@ -90,7 +90,7 @@ SESSION_FILE_PATH = os.path.join(HOME_DIR, ".chrome-remote-desktop-session")
    SYSTEM_SESSION_FILE_PATH = "/etc/chrome-remote-desktop-session"
    X_LOCK_FILE_TEMPLATE = "/tmp/.X%d-lock"
    -FIRST_X_DISPLAY_NUMBER = 20
    +FIRST_X_DISPLAY_NUMBER = 0
    # Amount of time to wait between relaunching processes.
    SHORT_BACKOFF_TIME = 5
    @@ -355,8 +355,6 @@ class Desktop:
    """Return a candidate display number for which there is currently no
    X Server lock file"""
    display = FIRST_X_DISPLAY_NUMBER
    – while os.path.exists(X_LOCK_FILE_TEMPLATE % display):
    – display += 1
    return display
    def _init_child_env(self):
    @@ -484,18 +482,6 @@ class Desktop:
    if not xvfb:
    xvfb = "Xvfb"
    – logging.info("Starting %s on display :%d" % (xvfb, display))
    – screen_option = "%dx%dx24" % (max_width, max_height)
    – self.x_proc = subprocess.Popen(
    – [xvfb, ":%d" % display,
    – "-auth", x_auth_file,
    – "-nolisten", "tcp",
    – "-noreset",
    – "-screen", "0", screen_option
    – ] + extra_x_args, env=self.child_env)
    – if not self.x_proc.pid:
    – raise Exception("Could not start Xvfb.")
    self._wait_for_x()
    with open(os.devnull, "r+") as devnull:
    @@ -653,8 +639,8 @@ class Desktop:
    self._init_child_env()
    self._setup_pulseaudio()
    self._setup_gnubby()
    – self._launch_x_server(x_args)
    – self._launch_x_session()
    + display = self.get_unused_display_number()
    + self.child_env["DISPLAY"] = ":%d" % display
    def launch_host(self, host_config):
    # Start remoting host

    It contains what @Nickson mentioned.

    Liked by 1 person

  5. […] Now that should get you going fairly well – did for me! But if was not loading the active desktop at all, and in turn, I couldn’t access my desktop like say on a Mac/Windows rig – so reading through the AUR & Google search I found the link to the “Ubunutu” fix for this, which works exactly the same on Manjaro! So off we go to the helpful blog post. […]

    Like

Leave a comment