EDIT: My main goal is to set GPU preferences for cycles on a headless server in my basement. Originally, every time I asked how to do this from command line, people would tell me to “Just use VNC,” which wouldn’t work either which is why I started posting here.
I am using tightVNC to connect to an Ubuntu 18.04 server.
When I try to start blender, I get the following error in the command line:
Xlib: extension “XInputExtension” missing on display “:1”.
Read prefs: /home/shard1/.config/blender/2.79/config/userpref.blend
/build/blender-UBljLx/blender-2.79.b+dfsg0/intern/ghost/intern/GHOST_WindowX11.cpp:198: X11 glXQueryVersion() failed, verify working openGL system!
initial window could not find the GLX extension
Writing: /tmp/blender.crash.txt
Segmentation fault (core dumped)
I then tried to run “sudo xinit &” and “/opt/VIrtualGL/bin/vglrun blender” but got the following error:
Xlib: extension “XInputExtension” missing on display “:1”.
Read prefs: /home/shard1/.config/blender/2.79/config/userpref.blend
[VGL] ERROR: Could not open display :0.
I’m like 7 problems deep into the trouble shooting rabbit hole atm so any help would be greatly apreciated.
Based on the missing OpenGL, you might need some libraries installed, like the mesa libraries. What does the crash report say at /temp/blender.crash.txt
Emulated drivers wont go well with Blender. If you have a desktop running (that already is running on real graphics card) already use Nomachine instead of Vnc.
You did not tell how you are running the Ubuntu server. Is it a VPS or a real desktop, headless etc?
If you have no real desktop or no real graphics card (like a VirtualBox, or Qemu) then you can try putting opengl dlls in the folder on Windows but you wont get good performance.
Find the opengl dll ffrom this release and put where the binary is. In any case these will just let you start Blender but you wont be able to do advanced stuff, if you are lucky.
For Windows
For Linux
try installing Mesa drivers
Another thing you can try is to use Virtualbox on Ubuntu to run a version of Windows/Linux with their Virtualbox opengl drivers
The last resort is to run the command line version of Blender on your server and use Python to control it.
The machine is an old computer that I have in my basement with a GTX 970. The only reason I need to open Blender is because I need to set the CUDA device in the preferences which I can’t do from SSH.
If this is about rendering see if you can set the cuda in the script then render your scene via the script. I think there was a similar post recently of this kind of use.
However there might be limitations of Cuda on different systems and I am not sure how that would play out on Linux.
Also, somewhat unrelated question: Since this thread changed from “Can’t start blender through VNC,” to “How to remotely set GPU preferences from command line,” would it be a good idea to just entirely change the title and contents of the first post?
This will probably be completely outdated in a couple months when 2.8 releases and I am going to have to figure this out all over again, but in the mean time I hope this helps somebody
and again, thank you @kkar for being patient and helping me through this
bpy.context.user_preferences changed to bpy.context.preferences
instead of _cycles.available_devices() use preferences.get_devices() which will now return a 2D array / list
I’m not sure what the 2 dimensions of the array represent, but devices[0] returns something like (MY_GPU1, MY_GPU2, MY_CPU) and devices[1] only returns (MY_CPU)
so the final code would look something like this
import bpy
prefs = bpy.context.preferences.addons['cycles'].preferences
devices = prefs.get_devices()
prefs.compute_device_type = 'CUDA'
devices[0][0].use = True # enable first GPU
devices[0][1].use = True # enable second GPU / device (if you have one)
I don’t know if this is technically proper, but this is the way I ended up doing it