Travis CI XVFB Breaking Change

Posted on

This morning I was greeted by a bunch of failing front-end builds on Travis CI because XVFB couldn’t start. Here’s how to fix it.

The Problem

Travis CI released an update to their Xenial build environemnt, which introduced a new way to start up XVFB for front-end builds.

Unfortunately, they broke all existing builds based on their documentation, which had you set it up like this:

  # start XVFB to test the extension (headless does not install extensions fully)
  - "export DISPLAY=:99.0"
  - "sh -e /etc/init.d/xvfb start"
  - sleep 3 # give xvfb some time to start

Starting on January 15, 2019, your builds will start failing with messages like this:

$ export DISPLAY=:99.0
$ sh -e /etc/init.d/xvfb start
sh: 0: Can't open /etc/init.d/xvfb
The command "sh -e /etc/init.d/xvfb start" failed and exited with 127 during .

The Solution

You need to remove the portion of your before_script that starts xvfb and instead use the new syntax of:

  - xvfb

This new syntax is now in their documentation, so check that out for more information.

Find an issue?
Open a pull request against my blog on GitHub.
Ben Limmer