I had a VPS running Ubuntu server 18.04. When I installed the Ubuntu desktop, it worked fine. For a reason, I have to change the server to Ubuntu 16.04. When I try to install any desktop environment, Ubuntu, mate, kubuntu using the tasksel, it gets installed fine. After rebooting the server, the GUI doesn't start and only the command prompt is shown. Why is this happening and how could I fix this?
If you installed the GUI properly, then it should be an error at the lightdm.
Simple restart the lightdm service with the following command line:
$ sudo service lightdm restart
If this keeps happening, you can try to reinstall your GUI or add a simple script at init.d that performs this action.