I thought that /usr/bin/startx script is used to start XServer but it looks like this is not true. Which process or script starts XServer? XServer has to start before lightdm greeter is visible, but when exactly does it start? This manual page doesn't explain when startx is run.
How is XServer started in Ubuntu 16.04?
ubuntu;x11;xorg;x server;startx