Unable to open X display when trying to run Google Chrome on Ubuntu

A guide to resolving the "Unable to open X display" error when launching Google Chrome

When you try to run Google Chrome on Ubuntu and encounter the following error:

[4520:4520:0529/072952.636189:ERROR:ui/ozone/platform/x11/ozone_platform_x11.cc:248] Missing X server or $DISPLAY
[4520:4520:0529/072952.636223:ERROR:ui/aura/env.cc:257] The platform failed to initialize.  Exiting.

This indicates that the X server is not running or the $DISPLAY environment variable is not set correctly. Here are some steps to resolve this issue:

Install Xvfb if haven't install.

It does not require additional hardware.

sudo apt-get install -y xvfb

Install some dependencies to make "headless" Chrome/selenium work

sudo apt-get -y install xorg xvfb gtk2-engines-pixbuf
sudo apt-get -y install dbus-x11 xfonts-base xfonts-100dpi xfonts-75dpi xfonts-cyrillic xfonts-scalable

[Optional]: Install dependencies for capturing screenshots of Xvfb display

sudo apt-get -y install imagemagick x11-apps

Make sure that Xvfb stars every time the box/vm is booted.

You can add the above commands to your .bashrc or .profile file to ensure they are executed every time you log in.

Xvfb -ac :99 -screen 0 1280x1024x16 &
export DISPLAY=:99

Rerun the Google chrome command

google-chrome

Written by

KarChunT

Last Updated

Fri Jun 27 2025

Tags

LinuxUbuntuChrome