Thanks for the help. I finally made it to run on the headless server, but there are a few pitfalls on Ubuntu 16.04. So here are the details if anyone has the same troubles:
- Copy the xorg.conf to /etc/X11/
- restart the lightdm server:
systemctl restart lightdm
- check in /var/log/Xorg.0.log if the configuration is loaded correctly
- then I got the error “invalid mit-magic-cookie-1 key”. so one has to check the Xauthority:
systemctl status
and search for
lightdm.service
which has a parameter
-auth
- run the application by passing the environment variables:
DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 sudo python test.py
(for me the Xorg is started as root)