Ubuntu – How to turn off Ubuntu 17.10’s GUI (GDM)

17.10

Unlike 17.04, sudo service stop gdm or sudo service stop lightdm will return stop: unrecognized service, so my question being how to stop the GUI process in this bleeding edge version?

Best Answer

Instead of killing the gdm, you can change the systemd target.


Changing the systemd target

As mentioned here, starting from 16.04, Ubuntu uses systemd and the boot process relies on a set of targets. Each target defines the system software that Ubuntu must run.

This is a list of targets for Ubuntu:

   ┌───────────────────┐
   │ Target            │
   ├───────────────────┤
   │ poweroff.target   │ turn off the computer
   ├───────────────────┤
   │ rescue.target     │ minimal for admin/rescue tasks
   ├───────────────────┤
   │ multi-user.target │ multi-user, no GUI
   ├───────────────────┤
   │ graphical.target  │ multi-user, GUI
   ├───────────────────┤
   │ reboot.target     │ reboot the computer
   └───────────────────┘

To stop the GUI, you can change the target. The system checks all the running system software and kills those not included in the specified target. In consequence, if you change to the multi-user.target target, the GUI will be killed.

To change the "target" and kill the GUI:

sudo systemctl isolate multi-user.target

To make this the default "target" (and start booting your computer without GUI), you can use:

sudo systemctl enable multi-user.target
sudo systemctl set-default multi-user.target
Related Question