Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

xvfb-run cannot start Xvfb: display clash, missing xauth or hidden error

Errorxvfb-run exits with status 3 (the xauth command is unavailable)

Short answer

xvfb-run hides Xvfb's own messages by default, so rerun it with -e to see them. The usual causes are display number 99 already taken (add -a to pick a free one) or the xauth tool missing (exit status 3). Install xvfb together with xauth for the second.

  • Applies to xvfb-run from Debian and Ubuntu packages, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Rerun the same command with the error file turned on, because the default is /dev/null.

    xvfb-run -e /dev/stderr -a your-command
  2. 2Match what you see, then jump to its fix

    1. 1The first run works and runs that overlap in time failDisplay number 99 is already in useFix
    2. 2xvfb-run exits with status 3 and reports that xauth is unavailablexauth is not installed (exit status 3)Fix

What does the error look like?

  • xvfb-run exits with status 3 (the xauth command is unavailable)
  • xvfb-run prints nothing useful, because Xvfb output goes to /dev/null by default

Cause 1 of 2

Display number 99 is already in use

1Check

xvfb-run uses server number 99 unless told otherwise. Two runs at the same time, or a leftover Xvfb, clash on it.

pgrep -a Xvfb

2Fix

Use -a so xvfb-run looks for a free server number starting at 99. Or pass a different number with -n.

xvfb-run -a your-command
# or pick a number yourself
xvfb-run -n 105 your-command

3Verify

Run two copies in parallel.

xvfb-run -a sh -c 'echo $DISPLAY'

Confirmed by manpages.debian.org

Did this fix it?

Cause 2 of 2

xauth is not installed (exit status 3)

1Check

Check for the xauth tool and read the exit code of the failing run.

command -v xauth
xvfb-run true; echo "exit: $?"

2Fix

Install xvfb together with xauth. The Ubuntu xvfb package lists xauth as a dependency.

sudo apt install xvfb xauth

3Verify

Run a trivial command under Xvfb.

xvfb-run true && echo ok

Confirmed by packages.ubuntu.com

Did this fix it?

How do I stop it coming back?

  • Always call xvfb-run with -a in CI, where jobs overlap.
  • Keep -e pointed at a log file in CI so the startup output is never lost.
  • Install xvfb and xauth together in your build image.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Related fixes

Servers

dnf cannot install MySQL on Amazon Linux 2023

dnf cannot find a mysql-server package on Amazon Linux 2023

Amazon Linux 2023 documents MariaDB, not MySQL, as its database server, with packages named mariadb105 and mariadb105-server.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.