Force Ubuntu desktop Boot into Text Console Mode

Force Ubuntu desktop Boot into Text Console Mode

2016-12-15. Category & Tags: Linux, Ubuntu, Console, X

Tested in ubuntu deskop 16.

short url: s_force-text

SOLUTION #

sudo cp /etc/default/grub /etc/default/grub.bak && \
sudo sed -ie 's/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="text"/g' /etc/default/grub && \
sudo sed -ie 's/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX="text"/g' /etc/default/grub && \
sudo sed -ie 's/#GRUB_TERMINAL/GRUB_TERMINAL/g' /etc/default/grub && \
sudo update-grub && \
sudo systemctl enable multi-user.target --force && \
sudo systemctl set-default multi-user.target && \
sudo reboot

OBS: sometimes, by changing “multi-user.target” is enough, but sometimes we have to update grub. Have not dug into the reason.

RESULTS #

Echo-ed results:

START X TEMPORARILY #

To run desktop from pure terminal (on physical monitor): run service lightdm start directly.
Note:

  1. startx does NOT work, so use lightdm.
  2. you can run several desktops in different consoles (Ctrl+Alt+F1~F6), but logging in several desktops as the same user may lead to system unstability.

CHANGE BACK TO X #

sudo systemctl enable graphical.target --force && \
sudo systemctl set-default graphical.target && \
sudo reboot

REF #

askUbuntu
ref start lightdm

EXPLAIN #

The script modified /etc/default/grub with:

  1. Modify GRUB_CMDLINE_LINUX_DEFAULT and GRUB_CMDLINE_LINUX
    values to text.
  2. Uncomment and enable GRUB_TERMINAL=console.
    ref boot to text.