Force Ubuntu desktop Boot into Text Console Mode
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:
startx
does NOT work, so use lightdm.- 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 #
EXPLAIN #
The script modified /etc/default/grub
with:
- Modify
GRUB_CMDLINE_LINUX_DEFAULT
andGRUB_CMDLINE_LINUX
values totext
. - Uncomment and enable
GRUB_TERMINAL=console
.
ref boot to text.