I have an Ubuntu 20 VM on Google Cloud Platform. Mostly, I only need to SSH into the VM. However, very occasionally, I need to use a desktop environment. I am not particularly skilled with Unix.
I followed this article from Google to set up Chrome Remote Desktop with Xfce - this works perfectly.
The trouble is, I cannot figure out how to disable it now. The VM is very puny, so having all the random processes that come with the desktop running can cause a performance hit. I'd like to be able to turn the desktop off and on at will. Failing that, I'd like to prevent it from launching on startup so that at least I can reboot the machine to close the desktop.
I've had difficulty understanding the various methods of running services / startup services on Unix. Here are the things I have tried:
- Killing the processes. There are several dozen of them, but I have tried killing various processes - xfce4-panel, chrome-remote-desktop-host, xfce4-session, lightdm, others. This is laborious and doesn't work - the processes mostly get spawned anew shortly after being killed. I suppose there is some service that runs them?
- Stopping services using 'service X stop'. When I run 'service --status-all', lightdm and chrome-remote-desktop are both shown as not running, yet the various google/desktop processes are still running and I can still open the desktop environment via Chrome remote desktop.
- Removing services from rc.d using e.g. 'update-rc.d chrome-remote-desktop remove'. However, when I reboot I still find all the processes up and running. There are still entries for them in /etc/init.d/ - I'm not sure if its advisable to remove them or not.
So, in summary, how can I either shutdown/startup xfce and chrome remote desktop at will, or else how can I ensure they don't start on boot (but can still be started manually)?