Add new entry to grub2

openSUSE 13.2 64bit KDE 4.4.16

I don’t like grub2 and have been avoiding it. But now installations insist on it and YaST offers no other option. I just installed 11.4 on a drive that already had 13.2 on one of the partitions. The 11.4 installation made its root partition bootable using grub legacy and it boots normally. But I would like to boot it from my grub2 menu as installed from 13.2. How do I do that? The essential entries are as follows:-

###Don't change this comment - YaST2 identifier: Original name: linux###
title Desktop -- openSUSE 11.4 - 2.6.37.1-1.2
    root (hd0,1)
    kernel /boot/vmlinuz-2.6.37.1-1.2-desktop root=/dev/disk/by-id/ata-ST500DM002-1BD142_Z3T1A35S-part2 resume=/de
v/disk/by-id/ata-ST500DM002-1BD142_Z3T1A35S-part5 splash=silent quiet showopts vga=0x31a
    initrd /boot/initrd-2.6.37.1-1.2-desktop

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 11.4 - 2.6.37.1-1.2
    root (hd0,1)
    kernel /boot/vmlinuz-2.6.37.1-1.2-desktop root=/dev/disk/by-id/ata-ST500DM002-1BD142_Z3T1A35S-part2 showopts a
pm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x31a
    initrd /boot/initrd-2.6.37.1-1.2-desktop

Thanks in advance.

You can still use grub legacy, and it’s even installed (but not used) by default.
Set the boot loader type to “NONE” in YaST and manage it manually.

Although apparently only YaST’s support code has been removed. perl-Bootloader still seems to support grub legacy. So if you set LOADER_TYPE=“grub” in /etc/sysconfig/bootloader, the menu should even get refreshed automatically whenever you install/remove a kernel (unless there are bugs).
But I haven’t tested this.

I just installed 11.4 on a drive that already had 13.2 on one of the partitions. The 11.4 installation made its root partition bootable using grub legacy and it boots normally. But I would like to boot it from my grub2 menu as installed from 13.2. How do I do that?

There are many ways with grub2.

My preferred one is to add your custom entries to /boot/grub2/custom.cfg (create the file if it doesn’t exist). This file is loaded by the standard menu config on runtime.
In Grub2 syntax, your entries would look like this:

menuentry 'Desktop -- openSUSE 11.4 - 2.6.37.1-1.2'
{
    set root='hd0,msdos2'
    linux /boot/vmlinuz-2.6.37.1-1.2-desktop root=/dev/disk/by-id/ata-ST500DM002-1BD142_Z3T1A35S-part2 resume=/dev/disk/by-id/ata-ST500DM002-1BD142_Z3T1A35S-part5 splash=silent quiet showopts vga=0x31a
    initrd /boot/initrd-2.6.37.1-1.2-desktop
}

You might have to load additional modules for it to work, or adapt the root partition e.g. (note that grub2 starts counting partition numbers at 1 instead of 0)
For the complete grub(2) manual, see here:
http://www.gnu.org/software/grub/manual/

It is also possible to use grub legacy’s syntax with grub2, but I haven’t tried that myself yet.

Thanks for the speedy response.

Following your instructions I decided to try the grub legacy method first. When I started YaST>System>Boot Loader it did not offer a “NONE” option but did offer a “Do Not Install Any Boot Loader” which I selected. But I don’t think it did anything as YaST closed immediately.

I then set LOADER_TYPE=“grub”. My /boot/grub/menu.lst looks like this…

# Modified by YaST2. Last modification on Sun May 24 12:48:08 CEST 2015
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# Configure custom boot parameters for updated kernels in /etc/sysconfig/bootloader

default 0
timeout 8
##YaST - generic_mbr
gfxmenu (hd0,0)/boot/message
##YaST - activate

###Don't change this comment - YaST2 identifier: Original name: linux###
title Desktop -- openSUSE 13.2
    root (hd0,0)
    kernel /boot/vmlinuz-3.16.7-21-desktop root=/dev/sda1 resume=/dev/sda5 splash=silent quiet showopts vga=0x31a
    initrd /boot/initrd-3.16.7-21-desktop

###Don't change this comment - YaST2 identifier: Original name: linux###
title Desktop -- openSUSE 11.4 - 2.6.37.1-1.2
    root (hd0,1)
    kernel /boot/vmlinuz-2.6.37.1-1.2-desktop root=/dev/disk/by-id/ata-ST500DM002-1BD142_Z3T1A35S-part2 resume=/dev/disk/by-id/ata-ST500DM002-1BD142_Z3T1A35S-part5 splash=silent quiet showopts vga=0x31a
    initrd /boot/initrd-2.6.37.1-1.2-desktop

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 11.4 - 2.6.37.1-1.2
    root (hd0,1)
    kernel /boot/vmlinuz-2.6.37.1-1.2-desktop root=/dev/disk/by-id/ata-ST500DM002-1BD142_Z3T1A35S-part2 showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x31a
    initrd /boot/initrd-2.6.37.1-1.2-desktop

When I rebooted it started the usual grub2 screen and gave me no 11.4 options. Should I have done something with the “gfxmenu (hd0,0)/boot/message” as well? The good news is that it didn’t crash and still boots SOMETHING so I can continue with your next suggestion.

Of course it did not do anything. That’s the point of that option.
It just modifies /etc/sysconfig/bootloader accordingly (i.e. sets LOADER_TYPE=“none”), so the system (YaST, perl-Bootloader) do not overwrite your manually installed boot loader again.

I then set LOADER_TYPE=“grub”. My /boot/grub/menu.lst looks like this…

When I rebooted it started the usual grub2 screen and gave me no 11.4 options. Should I have done something with the “gfxmenu (hd0,0)/boot/message” as well? The good news is that it didn’t crash and still boots SOMETHING so I can continue with your next suggestion.

Well, you have to install the boot loader first of course.
I thought that was obvious.

Again, YaST does not support grub legacy any more, and does not install it for you.
Changing /etc/sysconfig/bootloader doesn’t automatically install a different boot loader either obviously.

It’s been a while (years) since I used grub legacy, but try “man grub-install”.

If you want to stay on the safe side, rather keep on using grub2 and try adding your custom entries to /boot/grub2/custom.cfg.
In the worst case, those entries just will not be shown or won’t boot successfully.

PS: If you did set LOADER_TYPE=“grub”, you should also be able to install the boot loader with “update-bootloader --reinit” (unless there are bugs).

Thanks again. Yes of course I needed to invoke grub-install. It’s been a while since I last did that. In case anyone else is interested the actual command was “grub-install.unsupported /dev/sda”. Everything works now.

Activate “Probe Foreign OS” in YaST bootloader configuration.