Ubuntu – Not able to run firefox in a head-less Ubuntu server 9.10

firefoxheadlessUbuntuubuntu-9.10

I need to run Firefox in my server in order to execute some Selenium tests from Hudson. I would love no to have to install a complete gui. So I installed Xvfb in order to fake the Gui (I understand it this way correct me if my assumptions are wrong).

After some time trying to make it work, I'm stuck with the next situation:

$ sudo Xvfb -ac :99 &
[dix] Could not init font path element /var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType, removing from list!
(EE) config/hal: NewInputDeviceRequest failed (2)
(EE) config/hal: NewInputDeviceRequest failed (2)
(EE) config/hal: NewInputDeviceRequest failed (2)
(EE) config/hal: NewInputDeviceRequest failed (2)
(EE) config/hal: NewInputDeviceRequest failed (2)

$ firefox
[dix] Could not init font path element /var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType, removing from list!
[config/dbus] couldn't register object path
(EE) config/hal: NewInputDeviceRequest failed (2)
(EE) config/hal: NewInputDeviceRequest failed (2)
(EE) config/hal: NewInputDeviceRequest failed (2)
(EE) config/hal: NewInputDeviceRequest failed (2)
(EE) config/hal: NewInputDeviceRequest failed (2)
Xlib:  extension "RANDR" missing on display ":99.0".
GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details -  1: Failed to get connection to session: /bin/dbus-launch terminated abnormally without any error message)

I'm runnig firefox without installing it from the repositories. And I'm getting a socket timeout when I try to run the selenium tests, so I guess the problem is in Firefox and Xvfb.

I have installed already the nex package:

i   gconf-defaults-service                                                 - GNOME configuration database system (system defaults service) 

That in some forums suggest to be a fix, that in my case doesn't work.

Any explanation about the problem and ways of solving it without installing a full gui, will be very helpful.

Best Answer

You may try my way of starting up selenium and Xvfb. I create a bash script and save it as selenium.sh


#!/bin/sh

Xvfb :0 -screen 0 1024x768x24 2>&1 >/dev/null &
export DISPLAY=:0
java -jar /opt/selenium/selenium-server-1.0.3/selenium-server.jar -log /tmp/selenium.log

Then I run it the way I normal run bash scripts

$ sh selenium.sh

By the way, don't forget to include firefox on your PATH variable