xvfb-run cannot start Xvfb: display clash, missing xauth or hidden error
xvfb-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.
Fix it fast
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-command2Match what you see, then jump to its 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 Xvfb2Fix
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-command3Verify
Run two copies in parallel.
xvfb-run -a sh -c 'echo $DISPLAY'Confirmed by manpages.debian.org
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 xauth3Verify
Run a trivial command under Xvfb.
xvfb-run true && echo okConfirmed by packages.ubuntu.com
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
x11vnc cannot connect to the X display
x11vnc exits at start and no VNC port is opened
x11vnc must open an X display it is allowed to use.
3 causes, each with a fixServers
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 fixServers
Ansible hangs, then times out waiting for the sudo prompt
a playbook using become seems to hang
Ansible ran sudo on the target and never saw the answer it expected.
3 causes, each with a fixServers
Apache on Ubuntu returns 404 Not Found for my site
The requested URL was not found on this server.
On Ubuntu a 404 from Apache usually means the request maps to a path that has no file.
3 causes, each with a fixServers
Apache returns 504 Gateway Timeout when PHP takes too long
Quick requests work, slow ones end in a 504 after a fixed wait
A 504 from Apache means the backend did not answer within the proxy timeout.
2 causes, each with a fixServers
Apache logs SIGWINCH and exits on its own
the httpd container stops although nothing crashed
SIGWINCH is Apache's graceful-stop signal.
2 causes, each with a fix