33

I have setup the xvfb server on my headless server and when I m running the DISPLAY=:99 firefox I am getting this exception missing RANDR extension

Many of them said to disable some xinerna from the xorg.conf file but this file is not getting created in my case.

So I am searching for how to add the missing RANDR extension.

m3nda
  • 1,986
  • 3
  • 32
  • 45
Mahesh More
  • 919
  • 2
  • 8
  • 20

3 Answers3

25

I am seeing this error message when I run Firefox headless through selenium using xvfb. It turns out that the message was a red herring for me. The message is only a warning, not an error. It is not why Firefox was not starting correctly.

The reason that Firefox was not starting for me was that it had been updated to a version that was no longer compatible with the Selenium drivers that I was using. I upgraded the selenium drivers to the latest and Firefox starts up fine again (even with this warning message about RANDR).

New releases of Firefox are often only compatible with one or two versions of Selenium. Occasionally Firefox is released with NO compatible version of Selenium. When that happens, it may take a week or two for a new version of Selenium to get released. Because of this, I now keep a version of Firefox that is known to work with the version of Selenium that I have installed. In addition to the version of Firefox that is kept up to date by my package manager, I have a version installed in /opt/ (eg /opt/firefox31/). The Selenium Java API takes an argument for the location of the Firefox binary to be used. The downside is that older versions of Firefox have known security vulnerabilities and shouldn't be used with untrusted content.

Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
  • you saved me a couple of hours :) – ramigg Mar 23 '15 at 09:21
  • You can pass the binary location you like when loading the webdriver. That includes a custom install, a portable one or whatever you point to. – m3nda Jun 26 '15 at 18:11
  • well, what pair are you using now? 4.43 with 29? – Buffalo Sep 03 '15 at 14:50
  • I'm currently running Firefox 31 with Selenium 2.43.1 (Java drivers). – Stephen Ostermiller Sep 03 '15 at 14:52
  • cool story, but this has nothing to do with the question asked – Corey Goldberg Jun 28 '18 at 16:33
  • @CoreyGoldberg That error message in the question is the most prominent thing you see when Firefox Selenium fails to start. My guess is that even the person that asked the question was just barking up the wrong tree. They didn't need to add randr extensions, but there was no other error or warning messages for them to zero in on. – Stephen Ostermiller Jun 28 '18 at 16:41
  • @StephenOstermiller the question never even mentions selenium. Guessing about possible solutions based on details that weren't provided is not the same thing as answering a question that was asked. There's a chance your solution may help the OP user, but that's not at all relevant. SO is a Q&A site, not an interactive debugging and troubleshooting service. – Corey Goldberg Jun 29 '18 at 14:39
17

First off, Xvfb doesn't read configuration from xorg.conf. Xvfb is a variant of the KDrive X servers and like all members of that family gets its configuration from the command line.

It is true that XRandR and Xinerama are mutually exclusive, but in the case of Xvfb there's no Xinerama in the first place. You can enable the XRandR extension by starting Xvfb using at least the following command line options

Xvfb +extension RANDR [further options]
datenwolf
  • 159,371
  • 13
  • 185
  • 298
  • 1
    At least on raspbian, there seems to be no RANDR support from Xvfb. Is there an alternative solution? – Black Feb 01 '14 at 08:02
  • 2
    @Black: You can always build from source yourself with your own, custom configuration. I strongly suggest to install the toolchain on the Raspbian system itself and compile there. Luckily Xvfb is not very complex and a manageable task for a R-Pi; you definitely don't want to go through the struggles of setting up a compatible cross-compilation toolchain, if you can avoid it. – datenwolf Feb 01 '14 at 11:51
  • @DenisShevchenko: what's the result of executing `strings $(which Xvfb) | grep -i randr` – datenwolf Mar 02 '16 at 08:31
  • 1
    @datenwolf Empty result. In fact, I use `xvfb-run`. – Denis Shevchenko Mar 02 '16 at 09:41
  • @DenisShevchenko: `xvfb-run` is not the same as `Xvfb`. You have to pass the parameters to `Xvfb` and it may very well be that `xvfb-run` drops the additional command line arguments. – datenwolf Mar 02 '16 at 10:14
  • @datenwolf I can use `xvfb-run` with additional parameters for `Xvfb`. For example, when I run this `xvfb-run -n 122 -s '+extension RANDR' firefox http://www.google.com` - I see Xvfb process `Xvfb :122 -xkbdir /nix/store/izm517h2yl5qx67hpb6byw8cqr7pwkjh-xkeyboard-config-2.15/etc/X11/xkb +extension RANDR -nolisten tcp`. So `+extension RANDR` doesn't help... – Denis Shevchenko Mar 02 '16 at 10:57
  • @DenisShevchenko: Okay. But you should still test if `Xvfb` itself has been built with RANDR support. Anyway, the result of the command, as I asked you to run, comes out empty, then your particular build of `Xvfb` has been built without support for RANDR. The only solution is to get a build with this supported. Either by building it yourself, or finding a suitable binary. – datenwolf Mar 02 '16 at 12:35
  • @DenisShevchenko: I am using raspbian as well, and running `strings $(which Xvfb) | grep -i randr` does show matches. Yet I still get `Xlib: extension "RANDR" missing on display ":1"`, Any pointers on compiling from source? – Brant Sterling Wedel Jun 11 '16 at 04:17
  • @BrantSterlingWedel: Even if RANDR support has been built into Xvfb it's not enabled by default. See my original answer for how to enable. – datenwolf Mar 23 '17 at 01:05
2

I had the same problem with Firefox 30 + Selenium 2.49 + Ubuntu 15.04.

It worked fine with Ubuntu 14 but after upgrade to 15.04 I got same RANDR warning and problem at starting Firefox using Xfvb.

After adding +extension RANDR it worked again.

$ vim /etc/init/xvfb.conf

#!upstart
description "Xvfb Server as a daemon"

start on filesystem and started networking
stop on shutdown

respawn

env XVFB=/usr/bin/Xvfb
env XVFBARGS=":10 -screen 1 1024x768x24 -ac +extension GLX +extension RANDR +render -noreset"
env PIDFILE=/var/run/xvfb.pid

exec start-stop-daemon --start --quiet --make-pidfile --pidfile $PIDFILE --exec $XVFB -- $XVFBARGS >> /var/log/xvfb.log 2>&1
zabumba
  • 12,172
  • 16
  • 72
  • 129
  • Worked on Ubuntu 14.04 or 14.10? cause I am trying on 14.04 and I am getting the `missing RANDR` extension message when trying to run Chromium-browser ... ok that might be Chromium issue – zabumba Apr 14 '16 at 14:44