Xvfb or X virtual framebuffer is an X server that can run on machines with no display hardware and no physical input devices. It emulates a dumb framebuffer using virtual memory. The primary use of this server was intended to be server testing. The mfb or cfb code for any depth can be exercised with this server without the need for real hardware that supports the desired depths. The X community has found many other novel uses for Xvfb, including testing clients against unusual depths and screen configurations, doing batch processing with Xvfb as a background rendering engine, load testing, as an aid to porting the X server to a new platform, and providing an unobtrusive way to run applications that don't really need an X server but insist on having one anyway.
IBM had porting of Xvfb on zOS 10 years ago as part of ported tools and kept it unchanged for a long time. But lots of problems are reported and security vulnerability is also exposed. z/OS development in China made new porting of Xvfb based on the source code from Xorg(https://www.x.org) version 6.9 to keep same functionality, but fix some known issues and 40+ CVEs for enhancement.
Xvfb is primarily used for testing:
- 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.
- 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 depths or screen sizes that are rarely supported by hardware.
- Background running of clients. (the xwd program or a similar program for capturing a screenshot can be used to actually see the result)
- Running programs that require an X server to be active even when they do not use it. (e.g. Clover html reports)
How to start the Xvfb on z/os
The Xvfb application is under the direction '/usr/lpp/tcpip/bin/X11'
IBM Xvfb samples uil
A shell script named startXvfb.sh is provided. This script will help the user to set up the running environment and start the Xvfb server with default options. The user can find the script under the directory 'samples'. Please run the script with the root user.
SecurityPolicy fonts rgb.txt startXvfb.sh
#>./startXvfb.sh 1 (here, the number '1' is the display number, and the default number is '8')
Starting Xvfb using server/display :1
Xvfb will be run in the background.
Run "ps -ef | grep Xvfb" to see process ID.
Should you see the message:
XVFB0178: Failed to establish all listening sockets
specify a different server/display number.
When you see the above message, the Xvfb server has been started successfully.
How to connect to Xvfb from client
- If the Xvfb server and the client are on the same machine:
- If the Xvfb server is on the different machine from the client is on:
#>export DISPLAY=servername/IP :1
Here, the application xclock will connect to the server, and one clock will be displayed on the Xvfb screen.
How to dump an image of an Xvfb Screen
1. Modify startXvfb.sh to add the black line
$XVFB :$SN \
-screen 0 640x480x8 \
-sp $SP/SecurityPolicy \
-co $RP/rgb \
-fp $FP/misc,$FP/100dpi,$FP/75dpi,$FP/Speedo,$FP/Type1 \
-fbdir /tmp \
& # run in background
2. Start the Xvfb server and try to run an X application
Figure1: an xterm window
Or from a remote Linux client
(from Linux, run the IBM application 'sametime' )
3. Check the dump file Xvfb_screen0 under /tmp
4 copy file /tmp/Xvfb_screen0 to Linux
5 Run Linux command xwud to display the image
#>xwud -in Xvfb_screen0
Figure2: sametime application started
The Xvfb server may report the following issue:
#>XVFB0105: FreeFontPath: FPE "/usr/lpp/tcpip/bin/X11/samples/fonts/misc" refcount is 2, should be 1; fixing.
The user can ignore this message.
If the X server can not be started or the server crashed down, please try to delete the Xvfb related temporary files under /tmp
#>rm -rf /tmp/.X*