The auto-generated (during OS installation) menu entries are placed at /boot/grub/grub.cfg
. These entries can be used as a starting point for creating new menu entries. Roughly, the process is as follows:
Edit /etc/grub.d/40_custom
and provide your menu entries. For example, say we want to provide an alternative way to initialize our debian system via systemd
:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'Debian GNU/Linux, with Linux 3.2.0-4-amd64 (systemd)' {
load_video
insmod gzio
insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos1)'
search --no-floppy --fs-uuid --set=root b1ef2365-c1c9-4887-8f1e-2a7334b7d8cd
echo 'Loading Linux 3.2.0-4-amd64 ...'
linux /boot/vmlinuz-3.2.0-4-amd64 root=UUID=b1ef2365-c1c9-4887-8f1e-2a7334b7d8cd ro init=/bin/systemd
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-3.2.0-4-amd64
}
Now, we must update (re-generate) our /boot/grub/grub.cfg
file:
update-grub
Install grub to target device (usually the MBR of our 1st disk), say /dev/sda
:
grub-install /dev/sda
Reboot!
Find more detailed info at https://help.ubuntu.com/community/Grub2/CustomMenus
Is it possible to reuse default config and add some params instead of writing everything manually?