Running X applications headless using Xvfb

Sometimes, you might want to run certain X applications as a daemon in the background. For example, in my case, I want to make Ktorrent run in the background on startup while I control the torrents using its WebUI. However, to run Ktorrent , I must have X running and logged in to the desktop. So, how can I do this? , the answer is by using X Virtual Framebuffer Server.

How it works?

Xvfb emulates an X server without outputing it to monitor. Applications connect to it and run under the impression the GUI is there. Its as simple as that!. No modification needed on the applications that going to be run on it.

Read more :

How to do it?

First, make sure you have Xvfb installed. If you dont, install it using your package manager.
In Fedora, use
yum install xorg-x11-server-Xvfb

Then, run Xvfb in any unique/unused display number, in this example, I put 100. Disable access control to the display so that you dont have to go through the hassle of setting access control for it.
Xvfb :100 -ac

Now that you got Xvfb up and running, time to start the app.

Before starting the app, export the DISPLAY environment variable to point to display number 100
export DISPLAY=:100.0

execute the command for the app, and ure good to go :D



Anonymous said…
Great! thx
Unknown said…
I have experienced, and read of people who get the following error when running this program:
config/hal: NewInputDeviceRequest failed (2)

I tried starting it in the background with -extension GLX & added, and it seemed to work. Even if you get those messages, try it anyway:
Xvfb :100 -ac -extension GLX &

Popular posts from this blog

Announcing PlatoCDP, a Plone distribution for enterprises.

Adding simple popup to Plone frontpage

An Open Letter for the Rector of PETRONAS University of Technology