Headless Blender using Cycles without X-server? I would like to render with Cycles on a headless machine, without an X-server.

Has anyone done this with success?

I am getting the following error on Linux using Blender 2.78a:


$: blender -b cube.blend -E CYCLES -x 1 -o cube -f 1
terminate called after throwing an instance of 'OCLRT::xcb_error'
  what():  XCB ERROR: X session is not running!
Read new prefs: /home/mbomba/.config/blender/2.78/config/userpref.blend
read blend: /home/mbomba/Documents/art/3d/cube.blend


Update: 
To clarify, this works fine if executed in a terminal when an X session is running.  I'm wondering if it's a bug -- I was thinking about automating a cluster to render animations but the X dependency is kind of raining on my parade.

Update 2: 
I compiled a version of Blender using the WITH_HEADLESS flag and I get the same error when I run it without X. 

Update 3: 
While I haven't been able to assimilate any of this information into a coherent solution, after some research I found that people encountered the same error occurs frequently with Beignet / Intel OpenCL driver installations.  

Update 4: 
I tested this via ssh on another machine and it works fine.  It must be a problem specific my system.  I would like to know what library is causing this issue, but I plan to do most of my rendering on the other machine anyhow.

SOLUTION

As sambler suggested in the comment, changing set(WITH_CYCLES_DEVICE_OPENCL TRUE) to set(WITH_CYCLES_DEVICE_OPENCL FALSE) in intern/cycles/CMakeLists.txt prior to building allowed me to render with Cycles in a tty.  The issue must be related to the OpenCL drivers on my system.
It has been a while but I have rendered on a headless machine. I did have Xorg installed to be able to run x11 apps remotely but the was no running X-server on the remote machine.

If you want to get blender running without any X-server software installed then you will most likely have to compile your own version of blender. There is an option to build WITH_HEADLESS that will disable all dependencies on Xorg libraries.