tox -e npm fails to start Chrome

Bug #1684321 reported by Jack Choy on 2017-04-19
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Jack Choy

Bug Description

When running 'tox -e npm' on Ubuntu, Chrome fails to start with the following error:

19 04 2017 16:34:15.249:INFO [karma]: Karma v1.1.2 server started at http://localhost:9876/
19 04 2017 16:34:15.251:INFO [launcher]: Launching browser Chrome with unlimited concurrency
19 04 2017 16:34:15.261:INFO [launcher]: Starting browser Chrome
19 04 2017 16:34:15.461:ERROR [launcher]: Cannot start Chrome

19 04 2017 16:34:15.468:INFO [launcher]: Trying to start Chrome again (1/2).
19 04 2017 16:34:15.809:ERROR [launcher]: Cannot start Chrome

19 04 2017 16:34:15.810:INFO [launcher]: Trying to start Chrome again (2/2).
19 04 2017 16:34:16.415:ERROR [launcher]: Cannot start Chrome

19 04 2017 16:34:16.416:ERROR [launcher]: Chrome failed 2 times (cannot start). Giving up.

If you revise the [testenv:npm] rule to start chrome first, you'll see why it failed:

grep: write error
mkdir: cannot create directory ‘/.local’: Permission denied
touch: cannot touch ‘/.local/share/applications/mimeapps.list’: No such file or directory
[7633:7633:0419/] Gtk: cannot open display:

Obviously, the permission denied error is valid in that you shouldn't be able to create a directory off of root. What's missing is the $HOME preceding the directory name.

The second problem is due to an unset DISPLAY variable needed when running this in *nix environments.

This tells me Chrome needs at least $HOME and $DISPLAY, but it is not set because tox only passes the PATH variable in *nix environments as mentioned in

To fix this, we can add the following lines to the [testenv:npm] section:
passenv =

Changed in horizon:
assignee: nobody → Jack Choy (
Changed in horizon:
status: New → In Progress

Submitter: Jenkins
Branch: master

commit 989e10e7a5e6d81a961fffe973330e0251961c4d
Author: Jack Choy <email address hidden>
Date: Thu Apr 20 16:37:49 2017 -0700

    Allow Chrome to start when tox is running npm

    Chrome in *nix environments requires the HOME and DISPLAY variables
    to be set for Chrome to start properlyi when running the 'npm' rule.
    The HOME variable is needed so Chrome can load up the user's
    preferences. The DISPLAY variable is needed so it know what display
    to launch Chrome into.

    Change-Id: I84f4d1d47f065158e8f5bf5691c241061cc16aab
    Closes-Bug: #1684321

Changed in horizon:
status: In Progress → Fix Released
Akihiro Motoki (amotoki) on 2017-04-26
Changed in horizon:
milestone: none → pike-2
importance: Undecided → Low

This issue was fixed in the openstack/horizon development milestone.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers