Tuesday, September 18, 2007

Setting Up a Virtual Frame Buffer (XVBF) to Support Open Office

Deploying Alfresco Community I may need to setup OpenOffice and how I discovered with surprise, OpenOffice insist to connect with X, and there was no X server to connect. So OpenOffice exits with error:

$ soffice "-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" -nologo -headless -nofirststartwizard &

soffice.bin X11 error: Can't open display:
Set DISPLAY environment variable, use -display option
or check permissions of your X-Server
(See "man X" resp. "man xhost" for details)

I think because it needs X as rendering engine. I installed Xvbf, that is a X server that can run on machines with no display hardware and no physical input devices. It emulates a dumb framebuffer using virtual memory.

To avoid this problem you have simply start Xvfb before OpenOffice and setup properly the DISPLAY environment variable. If you don't have Xvfb installed on your system you can add it with:

$ apt-get install xvfb

Then you can start it:

$ Xvfb :5 -screen 0 1600x1200x24 &

the Virtual Frame Buffer now is on display 5 screen 0, so you have to set the DISPLAY environment variable to:

$ export DISPLAY=:5.0

Finally now you can start Open Office as daemon.

No comments: