40_custom file syntax and content

This post relates to an unresolved question posted yesterday (https://forums.opensuse.org/showthread.php/512546-Restoring-Leap-42-1-to-Bootloader).

Current system: SuSE 13.1 and Windows XP; 13.1 bootloader set to default to 13.1, with option for XP.

To access a recent installation of Leap 42.1 no longer accessible in the YaST bootloader panel, I modified /etc/grub.d/40_custom, but grub2 is not obtaining the images.

Files in /boot/ in Leap 42.1 installation:

linux-3:~ # ls -l /L42/boot/
total 25364
-rw-r--r-- 1 root root      65 Oct 29 14:26 .vmlinuz-4.1.12-1-default.hmac
-rw-r--r-- 1 root root 3117315 Oct 29 10:14 System.map-4.1.12-1-default
-rw-r--r-- 1 root root     512 Dec  1 12:03 backup_mbr
-rw-r--r-- 1 root root    1725 Oct 13 09:06 boot.readme
-rw-r--r-- 1 root root  164424 Oct 29 08:14 config-4.1.12-1-default
drwxr-xr-x 1 root root       0 Oct 25 09:08 dracut
drwxr-xr-x 1 root root     168 Dec  1 12:17 grub2
lrwxrwxrwx 1 root root      23 Dec  1 11:27 initrd -> initrd-4.1.12-1-default
-rw-r--r-- 1 root root 9054392 Dec  1 12:03 initrd-4.1.12-1-default
-rw-r--r-- 1 root root  499712 Oct 29 16:45 message
-rwxr-xr-x 1 root root     169 Dec  1 11:27 perl-BL_delayed_exec
-rw-r--r-- 1 root root  329098 Oct 29 10:53 symvers-4.1.12-1-default.gz
-rw-r--r-- 1 root root     484 Oct 29 10:53 sysctl.conf-4.1.12-1-default
-rw-r--r-- 1 root root 6891750 Oct 29 11:19 vmlinux-4.1.12-1-default.gz
lrwxrwxrwx 1 root root      24 Dec  1 11:27 vmlinuz -> vmlinuz-4.1.12-1-default
-rw-r--r-- 1 root root 5872008 Oct 29 14:26 vmlinuz-4.1.12-1-default
linux-3:~ #

40_custom file as modified:

#!/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 "openSuSE 42.1" {
set root=(hd0,2)
linux /boot/vmlinuz
initrd /boot/initrd
}

Fdisk yields:

linux-3:~ # fdisk -l
Disk /dev/sda: 750.2 GB, 750156374016 bytes, 1465149168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xe818e818

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63   716804234   358402086    7  HPFS/NTFS/exFAT
/dev/sda2   *   716806144  1465147391   374170624   83  Linux

Disk /dev/sdb: 500.1 GB, 500107862016 bytes, 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x25fb25fa

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     4208639     2103296   82  Linux swap / Solaris
/dev/sdb2         4208640   486559743   241175552   83  Linux
linux-3:~ #

os-prober yields:

linux-3:~ # os-prober
  No volume groups found                                                                                       
/dev/sda1:Microsoft Windows XP Professional:Windows:chain                                                      
/dev/sda2:openSUSE 42.1 (x86_64):SUSE:linux:btrfs:UUID=8981a635-b29a-4959-89f7-51c65aa079cc:subvol=@/.snapshots/1/snapshot
linux-3:~ #

grub2-mkconfig output:

linux-3:~ # grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub.cfg ...
Found theme: /boot/grub2/themes/openSUSE/theme.txt
Found linux image: /boot/vmlinuz-3.11.10-29-desktop
Found initrd image: /boot/initrd-3.11.10-29-desktop
Found linux image: /boot/vmlinuz-3.11.10-21-desktop
Found initrd image: /boot/initrd-3.11.10-21-desktop
  No volume groups found
Found Microsoft Windows XP Professional on /dev/sda1
Found openSUSE 42.1 (x86_64) on /dev/sda2
done
linux-3:~ #

current grub2.cfg (in 13.1):

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if  -s $prefix/grubenv ]; then
  load_env
fi
if  "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="${saved_entry}"
fi
if  x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi
export menuentry_id_option
if  "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi
function savedefault {
  if  -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}
function load_video {
  if  x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}
if  x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos
insmod ext2
set root='hd1,msdos2'
if  x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos2 --hint-efi=hd1,msdos2 --hint-baremetal=ahci1,msdos2 --hint='hd1,msdos2'  3408a825-1ebf-43df-ae44-35a28738eb3e
else
  search --no-floppy --fs-uuid --set=root 3408a825-1ebf-43df-ae44-35a28738eb3e
fi
    font="/usr/share/grub2/unicode.pf2"
fi
if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=POSIX
  insmod gettext
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='hd1,msdos2'
if  x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos2 --hint-efi=hd1,msdos2 --hint-baremetal=ahci1,msdos2 --hint='hd1,msdos2'  3408a825-1ebf-43df-ae44-35a28738eb3e
else
  search --no-floppy --fs-uuid --set=root 3408a825-1ebf-43df-ae44-35a28738eb3e
fi
insmod gfxmenu
loadfont ($root)/boot/grub2/themes/openSUSE/DejaVuSans-Bold14.pf2
loadfont ($root)/boot/grub2/themes/openSUSE/DejaVuSans10.pf2
loadfont ($root)/boot/grub2/themes/openSUSE/DejaVuSans12.pf2
loadfont ($root)/boot/grub2/themes/openSUSE/ascii.pf2
insmod png
set theme=($root)/boot/grub2/themes/openSUSE/theme.txt
export theme
if  x${boot_once} = xtrue ]; then
  set timeout=0
elif sleep --interruptible 0 ; then
  set timeout=8
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'openSUSE 13.1' --class 'opensuse-13-1' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-3408a825-1ebf-43df-ae44-35a28738eb3e' {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='hd1,msdos2'
    if  x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos2 --hint-efi=hd1,msdos2 --hint-baremetal=ahci1,msdos2 --hint='hd1,msdos2'  3408a825-1ebf-43df-ae44-35a28738eb3e
    else
      search --no-floppy --fs-uuid --set=root 3408a825-1ebf-43df-ae44-35a28738eb3e
    fi
    echo    'Loading Linux 3.11.10-29-desktop ...'
    linux    /boot/vmlinuz-3.11.10-29-desktop root=UUID=3408a825-1ebf-43df-ae44-35a28738eb3e   resume=/dev/disk/by-id/ata-WDC_WD5002ABYS-02B1B0_WD-WCASYD506924-part1 splash=silent quiet showopts
    echo    'Loading initial ramdisk ...'
    initrd    /boot/initrd-3.11.10-29-desktop
}
submenu 'Advanced options for openSUSE 13.1' $menuentry_id_option 'gnulinux-advanced-3408a825-1ebf-43df-ae44-35a28738eb3e' {
    menuentry 'openSUSE 13.1, with Linux 3.11.10-29-desktop' --class 'opensuse-13-1' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.11.10-29-desktop-advanced-3408a825-1ebf-43df-ae44-35a28738eb3e' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd1,msdos2'
        if  x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos2 --hint-efi=hd1,msdos2 --hint-baremetal=ahci1,msdos2 --hint='hd1,msdos2'  3408a825-1ebf-43df-ae44-35a28738eb3e
        else
          search --no-floppy --fs-uuid --set=root 3408a825-1ebf-43df-ae44-35a28738eb3e
        fi
        echo    'Loading Linux 3.11.10-29-desktop ...'
        linux    /boot/vmlinuz-3.11.10-29-desktop root=UUID=3408a825-1ebf-43df-ae44-35a28738eb3e   resume=/dev/disk/by-id/ata-WDC_WD5002ABYS-02B1B0_WD-WCASYD506924-part1 splash=silent quiet showopts
        echo    'Loading initial ramdisk ...'
        initrd    /boot/initrd-3.11.10-29-desktop
    }
    menuentry 'openSUSE 13.1, with Linux 3.11.10-29-desktop (recovery mode)' --class 'opensuse-13-1' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.11.10-29-desktop-recovery-3408a825-1ebf-43df-ae44-35a28738eb3e' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd1,msdos2'
        if  x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos2 --hint-efi=hd1,msdos2 --hint-baremetal=ahci1,msdos2 --hint='hd1,msdos2'  3408a825-1ebf-43df-ae44-35a28738eb3e
        else
          search --no-floppy --fs-uuid --set=root 3408a825-1ebf-43df-ae44-35a28738eb3e
        fi
        echo    'Loading Linux 3.11.10-29-desktop ...'
        linux    /boot/vmlinuz-3.11.10-29-desktop root=UUID=3408a825-1ebf-43df-ae44-35a28738eb3e  showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe
        echo    'Loading initial ramdisk ...'
        initrd    /boot/initrd-3.11.10-29-desktop
    }
    menuentry 'openSUSE 13.1, with Linux 3.11.10-21-desktop' --class 'opensuse-13-1' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.11.10-21-desktop-advanced-3408a825-1ebf-43df-ae44-35a28738eb3e' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd1,msdos2'
        if  x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos2 --hint-efi=hd1,msdos2 --hint-baremetal=ahci1,msdos2 --hint='hd1,msdos2'  3408a825-1ebf-43df-ae44-35a28738eb3e
        else
          search --no-floppy --fs-uuid --set=root 3408a825-1ebf-43df-ae44-35a28738eb3e
        fi
        echo    'Loading Linux 3.11.10-21-desktop ...'
        linux    /boot/vmlinuz-3.11.10-21-desktop root=UUID=3408a825-1ebf-43df-ae44-35a28738eb3e   resume=/dev/disk/by-id/ata-WDC_WD5002ABYS-02B1B0_WD-WCASYD506924-part1 splash=silent quiet showopts
        echo    'Loading initial ramdisk ...'
        initrd    /boot/initrd-3.11.10-21-desktop
    }
    menuentry 'openSUSE 13.1, with Linux 3.11.10-21-desktop (recovery mode)' --class 'opensuse-13-1' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.11.10-21-desktop-recovery-3408a825-1ebf-43df-ae44-35a28738eb3e' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd1,msdos2'
        if  x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos2 --hint-efi=hd1,msdos2 --hint-baremetal=ahci1,msdos2 --hint='hd1,msdos2'  3408a825-1ebf-43df-ae44-35a28738eb3e
        else
          search --no-floppy --fs-uuid --set=root 3408a825-1ebf-43df-ae44-35a28738eb3e
        fi
        echo    'Loading Linux 3.11.10-21-desktop ...'
        linux    /boot/vmlinuz-3.11.10-21-desktop root=UUID=3408a825-1ebf-43df-ae44-35a28738eb3e  showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe
        echo    'Loading initial ramdisk ...'
        initrd    /boot/initrd-3.11.10-21-desktop
    }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/20_ppc_terminfo ###
### END /etc/grub.d/20_ppc_terminfo ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Microsoft Windows XP Professional (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-1C4079E54079C654' {
    insmod part_msdos
    insmod ntfs
    set root='hd0,msdos1'
    if  x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  1C4079E54079C654
    else
      search --no-floppy --fs-uuid --set=root 1C4079E54079C654
    fi
    drivemap -s (hd0) ${root}
    chainloader +1
}

### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# 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 "openSuSE 42.1" {

set root=(hd0,2)

linux /boot/vmlinuz
initrd /boot/initrd

}### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if  -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif  -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

### BEGIN /etc/grub.d/90_persistent ###
### END /etc/grub.d/90_persistent ###

### BEGIN /etc/grub.d/orig-40_custom ###
# 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.
### END /etc/grub.d/orig-40_custom ###


Please identify any errors. Thanks.

Screen shots of YaST bootloader (in 13.1) are at:

http://susepaste.org/74573711
http://susepaste.org/71877865

I am unable to grab the dropdown in bootloader options, which offers openSuSE 13.1, advanced options under 13.1, and Windows XP.

Screen shots of YaST bootloader (in 13.1) (images, not links as in my previous reply):

http://susepaste.org/images/74573711.jpeg

http://susepaste.org/images/71877865.jpeg