How to Install Chrome Remote Desktop on Ubuntu 18.04

With Ubuntu 18.04 recently released, I wanted to install Chrome Remote Desktop on it to remotely access my desktop. Over the years, I keep trying to install Chrome Remote Desktop but end up dredging up a hodge-podge of articles and forum posts that sometimes lead to dead ends. So I decided to try to nail down a concrete set of working steps for myself once and for all.

Prerequisites and Installing Chrome

To begin, I started with a fresh install of Ubuntu 18.04 Desktop. Once that was done, the first thing I did was to install Google Chrome, not Chromium, but Chrome. I have never had much success running Chrome Remote Desktop with Chromium.

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb

Next, I launched Chrome and signed in so that I’d be able to install Chrome apps.

Installing Chrome Remote Desktop

I visited the Chrome Remote Desktop Web Store page and installed it by clicking “Add to Chrome”. I clicked “Launch App” and at this point I’m looking at this:

After launching Chrome Remote Desktop for the first time

I clicked “Remote Assistance — Get started”, “Share”, and “Accept and Install”. When the “Download … Host Installer” box appeared while download was happening, I did not click OK quite yet.

In a separate terminal window, I installed the Debian package from its download location and if and/or when the initial installation attempt failed, I ran sudo apt-get install -fto fix the missing dependencies and to complete the installation.

sudo dpkg -i ~/Downloads/chrome-remote-desktop_current_amd64.deb
sudo apt-get install -f
Fix missing dependencies and complete the installation

After that, the Chrome Remote Desktop dialog automatically changed to this:

At this point, Chrome Remote Desktop is allowing access on the basis that the remote client computer enters in an access code every time. But I would like the ability to remote in at any time, so let’s forge ahead.

Adding Groups

The next thing I did was to add myself to the chrome-remote-desktop group then reboot/logoff for the changes to take effect.

sudo usermod -a -G chrome-remote-desktop $USER
sudo reboot
Adding user to the chrome-remote-desktop group

Monkey Patching Chrome Remote Desktop

Next, I followed this Stack Overflow superuser post from MDMower. I’m writing the pertinent steps below which were still applicable in 18.04 and the version of Chrome Remote Desktop available as of the writing of this article.

Stop Chrome Remote Desktop:
/opt/google/chrome-remote-desktop/chrome-remote-desktop --stop

It is OK if it says that the daemon was not currently running.

Backup the original configuration:
sudo cp /opt/google/chrome-remote-desktop/chrome-remote-desktop /opt/google/chrome-remote-desktop/chrome-remote-desktop.orig
Edit the config file (sudo vim, gksudo gedit, etc):
sudo gedit /opt/google/chrome-remote-desktop/chrome-remote-desktop
Find DEFAULT_SIZES and amend to the remote desktop resolution. For example:
DEFAULT_SIZES = "1920x1080"

In my case, I set it to “1920x1200,3840x2400” since the desktop had dual-monitors.

Set the X display number to the current display number (obtain it with echo $DISPLAY from any terminal). On Ubuntu 17.10 and lower, this is usually 0, and on Ubuntu 18.04, this is usually 1:
FIRST_X_DISPLAY_NUMBER = 0

In my case, it happened to be 1.

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
Save and exit the editor. Start Chrome Remote Desktop:
/opt/google/chrome-remote-desktop/chrome-remote-desktop --start

Final Launch

Next, I launched Chrome Remote Desktop and noticed that the “Enable remote connections” button was enabled, so I clicked it and entered in a PIN number.

After remote connections were enabled, this computer came “online” and appeared online in the list on a remote client computer. I was successfully able to remotely access the active desktop.

Now I can keep the steps straight for the next time I might have to do this again. :)

Overview of Steps

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
Install Chrome, sign-in, install Chrome Remote Desktop, launch & download the installer.
sudo dpkg -i ~/Downloads/chrome-remote-desktop_current_amd64.deb
sudo apt-get install -f
sudo usermod -a -G chrome-remote-desktop $USER
sudo reboot
Monkey patch/opt/google/chrome-remote-desktop/chrome-remote-desktop following the Stack Overflow superuser post
Launch Chrome Remote Desktop and do “Enable remote connections”