I want to have text booting mode option on grub menu screen. How do I create this menu entry?
I want to have text booting mode option on grub menu screen. How do I create this menu entry?
In my research, there are two ways to do this:
Hack 10_linux
script in /etc/grub.d/
and insert generation codes for text booting menuentry
Advantages:
Downsides:
Use designated script for adding custom grub menuentry in /etc/grub.d
Advantages:
Downsides:
In this short step, I'm going with method #2
since it's the easiest to explain here and we'll be creating text booting menuentry only for the latest kernel image that you use.
The first thing that you need is the already generated menuentry for
your latest kernel. We are going to copy and use it as basis for our
custom menuentry, with a little alteration. For that, you need to
look in your /boot/grub/grub.cfg
file. Locate the first menuentry
stanza that points to the latest kernel on your Ubuntu. If you're
dual booting with other linux distros, pay extra attention so you
wouldn't mix it up with their menuentries.
Once you found it, copy the entire menuentry stanza and paste it
into /etc/grub.d/40_custom
file. It may look like one below. Let's
use this as example:
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-a4e6d610-122e-42e2-8497-39eae02816e8' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 a4e6d610-122e-42e2-8497-39eae02816e8
else
search --no-floppy --fs-uuid --set=root a4e6d610-122e-42e2-8497-39eae02816e8
fi
linux /boot/vmlinuz-3.8.0-31-generic root=UUID=a4e6d610-122e-42e2-8497-39eae02816e8 ro quiet splash $vt_handoff
initrd /boot/initrd.img-3.8.0-31-generic
}
Now here's few things that you need to edit in this stanza before you can save the file:
menuentry
line to 'Ubuntu (text mode)'linux
line. Substitute /boot/vmlinuz-3.8.0-31-generic
with /vmlinuz
linux
line. Substitute quiet splash
with text
initrd
line. Substitute /boot/initrd.img-3.8.0-31-generic
with /initrd.img
Reason why we do the substitutions in both vmlinuz
and initrd
lines is to take advantages of the symlinks placed in / which points to their latest version in /boot
dir so that our custom menuentry can always point to the most recent kernel and won't need to be changed if a new kernel is introduced.
That's it. Execute sudo update-grub
to generate the custom menu and you're done.