96

I have Ubuntu 11.04 I am trying to install Xvfb and CutyCapt in order to take a snapshot of webpage I followed a instruction https://github.com/jaequery/cutycapt-installer-script-on-ubuntu/blob/master/install and I executed last line and it gives me an error

xvfb-run: error:Xvfb failed to start

Any solution for that? Thank you in advance

user1413449
  • 1,043
  • 1
  • 7
  • 12
  • 28
    `xvfb-run` hides error messages by default... give it a `-e /dev/stdout` to see what the problem is. –  May 24 '13 at 01:12
  • 1
    I am getting Server is already active for display 99 If this server is no longer running, remove /tmp/.X99-lock and start again. – user1413449 May 24 '13 at 17:22
  • Did you remove the temporary file as the message recommended? What was the result? – dcorking Jul 01 '14 at 07:34
  • If you want to run multiple processes at the same time, then it is best not to remove the lock file, but use -a option, as described in answers below. This will get the next free server number. – Mircea Aug 08 '18 at 11:06

5 Answers5

152

I was getting this error "xvfb-run: error: Xvfb failed to start" on Ubuntu 14.04, where previously my script had run without problems on Ubuntu 12.04.

My scripts were running calling xvfb-run multiple times, but I was seeing fails due to the error "Server is already active for display 99"

It seemed that the Xvfb wasn't ending when the xvfb-run command returned.

My solution was to use "xvfb-run -a [mycommand]" so xvfb uses another display if 99 is in use.

Tom
  • 6,325
  • 4
  • 31
  • 55
  • 25
    This answer pointed me to the solution. In my case, a previous run of xvfb-run was hung so I found the pid using "ps aux | grep xvfb" and killed the process. – Jono Oct 23 '14 at 18:32
  • 4
    -a also worked for me using with wkhtmltopdf :) xvfb-run -a /usr/bin/wkhtmltopdf –  May 30 '17 at 15:53
32

Had the same issue, solved it by running this instead:

xvfb-run --auto-servernum --server-num=1 [your script]

--auto-servernum : Try to get a free server number, starting at 99, or the argument to --server-num

kakhkAtion
  • 2,264
  • 22
  • 23
24

Run xvfb-run -e /dev/stdout [mycommand] as @wumpus suggested.

I received the server lock message:

Fatal server error:
Could not create server lock file: /tmp/.X99-lock

xvfb-run: 

error: Xvfb failed to start

Using sudo resolved the issue for me:

sudo xvfb-run -e /dev/stdout [mycommand]
absynce
  • 1,399
  • 16
  • 29
19

Found the problem There is hanging process in system with name

Xvfb

I killed it and work fine. I newer found it earlier beacuse I used to try to find process with 'xvfb' name

Ronak Patel
  • 3,324
  • 4
  • 21
  • 31
0

I came across this error when running a bash script on Mac OS. Opening XQuartz before running the script solved my problem.

Yeoman
  • 51
  • 5