OK, glad it's working. The only time I've ever seen 0x0502 is when the
3D X server was non-headless and someone switched to a different virtual
console on the server, thus effectively disconnecting the GPU from the
physical display. However, I suppose that error could also occur if the
framebuffer device permissions were incorrect, and running
vglserver_config would definitely fix that. It may not be clear in the
documentation, but it's always a good idea to re-run vglserver_config
after updating the nVidia or AMD proprietary drivers, because those
driver installers may change some of the device permissions.