How to set up boot menus in the partitions to be activated by the MBR

Author: Peter Starfinger, also author of the distribution Starbuntu based on Ubuntu

      In order to have in the MBR (Master Boot Record) only the boot menu which points on the boot menus in the partitions, you proceed as follows:

  1. Copy in your active boot partition /etc/grub.d to /etc/grub.d.mbr and to /etc/grub.d.part
  2. Remove /etc/grub.d
  3. Create a symbolic link /etc/grub.d of /etc/grub.d.part
  4. cd /etc/grub.d.part
  5. Edit the script 40_custom:

    menuentry "" { set root= } # Empty line!
    #
    menuentry 'Back to the boot menu on /dev/sda' {
    chainloader (hd0)+1
    }
    #
    menuentry "" { set root= }
    #

    Maybe add even more menu entries, e.g. for TinyCore:

    menuentry "TinyCore-13.1 on /dev/sda1" {
    recordfail
    insmod ext2
    set root='(hd0,1)'
    set gfxmode=1366x768
    linux /opt/tce/boot/vmlinuz loglevel=3 tce=sda1 quiet lang=de_DE.UTF-8 kmap=qwertz/de-latin1 tz=GST-2
    initrd /opt/tce/boot/core.gz
    }

  6. Set in /etc/default/grub GRUB_DISABLE_OS_PROBER to true

  7. sudo grub-mkconfig -o /boot/grub/grub.cfg
  8. sudo grub-install --force --boot-directory=/boot /dev/sda1

  9. Reboot your computer, boot other partition, e.g. /dev/sda2

  10. cd /etc/grub.d
  11. Edit the script 40_custom:

    menuentry "" { set root= } # Empty line!
    #
    menuentry 'Back to the boot menu on /dev/sda' {
    chainloader (hd0)+1
    }
    #
    menuentry "" { set root= }
    #

    Maybe add even more menu entries, e.g. for TinyCore:

    menuentry "TinyCore-13.1 on /dev/sda2" {
    recordfail
    insmod ext2
    set root='(hd0,2)'
    set gfxmode=1366x768
    linux /opt/tce/boot/vmlinuz loglevel=3 tce=sda2 quiet lang=de_DE.UTF-8 kmap=qwertz/de-latin1 tz=GST-2
    initrd /opt/tce/boot/core.gz
    }

  12. Set in /etc/default/grub GRUB_DISABLE_OS_PROBER to true

  13. sudo grub-mkconfig -o /boot/grub/grub.cfg
  14. sudo grub-install --force --boot-directory=/boot /dev/sda2

  15. Reboot your computer, boot the boot partition, e.g. /dev/sda1

  16. If not yet done, first execute the previous steps of this instruction

  17. Remove the symbolic link /etc/grub.d

  18. Create the symbolic link /etc/grub.d of /etc/grub.d.mbr
  19. cd /etc/grub.d.mbr
  20. Remove the scripts 10_linux, 20_linux_xen, 30_os-prober and 30_uefi-firmware
  21. Edit the script 40_custom:

    menuentry 'Launch the boot menu on /dev/sda1 (<Label>)' {
    chainloader (hd0,1)+1
    }
    #
    menuentry 'Launch the boot menu on /dev/sda2 (<Label>)' {
    chainloader (hd0,2)+1
    }
    #
    menuentry "" { set root= } # Empty line!
    #

    Maybe add even more menu entries, e.g. for Iso-Images

  22. Copy the folder /boot/grub to /boot-mbr/grub (without the Linux kernels)

  23. sudo grub-mkconfig -o /boot-mbr/grub/grub.cfg
  24. sudo grub-install --boot-directory=/boot-mbr /dev/sda

    Good luck!