How to boot a Linux system without graphical server

What you are asking for is not completely clear to me, so I will give you several possible answers, hoping you can find the one you are interested in.

  1. You can disable the X server at the next boot by going to /etc/default/grub, finding the line

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
    

    and modifying it into

    GRUB_CMDLINE_LINUX_DEFAULT="text"
    

    Now you need to update grub,

    update-grub
    

    and you are done.

You can do the vice versa to re-enable the X server.

  1. You can disable your Window Manager: assuming you are using systemd, which most Linux distros do nowadays,

    systemctl disable kdm
    

    or gdm, lightdm, whatever you use.

  2. If you think you may wish to change your mind, occasionally, after boot has started, add to the file /etc/grub.d/40_custom the following manual entry:

     menuentry 'Ubuntu (Text mode)' --class ubuntu {
     recordfail
     insmod gzio
     insmod part_msdos
     insmod ext2
     set root='hd0,msdos1'
     linux   /vmlinuz root=/dev/sda1 ro   text
     initrd  /initrd.img
     }
    

    (make sure you adapt /dev/sda1 and msdos1 to your configuration). This produces just an entry in your GRUB2 menu which you may wish to use occasionally.

  3. If all you want is a text login, even when a graphical session has started, remember that the combination Ctrl+Alt+F1 (or F2-F6) will give you just that, a textual login. Furthermore, you can then disable your Window Manager from within this textual login,

    sudo systemctl stop gdm
    

    (ord kdm, lightdm, sddm,, or whatever you use), and there you have a purely textual login, no graphical session running.

  4. Lastly, you may wish to resort to text-only booting when you are hit by some unexpected error in your graphical configuration (an update gone awry?), which has caught you unaware (i.e., without having prepared for solution 3). If you are stuck at the command prompt in grub, you may use Terdon's suggestion suitably modified, because, as it stands, it does not work on my Debian and Arch Linux systems, but the following does: instead of appending text to the linux line in the Grub display as Terdon suggested, type 3 (three) instead; e.g.,

    linux   /boot/vmlinuz-4.0.0-1-amd64 root=UUID=5e285652 ro  quiet 3
    

    This will successfully boot you into runlevel 3, which is CLI with networking but no display manager.


Well, the simplest approach for a one-time boot to text mode would be to select the kernel entry you want to boot when at the GRUB2 screen, hit E, scroll down to the linux line and add text to the end. For example:

linux   /boot/vmlinuz-4.0.0-1-amd64 root=UUID=5e285652 ro  quiet text

Then, hit F10 or Ctrl+X to boot.


Copy paste from /etc/inittab:

# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To view current default target, run:
# systemctl get-default
#
# To set a default target, run:
# systemctl set-default TARGET.target
#

Hence, you can set:

systemctl set-default multi-user.target

to run only CLI