Boot Ubuntu 16.04 into command line / do not start GUI

Solution 1:

You could disable the display manager service with systemctl. For example if your display manager is lightdm then run:

sudo systemctl disable lightdm.service

This will prevent the service from starting at boot.

Edit:

I forgot to mention how to start the GUI. It is as simple as starting the systemd service:

sudo systemctl start lightdm.service

Solution 2:

Instead of text use runlevel 3:

GRUB_CMDLINE_LINUX="3"

# To remove all the fancy graphics you need to get rid of `splash`.
GRUB_CMDLINE_LINUX_DEFAULT=”quiet”

# Uncomment to disable graphical terminal (grub-pc only) 
GRUB_TERMINAL=console

Then update-grub and reboot.


But you really only need GRUB_CMDLINE_LINUX="3". For quick test hit ESC during booting to get into the grub boot menu. Then press e and find the line which specifies kernel and add 3 at the end:

 linux /vmlinuz root=/dev/mapper/ubuntu ro 3

Boot it with CTRL+x


Ideally I also want to be able to start GUI by typig a command.

One of these:

$ sudo telinit 5
$ sudo service lightdm restart
$ sudo systemctl start lightdm

Tested on Ubuntu 16.04.1 LTS.