1

How do I customize GRUB so every time booting I could choose whether I want to boot into text mode or boot into graphical mode.

I have try to edit /etc/default/grub and change

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" into GRUB_CMDLINE_LINUX_DEFAULT="text"

and update the GRUB, but this only change the boot mode into text, and I need to change it again if I want to boot into graphical mode. I know I can use startx from terminal to enter the graphical mode, but it's not answered my question

1 Answer 1

1

You want to use the 40_custom file for this, preferably in maintenance mode.

All commands in this tutorial are to be run as root! This tutorial also DOES NOT WORK for systems with /boot on a different partition!

  1. Find the UUID of your main partition by using blkid and looking for an EXT4 partition. Remember this UUID, you will need it soon.

  2. Start by opening the 40_custom file.

nano /etc/grub.d/40_custom
  1. Append this to the end of the file:
menuentry "Ubuntu Text Mode" {
     recordfail
     gfxmode $linux_gfx_mode
     insmod gzio
     insmod part_msdos
     insmod ext2
     set root='(hd0,msdos9)'
     search --no-floppy --fs-uuid --set=root [UUID from earlier]
     linux /vmlinuz root=UUID=[UUID from earlier] ro text $vt_handoff
     initrd /initrd.img
}
  1. Save this file as 15_custom. It will be after the Ubuntu default entries. Name it to 06_custom if you want it before default Ubuntu.

  2. Run the following command, based on your system:

    chmod a+x /etc/grub.d/06_custom
    chmod a+x /etc/grub.d/15_custom
  3. Finally, run this command to refresh the GRUB menu:

    update-grub

Source for this tutorial is available here, free of charge.

2
  • I am using blkid but it returns no value, can I use the value from /etc/fstab ?
    – firmanium
    Oct 30, 2014 at 8:28
  • @firmanium Sure.
    – Kaz Wolfe
    Oct 30, 2014 at 20:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .