# 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!


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.

• I think this is on the right track. I attempted to compile Blender WITH_HEADLESS and the Python scripts were missing (crash and burn). Going to attempt to compile with PYTHON_MODULE instead of PYTHON_INSTALL and see if that changes anything. – m88 Dec 8 '16 at 21:51
• Those were just path config errors, it turns out. The WITH_HEADLESS flag didn't work, on its own -- that disabled the GUI but Cycles crashes with the same XCB_ERROR in a tty. – m88 Dec 9 '16 at 0:21
• I don't see it available to disable in ccmake but intern/cycles/CMakeLists.txt contains set(WITH_CYCLES_DEVICE_OPENCL TRUE) you could try changing that to FALSE before building. Do you have WITH_CYCLES_OPENSUBDIV enabled? opensubdiv can use a gpu through cuda or glsl as well as opencl for acceleration. – sambler Dec 10 '16 at 1:42
• Yes, a build without Cycles OpenCL did the trick -- good eye. – m88 Dec 10 '16 at 7:24

See my example with one frame and myfile.blend - is a blend file with a video animation video and sound and one cube:

C:\Users\myuser\Desktop>blender.lnk --background c:\temp\myfile.blend
--render-output C:\tmp\ --render-frame 10 -E CYCLES -x 1 -o cube -f 1
8\config\userpref.blend
AL lib: (EE) UpdateDeviceParams: Failed to set 48000hz, got 44100hz instead
found bundled python: C:\Program Files\Blender Foundation\Blender\2.78\python