Starting Linux in text mode using Grub2
A easy way to achieve what you want is editing the file /etc/grub.d/40_custom
and create there a 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
}
of course, you need to replace sda1 and msdos1 with the correct partition (or UUID if you prefer).
After that run sudo update-grub
and the new entry should be added at the end of the list.
This only creates a manual entry. If you want a automatic entry for each kernel then you must edit /etc/grub.d/10_linux
.
Related videos on Youtube
Tomer Cohen
Updated on September 18, 2022Comments
-
Tomer Cohen over 1 year
For Virtual Machines I create, as well as on old computers I use, I'd like to turn off gdm/lightdm in order to get better performance. I don't like to boot into single user mode ("linux single") because using root is a bad practice, and I also prefer to keep an easy way to boot back into graphic mode, so when graphic mode is required, no extra commands would be needed.
The way I see as the most useful is to configure Grub to show a menu item for "Ubuntu Text mode" in addition to the regular boot and the recovery mode, and set the text mode as default. I tried to do it myself, but Grub2 configuration files on
/etc/grub.d/
looks too cryptic to me, and/etc/defaults/grub
can set booting into text but it doesn't seems to allow keeping a menu item for graphical booting as well as setting text or graphics as default, and I prefer to keep the booting process simple to novice users so they won't need to mess with starting services manually or editing the kernel boot command line in Grub2.Similar threads: https://askubuntu.com/a/196613/19967, https://askubuntu.com/a/79682/19967 - completely remove GUI and start it from the command line instead of Grub2 menuitems.
-
Tomer Cohen over 11 yearsHow can I create the automatic entries in
10_linux
? -
geethujoseph over 11 yearsYou need to understand how that script is executed and modify it to, when it creates an entry for each kernel, add another entry similar with a different label and replacing
quiet splash
withtext
. If you want to try this, make a backup of the file before! I would recommend you to not modify it unless you really need to.