Xvfb
Encyclopedia
In the X Window System
X Window System
The X window system is a computer software system and network protocol that provides a basis for graphical user interfaces and rich input device capability for networked computers...

, Xvfb or X virtual framebuffer
Framebuffer
A framebuffer is a video output device that drives a video display from a memory buffer containing a complete frame of data.The information in the memory buffer typically consists of color values for every pixel on the screen...

is an X11 server
Server (computing)
In the context of client-server architecture, a server is a computer program running to serve the requests of other programs, the "clients". Thus, the "server" performs some computational task on behalf of "clients"...

 that performs all graphical operations in memory, not showing any screen output. From the point of view of the client
Client (computing)
A client is an application or system that accesses a service made available by a server. The server is often on another computer system, in which case the client accesses the service by way of a network....

, it acts exactly like any other server, serving requests and sending events and errors as appropriate. However, no output is shown. This virtual
Virtual
The term virtual is a concept applied in many fields with somewhat differing connotations, and also, differing denotations.The term has been defined in philosophy as "that which is not real" but may display the salient qualities of the real....

 server does not require the computer it is running on to even have a screen or any input device
Input device
In computing, an input device is any peripheral used to provide data and control signals to an information processing system such as a computer or other information appliance...

. Only a network
Computer network
A computer network, often simply referred to as a network, is a collection of hardware components and computers interconnected by communication channels that allow sharing of resources and information....

 layer is necessary.

Xvfb is primarily used for testing:
  1. since it shares code with the real X server, it can be used to test the parts of the code that are not related to the specific hardware;
  2. it can be used to test clients in various conditions that would otherwise require a range of different hardware; for example, it can be used to test whether clients work correctly at depth
    Color depth
    In computer graphics, color depth or bit depth is the number of bits used to represent the color of a single pixel in a bitmapped image or video frame buffer. This concept is also known as bits per pixel , particularly when specified along with the number of bits used...

    s or screen sizes that are rarely supported by hardware
  3. background running of clients (the xwd
    Xwd
    In the X Window System, xwd is a program for capturing the content of the screen or of a window and saving it into a file.xwd can be run in two ways: if user specifies the whole screen or the name or identifier of a window as an argument, the program captures the content of the window; otherwise,...

     program or a similar program for capturing a screenshot
    Screenshot
    A screenshot , screen capture , screen dump, screengrab , or print screen is an image taken by a computer to record the visible items displayed on the monitor, television, or another visual output device...

     can be used to actually see the result)
  4. running programs that require an X server to be active even when they do not use it (e.g. Clover html reports)


As an example, the following sequence of commands runs the virtual framebuffer as display ":1", runs a program on it, and captures the virtual screen in the file image.xwd:

Xvfb :1 &
xv -display :1 &
xwd -display :1 -root -out image.xwd
convert image.xwd image.bmp

The result can be shown by running xwud -in image.xwd or xv image.xwd. You can also use the wrapper script xvfb-run on some platforms, removing the need to worry about selecting a display code and managing authentication.

xvfb-run command

Xvfb is also used for remote control. VNC over Secure shell
Secure Shell
Secure Shell is a network protocol for secure data communication, remote shell services or command execution and other secure network services between two networked computers that it connects via a secure channel over an insecure network: a server and a client...

 is slightly faster than X11 over SSH. In this case, Xvfb is often combined with a lightweight window manager such as Fluxbox
Fluxbox
Fluxbox is a stacking window manager for the X Window System, which started as a fork of Blackbox 0.61.1, with the same aim to be lightweight. Its user interface has only a taskbar, a pop-up menu accessible by right-clicking on the desktop, and minimal support for graphical icons...

 and a VNC server such as X11vnc
X11vnc
In computing, x11vnc is a Virtual Network Computing server program. It allows remote access from a remote client to a computer hosting an X Window session and the x11vnc software, continuously polling the X server's frame buffer for changes...

. A possible sequence of commands to start this on the server is:

export DISPLAY=:1
Xvfb :1 -screen 0 1024x768x16 &
fluxbox &
x11vnc -display :1 -bg -nopw -listen localhost -xkb

The next step is to fire up a SSH client such as PuTTY
PuTTY
PuTTY is a free and open source terminal emulator application which can act as a client for the SSH, Telnet, rlogin, and raw TCP computing protocols and as a serial console client...

 with tunneling to localhost port 5900 enabled. Then, you can connect a vncviewer to localhost to get remote control over the server.

ssh -N -T -L 5900:localhost:5900 user@remotehost &
vncviewer -encodings 'copyrect tight zrle hextile' localhost:5900

x11vnc's man page also contains instructions.

Xvnc (not to be confused with x11vnc) is very similar to Xvfb.

External links

  • Xvfb manual page
  • Xvfb + Firefox – making automatic screenshots of web pages, using Xvfb and Mozilla Firefox
    Mozilla Firefox
    Mozilla Firefox is a free and open source web browser descended from the Mozilla Application Suite and managed by Mozilla Corporation. , Firefox is the second most widely used browser, with approximately 25% of worldwide usage share of web browsers...

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK