3

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?

Aero Windwalker
  • 918
  • 1
  • 12
  • 21
  • 1
    There is an error in the command you are using: You must use sudo service gdm stop (stop gdm is a mistake) – Jaime May 07 '18 at 13:17

3 Answers3

9

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
Madacol
  • 398
  • 4
  • 9
Jaime
  • 1,420
3

To stop:

sudo telinit 3

To start:

sudo telinit 5
2

To stop it:

sudo systemctl gdm stop

To disable it completely:

sudo systemctl gdm disable

To start it:

sudo systemctl gdm start

and to re-enable it:

sudo systemctl gdm enable

To see the actually running services

systemctl --state running
Videonauth
  • 33,355
  • 17
  • 105
  • 120
  • I had problems after stoping the graphical user interface in this way. In my computer I was not able to get a console to log in. Instead of, I am changing the systemd target. That command stops all the GUI without restarting the computer. – Jaime May 07 '18 at 13:29