updategrub vs YaST method

The perl booltloader was not intended to handle complex multiboot situations. Furthermore, it arbitraly removes foreign Linux kernel boot entries as well as menu commands it doesn’t know about. I “gave it a try” … and here’s the result:

A “simple” 12.1 Legacy Grub boot menu before with two openSUSE kernels and both Legacy Grub and Grub2 installed:



# Modified by YaST2. Last modification on Sat Apr 21 11:02:03 PDT 2012
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# For the new kernel it try to figure out old parameters. In case we are not able to recognize it (e.g. change of flavor or strange install order ) it it use as fallback installation parameters from /etc/sysconfig/bootloader

default 0
timeout 120
gfxmenu (hd0,8)/boot/message

###Don't change this comment - YaST2 identifier: Original name: linux###
title openSUSE 12.1 (Asparagus) - kernel 3.1.10-1.9 (Desktop)
    partnew (hd0,0) 0x06         63     514017
    partnew (hd0,1) 0xA5   73947195  285282270
    partnew (hd0,2) 0xA5  361398240  100663290
    partnew (hd1,1) 0xA5   18539010  534016665
    partnew (hd1,2) 0xA5  554724450   79698465
    root (hd0,8)
    kernel /boot/vmlinuz-3.1.10-1.9-desktop root=/dev/disk/by-uuid/f91ddef2-81ea-4fbe-be2b-b56ff4b2ad45 resume=/dev/disk/by-id/ata-WDC_WD5000AAKS-00A7B2_WD-WCASY8019640-part5 splash=silent quiet showopts vga=0x31a
    initrd /boot/initrd-3.1.10-1.9-desktop

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title openSUSE 12.1 (Asparagus) - kernel 3.1.10-1.9 (Failsafe)
    root (hd0,8)
    kernel /boot/vmlinuz-3.1.10-1.9-desktop root=/dev/disk/by-uuid/f91ddef2-81ea-4fbe-be2b-b56ff4b2ad45 showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x31a
    initrd /boot/initrd-3.1.10-1.9-desktop

###Don't change this comment - YaST2 identifier: Original name: linux###
title openSUSE 12.1 (Asparagus) - kernel 3.1.9-1.4 (Desktop)
    partnew (hd0,0) 0x06         63     514017
    partnew (hd0,1) 0xA5   73947195  285282270
    partnew (hd0,2) 0xA5  361398240  100663290
    partnew (hd1,1) 0xA5   18539010  534016665
    partnew (hd1,2) 0xA5  554724450   79698465
    root (hd0,8)
    kernel /boot/vmlinuz-3.1.9-1.4-desktop root=/dev/disk/by-uuid/f91ddef2-81ea-4fbe-be2b-b56ff4b2ad45 resume=/dev/disk/by-id/ata-WDC_WD5000AAKS-00A7B2_WD-WCASY8019640-part5 splash=silent quiet showopts vga=0x31a
    initrd /boot/initrd-3.1.9-1.4-desktop

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title openSUSE 12.1 (Asparagus) - kernel 3.1.9-1.4 (Failsafe)
    root (hd0,8)
    kernel /boot/vmlinuz-3.1.9-1.4-desktop root=/dev/disk/by-uuid/f91ddef2-81ea-4fbe-be2b-b56ff4b2ad45 showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x31a
    initrd /boot/initrd-3.1.9-1.4-desktop

###Don't change this comment - YaST2 identifier: Original name: linux###
title GNU GRUB 2 -- openSUSE 12.1 - GNU GRUB 2
    kernel (hd0,8)/boot/grub2/core.img root=/dev/disk/by-uuid/f91ddef2-81ea-4fbe-be2b-b56ff4b2ad45 resume=/dev/disk/by-uuid/ba9db764-a47e-48d9-b6f9-b627b57c0287 splash=silent quiet showopts vga=0x31a


Now here’a how menu.lst will look like after using YaST to merge existing Grub menus:


# Modified by YaST2. Last modification on Fri May 25 15:07:29 PDT 2012
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# For the new kernel it try to figure out old parameters. In case we are not able to recognize it (e.g. change of flavor or strange install order ) it it use as fallback installation parameters from /etc/sysconfig/bootloader

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

###Don't change this comment - YaST2 identifier: Original name: linux###
title openSUSE 12.1
    root (hd0,8)
    kernel /boot/vmlinuz-3.1.10-1.9-desktop root=/dev/disk/by-uuid/f91ddef2-81ea-4fbe-be2b-b56ff4b2ad45    resume=/dev/disk/by-uuid/ba9db764-a47e-48d9-b6f9-b627b57c0287 splash=silent quiet showopts vga=0x31a
    initrd /boot/initrd-3.1.10-1.9-desktop

###Don't change this comment - YaST2 identifier: Original name: Linux other 1 (/dev/sda10)###
title Linux other 1 (/dev/sda10)
    rootnoverify (hd0,9)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: Linux other 2 (/dev/sda11)###
title Linux other 2 (/dev/sda11)
    rootnoverify (hd0,10)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: Linux other 3 (/dev/sda13)###
title Linux other 3 (/dev/sda13)
    rootnoverify (hd0,12)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name:  Debian GNU/Linux - kernel 2.6.32-trunk-amd64 (/dev/sda16)###
title  Debian GNU/Linux - kernel 2.6.32-trunk-amd64 (/dev/sda16)
    rootnoverify (hd0,15)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name:  Mandriva 2010.2 (Farman) - kernel 2.6.38.8 (desktop) (/dev/sdb6)###
title  Mandriva 2010.2 (Farman) - kernel 2.6.38.8 (desktop) (/dev/sdb6)
    rootnoverify (hd1,5)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 12.1
    root (hd0,8)
    kernel /boot/vmlinuz-3.1.10-1.9-desktop root=/dev/disk/by-uuid/f91ddef2-81ea-4fbe-be2b-b56ff4b2ad45 showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset  x11failsafe vga=0x31a
    initrd /boot/initrd-3.1.10-1.9-desktop

###Don't change this comment - YaST2 identifier: Original name: linux###
title Kernel-3.1.10-1.9-desktop
    root (hd0,8)
    kernel /boot/vmlinuz-3.1.10-1.9-desktop root=/dev/disk/by-uuid/f91ddef2-81ea-4fbe-be2b-b56ff4b2ad45    resume=/dev/disk/by-uuid/ba9db764-a47e-48d9-b6f9-b627b57c0287 splash=silent quiet showopts vga=0x31a
    initrd /boot/initrd-3.1.10-1.9-desktop

###Don't change this comment - YaST2 identifier: Original name: linux###
title Kernel-3.1.9-1.4-desktop
    root (hd0,8)
    kernel /boot/vmlinuz-3.1.9-1.4-desktop root=/dev/disk/by-uuid/f91ddef2-81ea-4fbe-be2b-b56ff4b2ad45    resume=/dev/disk/by-uuid/ba9db764-a47e-48d9-b6f9-b627b57c0287 splash=silent quiet showopts vga=0x31a
    initrd /boot/initrd-3.1.9-1.4-desktop


  • partnew commands are gone! Even if I am the only person in the world who rewrites partition tables just before booting, it is not illegal as far as I know. You can imagine that I wouldn’t make use of this Legacy Grub feature (which has been unfortunately dropped in Grub2) without having good reasons.
  • The Grub2 core boot entry (which I originally didn’t add myself) vanished.
  • Chainloader entries were added for other distros based on Legacy Grub, but not a single kernel entry, which means that boot menus didn’t get parsed at all. Some distros were identified (here Mandriva and old Debian, still using Legacy Grub). Others went by name “Linux other”.
  • Funny enough, Grub stage1 installed in the extended VBR (which is actually particular to openSUSE and the default Grub location in many cases) were NOT added.
  • None Grub2 based distro was added.
  • OSes other than Windows and Linux (such as BSD) are missing.

…/…

…/…

Now, here’s how the menu.lst looks like after applying updategrub to the original menu.lst instead of merging Grub menus from YaST:


# Modified by YaST2. Last modification on Sat Apr 21 11:02:03 PDT 2012
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# For the new kernel it try to figure out old parameters. In case we are not able to recognize it (e.g. change of flavor or strange install order ) it it use as fallback installation parameters from /etc/sysconfig/bootloader

default 0
timeout 120
gfxmenu (hd0,8)/boot/message

###Don't change this comment - YaST2 identifier: Original name: linux###
title openSUSE 12.1 (Asparagus) - kernel 3.1.10-1.9 (Desktop)
    partnew (hd0,0) 0x06         63     514017
    partnew (hd0,1) 0xA5   73947195  285282270
    partnew (hd0,2) 0xA5  361398240  100663290
    partnew (hd1,1) 0xA5   18539010  534016665
    partnew (hd1,2) 0xA5  554724450   79698465
    root (hd0,8)
    kernel /boot/vmlinuz-3.1.10-1.9-desktop root=/dev/disk/by-uuid/f91ddef2-81ea-4fbe-be2b-b56ff4b2ad45 resume=/dev/disk/by-id/ata-WDC_WD5000AAKS-00A7B2_WD-WCASY8019640-part5 splash=silent quiet showopts vga=0x31a
    initrd /boot/initrd-3.1.10-1.9-desktop

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title openSUSE 12.1 (Asparagus) - kernel 3.1.10-1.9 (Failsafe)
    root (hd0,8)
    kernel /boot/vmlinuz-3.1.10-1.9-desktop root=/dev/disk/by-uuid/f91ddef2-81ea-4fbe-be2b-b56ff4b2ad45 showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x31a
    initrd /boot/initrd-3.1.10-1.9-desktop

###Don't change this comment - YaST2 identifier: Original name: linux###
title openSUSE 12.1 (Asparagus) - kernel 3.1.9-1.4 (Desktop)
    partnew (hd0,0) 0x06         63     514017
    partnew (hd0,1) 0xA5   73947195  285282270
    partnew (hd0,2) 0xA5  361398240  100663290
    partnew (hd1,1) 0xA5   18539010  534016665
    partnew (hd1,2) 0xA5  554724450   79698465
    root (hd0,8)
    kernel /boot/vmlinuz-3.1.9-1.4-desktop root=/dev/disk/by-uuid/f91ddef2-81ea-4fbe-be2b-b56ff4b2ad45 resume=/dev/disk/by-id/ata-WDC_WD5000AAKS-00A7B2_WD-WCASY8019640-part5 splash=silent quiet showopts vga=0x31a
    initrd /boot/initrd-3.1.9-1.4-desktop

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title openSUSE 12.1 (Asparagus) - kernel 3.1.9-1.4 (Failsafe)
    root (hd0,8)
    kernel /boot/vmlinuz-3.1.9-1.4-desktop root=/dev/disk/by-uuid/f91ddef2-81ea-4fbe-be2b-b56ff4b2ad45 showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x31a
    initrd /boot/initrd-3.1.9-1.4-desktop

###Don't change this comment - YaST2 identifier: Original name: linux###
title GNU GRUB 2 -- openSUSE 12.1 - GNU GRUB 2
    kernel (hd0,8)/boot/grub2/core.img root=/dev/disk/by-uuid/f91ddef2-81ea-4fbe-be2b-b56ff4b2ad45 resume=/dev/disk/by-uuid/ba9db764-a47e-48d9-b6f9-b627b57c0287 splash=silent quiet showopts vga=0x31a

###Don't change this comment - Added by updategrub Fri May 25 16:54:45 PDT 2012###

###Don't change this comment - YaST2 identifier: Original name: ubuntu###
title Ubuntu 12.04 LTS (precise) - kernel 3.2.0-24-generic
    partnew (hd0,0) 0x06         63     514017
    partnew (hd0,1) 0xA5   73947195  285282270
    partnew (hd0,2) 0xA5  361398240  100663290
    partnew (hd1,1) 0xA5   18539010  534016665
    partnew (hd1,2) 0xA5  554724450   79698465
    root (hd0,5)
    kernel /boot/vmlinuz-3.2.0-24-generic root=UUID=86abce7f-cd26-450a-8052-aae6ff775f02 ro vga=794
    initrd /boot/initrd.img-3.2.0-24-generic

###Don't change this comment - YaST2 identifier: Original name: ubuntu###
title Ubuntu 12.04 LTS (precise) - kernel 3.2.0-23-generic
    partnew (hd0,0) 0x06         63     514017
    partnew (hd0,1) 0xA5   73947195  285282270
    partnew (hd0,2) 0xA5  361398240  100663290
    partnew (hd1,1) 0xA5   18539010  534016665
    partnew (hd1,2) 0xA5  554724450   79698465
    root (hd0,5)
    kernel /boot/vmlinuz-3.2.0-23-generic root=UUID=86abce7f-cd26-450a-8052-aae6ff775f02 ro vga=794
    initrd /boot/initrd.img-3.2.0-23-generic

###Don't change this comment - YaST2 identifier: Original name: linuxmint###
title Linux Mint 12 - kernel 3.0.0-16-generic (/dev/sda11)
    partnew (hd0,0) 0x06         63     514017
    partnew (hd0,1) 0xA5   73947195  285282270
    partnew (hd0,2) 0xA5  361398240  100663290
    partnew (hd1,1) 0xA5   18539010  534016665
    partnew (hd1,2) 0xA5  554724450   79698465
    root (hd0,10)
    kernel /boot/vmlinuz-3.0.0-16-generic root=UUID=d15278f9-7b3f-4099-b508-e61ec2638593 ro vga=794
    initrd /boot/initrd.img-3.0.0-16-generic

###Don't change this comment - YaST2 identifier: Original name: linuxmint###
title Linux Mint 12 - kernel 3.0.0-12-generic (/dev/sda11)
    partnew (hd0,0) 0x06         63     514017
    partnew (hd0,1) 0xA5   73947195  285282270
    partnew (hd0,2) 0xA5  361398240  100663290
    partnew (hd1,1) 0xA5   18539010  534016665
    partnew (hd1,2) 0xA5  554724450   79698465
    root (hd0,10)
    kernel /boot/vmlinuz-3.0.0-12-generic root=UUID=d15278f9-7b3f-4099-b508-e61ec2638593 ro vga=794
    initrd /boot/initrd.img-3.0.0-12-generic

###Don't change this comment - YaST2 identifier: Original name: mandrivalinux###
title Mandriva 2010.2 (Farman) - kernel 2.6.38.8
    partnew (hd0,0) 0x06         63     514017
    partnew (hd0,1) 0xA5   73947195  285282270
    partnew (hd0,2) 0xA5  361398240  100663290
    partnew (hd1,1) 0xA5   18539010  534016665
    partnew (hd1,2) 0xA5  554724450   79698465
    root (hd1,5)
    kernel /boot/vmlinuz BOOT_IMAGE=linux root=UUID=4ecf3517-c7e9-47a1-8930-13a4e188e730 resume=UUID=ba9db764-a47e-48d9-b6f9-b627b57c0287 splash=silent vga=794
    initrd /boot/initrd.img

###Don't change this comment - YaST2 identifier: Original name: mandrivalinux###
title Mandriva 2010.2 (Farman) - kernel 2.6.38.8 (desktop)
    partnew (hd0,0) 0x06         63     514017
    partnew (hd0,1) 0xA5   73947195  285282270
    partnew (hd0,2) 0xA5  361398240  100663290
    partnew (hd1,1) 0xA5   18539010  534016665
    partnew (hd1,2) 0xA5  554724450   79698465
    root (hd1,5)
    kernel /boot/vmlinuz-2.6.38.8-desktop-69mib BOOT_IMAGE=2.6.38.8-desktop-69mib root=UUID=4ecf3517-c7e9-47a1-8930-13a4e188e730 resume=UUID=ba9db764-a47e-48d9-b6f9-b627b57c0287 splash=silent vga=794
    initrd /boot/initrd-2.6.38.8-desktop-69mib.img

###Don't change this comment - YaST2 identifier: Original name: archlinux###
title Arch Linux - kernel 3.3.6-1
    partnew (hd0,0) 0x06         63     514017
    partnew (hd0,1) 0xA5   73947195  285282270
    partnew (hd0,2) 0xA5  361398240  100663290
    partnew (hd1,1) 0xA5   18539010  534016665
    partnew (hd1,2) 0xA5  554724450   79698465
    root (hd0,12)
    kernel /boot/vmlinuz30 root=UUID=23c64367-0f52-4195-881b-1e25854ad5a5 ro vga=794
    initrd /boot/kernel30.img

###Don't change this comment - YaST2 identifier: Original name: debian###
title Debian GNU/Linux - kernel 2.6.32-trunk-amd64
    partnew (hd0,0) 0x06         63     514017
    partnew (hd0,1) 0xA5   73947195  285282270
    partnew (hd0,2) 0xA5  361398240  100663290
    partnew (hd1,1) 0xA5   18539010  534016665
    partnew (hd1,2) 0xA5  554724450   79698465
    root (hd0,15)
    kernel /boot/vmlinuz-2.6.32-trunk-amd64 root=UUID=30eac80e-8574-46fb-a4ee-ec2a2ee453f9 ro
    initrd /boot/initrd.img-2.6.32-trunk-amd64

###Don't change this comment - YaST2 identifier: Original name: debian###
title Debian GNU/Linux - kernel 2.6.32-3-amd64
    partnew (hd0,0) 0x06         63     514017
    partnew (hd0,1) 0xA5   73947195  285282270
    partnew (hd0,2) 0xA5  361398240  100663290
    partnew (hd1,1) 0xA5   18539010  534016665
    partnew (hd1,2) 0xA5  554724450   79698465
    root (hd0,15)
    kernel /boot/vmlinuz-2.6.32-3-amd64 root=UUID=30eac80e-8574-46fb-a4ee-ec2a2ee453f9 ro
    initrd /boot/initrd.img-2.6.32-3-amd64

###Don't change this comment - YaST2 identifier: Original name: windows###
title Windows NT/2000/XP (loader) - added by updategrub
    partnew (hd0,0) 0x06         63     514017
    partnew (hd0,1) 0xA5   73947195  285282270
    partnew (hd0,2) 0xA5  361398240  100663290
    rootnoverify (hd0,0)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: windows1###
title Windows NT/2000/XP (loader) - added by updategrub
    partnew (hd0,0) 0x06         63     514017
    partnew (hd0,1) 0xA5   73947195  285282270
    partnew (hd0,2) 0xA5  361398240  100663290
    map (hd1) (hd0)
    map (hd0) (hd1)
    rootnoverify (hd1,0)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: openSUSE Legacy Grub on /dev/sda4###
title openSUSE Legacy Grub in /dev/sda4
    rootnoverify (hd0,3)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: openSUSE Grub2 (1.99) on /dev/sda10###
title openSUSE Grub2 (1.99) in /dev/sda10
    rootnoverify (hd0,9)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: Ubuntu/Mint Grub2 (1.99) on /dev/sda11###
title Ubuntu/Mint Grub2 (1.99) in /dev/sda11
    rootnoverify (hd0,10)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: ArchLinux Legacy Grub on /dev/sda13###
title ArchLinux Legacy Grub in /dev/sda13
    rootnoverify (hd0,12)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: Debian Legacy Grub on /dev/sda16###
title Debian Legacy Grub in /dev/sda16
    rootnoverify (hd0,15)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: openSUSE Legacy Grub on /dev/sdb###
title openSUSE Legacy Grub in /dev/sdb
    rootnoverify (hd1)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: openSUSE Legacy Grub on /dev/sdb4###
title openSUSE Legacy Grub in /dev/sdb4
    rootnoverify (hd1,3)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: mandrivalinux Legacy Grub on /dev/sdb6###
title mandrivalinux Legacy Grub in /dev/sdb6
    rootnoverify (hd1,5)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: OpenBSD###
title OpenBSD 4.7
    partnew (hd0,0) 0x06         63     514017 
    partnew (hd0,1) 0xA6  317283750   41945715
    partnew (hd0,2) 0xA9  411729885   50331645
    partnew (hd1,1) 0xA6  510609960   41945715
    partnew (hd1,2) 0xA9  605056095   29366820
    rootnoverify (hd0,1)
    makeactive
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: NetBSD###
title NetBSD 5.0.2
    partnew (hd0,0) 0x06         63     514017 
    partnew (hd0,1) 0xA6  317283750   41945715
    partnew (hd0,2) 0xA9  411729885   50331645
    partnew (hd1,1) 0xA6  510609960   41945715
    partnew (hd1,2) 0xA9  605056095   29366820
    rootnoverify (hd0,2)
    makeactive
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: FreeBSD###
title FreeBSD 8.1
    partnew (hd0,0) 0xA5     514080   73433115
    partnew (hd0,1) 0xA5   73947195  285282270
    partnew (hd0,2) 0xA5  361398240  100663290
    partnew (hd1,1) 0xA5   18539010  534016665 
    partnew (hd1,2) 0xA5  554724450   79698465 
    rootnoverify (hd0,2)
    makeactive
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: DragonFly###
title DragonFly 2.4.1 
    partnew (hd0,0) 0x06         63      514017
    partnew (hd0,1) 0xA5    2682855   356546610
    partnew (hd0,2) 0xA5  359229465   102832065
    partnew (hd1,1) 0xA5     514080   552041595 
    partnew (hd1,2) 0xA5  552555675    81867240
    rootnoverify (hd0,1)
    makeactive
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: FreeBSD80ALT###
title FreeBSD 8.0 - alt
    partnew (hd0,0) 0xA5     514080   73433115
    partnew (hd0,1) 0xA5   73947195  285282270
    partnew (hd0,2) 0xA5  361398240  100663290
    partnew (hd1,1) 0xA5   18539010  534016665 
    partnew (hd1,2) 0xA5  554724450   79698465 
    rootnoverify (hd0,1)
    makeactive
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: FreeBSD72ALT###
title FreeBSD 7.2 - alt
    partnew (hd0,0) 0xA5     514080   73433115
    partnew (hd0,1) 0xA5   73947195  285282270
    partnew (hd0,2) 0xA5  361398240  100663290
    partnew (hd1,1) 0xA5   18539010  534016665 
    partnew (hd1,2) 0xA5  554724450   79698465 
    rootnoverify (hd1,2)
    makeactive
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: OpenBSDAlt###
title OpenBSD 4.7 - alt
    partnew (hd0,0) 0x06         63     514017 
    partnew (hd0,1) 0xA6  317283750   41945715
    partnew (hd0,2) 0xA9  411729885   50331645
    partnew (hd1,1) 0xA6  510609960   41945715
    partnew (hd1,2) 0xA9  605056095   29366820
    rootnoverify (hd1,1)
    makeactive
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: NetBSDAlt###
title NetBSD 5.0.2 - alt
    partnew (hd0,0) 0x06         63     514017 
    partnew (hd0,1) 0xA6  317283750   41945715
    partnew (hd0,2) 0xA9  411729885   50331645
    partnew (hd1,1) 0xA6  510609960   41945715
    partnew (hd1,2) 0xA9  605056095   29366820
    rootnoverify (hd1,2)
    makeactive
    chainloader +1


  • Existing boot entries of the current host (openSUSE) were preserved (no commands were removed).
  • Kernel boot entries were added for all distros (using os-prober, just like Grub2).
  • The order in which boot entries appear in the menu can be set in /etc/updategrub/defaults. I use the following setting:

linux_order="ubuntu linuxmint suse fedora mandrivalinux archlinux gentoo debian"

  • Windows boot entries don’t mean anything here. I don’t have Windows, only the boot files.
  • Chainloaders entries were added for both Legacy Grub and Grub2 in whatever bootsector they are located. That includes MBRs and extended VBRs.
  • Finaly, a bunch of custom boot entries (all the Unix ones) were read from /etc/updategrub/custom and appended to menu.lst, in a similar way Grub2 does from /etc/grub.d/40_custom.

…/…

…/…

I let you be the judge of which method is better. But I don’t want to convince anyone. Use what works for you! This menu.lst won’t survive a kernel update, as the Perl Bootloader shows no mercy to those boot entries. Thus I just remove Perl Bootloader’s **** and run updategrub again. It’s faster than viming in boot entries. Notice that grubmenu - a special call of updategrub - just displays the exiting boot entries without running os-prober (which usually takes a while). It can be used to enable or disable boot entries (faster than* viming out*). :wink:

A screenshot of the updategrub interactive mode (updategrub -i). **grubmenu **looks the same:

http://img580.imageshack.us/img580/1636/updategrub01.png

You have convinced me please_try_again, your scripts are great. We just don’t get the right audience here (ie our developers) to push any of this stuff forward into general usage. Perhaps creating an openFATE and pointing to the script might do something, but I am not all that sure it would. I do appreciate your work, hopefully others do as well AND I am looking for good things from you on the new Grub2 to fill in any gaps left by you know who. Always your biggest Fan …

Thank You,

No it won’t. AFAIK @jdd created an openFate for findgrub a while ago. I can only agree with him. :wink:

Well, I filled some gaps already with updateGrub2 - included in package updategrub. Actually when you install updategrub under 12.1 or lesser, updategrub becomes a symlink to updateLegacyGrub. In 12.2 it will be a symlink to updateGrub2. On 12.1, updateGrub2 can be used to install Grub2 in parallel to Legacy Grub, like in the example I posted in this thread. You’ll just install it in another VBR (excepted the extended one - as far as I recall it doesn’t work). On 12.2 (tested with Milestone3) it can improve Grub2 installation by installing/compiling a missing font and setting up graphical boot menu, and further be used to refresh the boot menu. Of course it can be used for its original purpose of installing grub2-efi.

It’s not impossible that the combination of Perl Bootloader and os-prober will offer both, chainloader (YaST already does) and kernel boot entries. os-prober, as in version 1.52 (12.2 has version 1.49) creates chainloader for Windows and Kernel entries for Linux. I still let generate chainloaders with updateGrub2 but it might - and it should - change. I’ve been considering @nrickert suggestion here:

And it would be actually quite easy to implement. It’s just not a grub2-mkconfig issue, or not only. It requires to add a script in /usr/lib/os-probes, and it’s actually rather simple for a Bash programmer. Take a look at these scripts, James. I’m sure you can add some. I did add 3 already to detect FreeBSD, NetBSD and openBSD kernels. They are useless (but totally harmless) without the appropriate code in /etc/grub.d/30_os-prober. That’s why I added option -b to updateGrub2. This option (which only needs to be run once) will allow grub2-mkconfig (or whatever you call it) to create boot entries for FreeBSD, NetBSD and openBSD. I also had to add ufs2 support in os-prober. This is discussed in this bug report

https://bugzilla.novell.com/show_bug.cgi?id=759635

However there is another (unrelated) bug I mentioned in the bug report but haven’t be able to fix yet. I thought I did but I was wrong. I’ll explain it some day with more details and examples. It doens’t affect ufs2 support, which is working well for me now.

I occasionally have problems mounting Linux partitions (on different machines and under different distros). I haven’t been able to figure out the reason, but mounting again if it fails seems to solve the issue in most cases. Once a partition has be mounted (either manually or by os-prober), the problem disappears.

Because of this bug I encountered with all os-prober versions under all Linux distros, some kernel boot entries might not get added, because the partition where these kernels are located won’t get mounted by os-prober. The only workaround (which always work) is to mount the partition manually once. Than, os-prober will detect the kernel or even be able to mount the partition if you unmounted it in the meantime. I don’t know why. :cry:

I’ve been using os-prober a while ago since updategrub depends on it, before it was available in any other repo, whether release, factory or home repos. For a long time, I just kept building the Fedora version for openSUSE without adding a line of code. But lately I became tired of a couple bugs which bothered me for months … well, that would be years by now, I guess. Thus I started looking at the code and submitting bug reports and patches. However I’m not very good at that. It would be nice if these patches would be passed upstream, because I don’t necessary want to have to install my own os-prober version. Anyway, I made it easy. updategrub still requires os-prober 1.49. So it will run with the version which came with openSUSE 12.2, but with less functionality and more bugs.

Here’s another bug which IMO didn’t catch the attention it deserves: Access Denied. I solved it as well in my os-prober build.

Btw, James, would you mind fixing the typo in the subject?

I hope this post is readable … it looks complicated somehow.

Btw, James, would you mind fixing the typo in the subject?

You got it please_try_again and keep posting and working on your stuff. I use everything you post. The only exception has been the UEFI stuff. I have a UEFI BIOS and one large hard drive, but its on my main system and I just don’t want to muck it up. When this stuff becomes more common and I am much more into Grub2, perhaps with the openSUSE 13 (or perhaps that will be openSUSE Gold 1.0 lol!), I will give this all a try, but not just yet. One thing is for sure, you are an expert on hard drive partitions and computer booting. You would be numero uno in my book on taking over such a task for openSUSE.

Thank You,

Not entirely. You fixed the title of my previous post, but not the subject of the thread.

Btw, James, may I recommend lspart from my repo? I had no time to post about it but it’s absolutely easy and turned out to be a very useful tool. I wrote it as I needed a way to retrieve partition properties while adding ufs2 support to os-prober. I think you will like it. I usually don’t like my scripts very much, but I confess that I like this one. There is a manual page in the package too.

Just try these commands:


lspart
sudo lspart -b
lspart -l
lspart - ID_FS_UUID ID_FS_LABEL

Using the last syntax, you can display any property listed in lspart -h. Cool, eh?

The code is super short (as usual) and would have been much shorter if I didn’t have to caculate the size of ufs partitions (because the info provided by udev about BSD disklabels varies between udev versions and I try to optimize my scripts for all Linux distros - at least the ones I’m using).

I guess I should post the code in a new thread … Here is it: http://forums.opensuse.org/english/other-forums/development/programming-scripting/475610-lspart-alternative-fdisk-l.html

Not entirely. You fixed the title of my previous post, but not the subject of the thread.

Yes, I was not yet awake I guess. You must edit the original message for the main title to be fixed and each message there after as well. Its a good thing there not a hundred messages yet using a s instead of a d. lol!

You should include a link to your repository in the message I would suggest to get **lspart **as its good for each message to be able to stand on its own. I shall give lspart a good look.

Thank You,

Oh, I didn’t know that, James. Sorry… and thank you! The title of the findgrub thread is fine, isn’t it? … Hummm … rotfl!

Done! That was easy.

I really like “updategrub”. I have to admit it’s very thorough. It would be nice to add a Yast module for your application. Have you tried the Yast mail list?
I remember the earlier Yast boot loader that came with openSUSE 10 and 11. They would always find Windows (not sure about openBSD)

I finally found the explanation! (took me years) :slight_smile:

It seems that these partitions would need a file system check (however it is not the case), which can not proceed because they are mounted read only. This is due to a call to the function ro_partition, defined in /usr/share/os-prober/common.sh:

ro_partition () {
    if type blockdev >/dev/null 2>&1 && \
        "$(blockdev --getro "$1")" = 0 ] && \
       blockdev --setro "$1"; then
        cleanup_ro_partitions="${cleanup_ro_partitions:+$cleanup_ro_partitions
}$1"
        trap cleanup EXIT HUP INT QUIT TERM
    fi
}

Commenting out ro_partition in /usr/lib/os-probes/50mounted-tests solves the issue … but looks like a hasardous hack, since all partitions will be accessed read/write by the os-prober scripts.

#    ro_partition "$partition"

Here’s the full bug report: Access Denied

The safest workaround is - as before - to mount/unmount the failing partition manually.

Here’a an example:


# OSPDEBUG=yes os-prober
  No volume groups found
/dev/sda1:Windows NT/2000/XP (loader):Windows:chain
/dev/sda12:Fedora release 16 (Verne):Fedora:linux
/dev/sda2:FreeBSD:FreeBSD 9.0-RELEASE:freebsd
/dev/sda3:FreeBSD:FreeBSD 8.1-RELEASE:freebsd
mount: wrong fs type, bad option, bad superblock on **/dev/sda6**,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

/dev/sdb1:Windows NT/2000/XP (loader):Windows1:chain
/dev/sdb6:Arch Linux (rolling):archlinux:linux


# mount -v /dev/sda6
/dev/sda6 on /local/mnt/ubuntu type ext4 (rw,nodev)

# umount -v /dev/sda6
/dev/sda6 has been unmounted


# OSPDEBUG=yes os-prober
  No volume groups found
/dev/sda1:Windows NT/2000/XP (loader):Windows:chain
/dev/sda12:Fedora release 16 (Verne):Fedora:linux
/dev/sda2:FreeBSD:FreeBSD 9.0-RELEASE:freebsd
/dev/sda3:FreeBSD:FreeBSD 8.1-RELEASE:freebsd
/dev/sda6:Ubuntu 11.10 (11.10):Ubuntu:linux
/dev/sdb1:Windows NT/2000/XP (loader):Windows1:chain
/dev/sdb6:Arch Linux (rolling):archlinux:linux
  • OSPDEBUG is a flag I added to print standard error. Otherwise it is redirected to /dev/null.

To install the latest os-prober version from my repo, you have to force install this version:

# zypper install --force os-prober-1.53-78.1.x86_64

This is due to my own mistake. I called the previous version (patched against version 1.52) 1.53a. Now I ported version 1.53 from Fedora, which fixed some bugs I had fixed before. So I removed a patch of mine which wasn’t needed anymore. The version in my repo is the same as Fedora’s version but includes a debug flag and support for ufs2 file system and FreeBSD, NetBSD and openBSD OSes. However to make use of this in Grub2, you need to add this code to /etc/grub.d/30_os-prober (or run updateGrub2 -b, which does that for you):

       freebsd)
      cat << EOF
menuentry "${LABEL} (on ${DEVICE})" --class freebsd --class os {
EOF
          ufsid=`${grub_probe} --device ${DEVICE} --target=fs_uuid`
      save_default_entry | sed -e "s/^/	/"
          ${grub_probe} --device ${DEVICE} --target=fs | sed "s|^|	insmod |"
          ${grub_probe} --device ${DEVICE} --target=drive | sed "s|^\((.*,\)^0-9]*\([0-9]*\))|	set root='\1\2,a)'|"
      cat << EOF
        search --no-floppy --fs-uuid --set=root $ufsid
        kfreebsd /boot/kernel/kernel
        kfreebsd_loadenv /boot/device.hints
        set kFreeBSD.vfs.root.mountfrom=ufs:ufsid/$ufsid
        set kFreeBSD.vfs.root.mountfrom.options=rw
}
EOF
    ;;
        netbsd)
      cat << EOF
menuentry "${LABEL} (on ${DEVICE})" --class netbsd --class os {
EOF
      save_default_entry | sed -e "s/^/	/"
          ${grub_probe} --device ${DEVICE} --target=fs | sed 's|^|	insmod |'
          ${grub_probe} --device ${DEVICE} --target=drive | sed 's|^|	set root=|p;$s|set root=(hd\([0-9]*\),.*|knetbsd /netbsd --root=wd\1a|'
      cat << EOF
}
EOF
        ;;
        openbsd)
      cat << EOF
menuentry "${LABEL} (on ${DEVICE})" --class openbsd --class os {
EOF
      save_default_entry | sed -e "s/^/	/"
          ${grub_probe} --device ${DEVICE} --target=drive | sed 's|,[a-zA-Z]*|,|;s|^|	set root=|'
      cat << EOF
        chainloader +1
}
EOF
    ;;
    *)
      echo "  ${LONGNAME} is not yet supported by grub-mkconfig." >&2
    ;;
  esac
done

This part was out of topic, but answers a question which had been asked in the past and shows a way to make Grub2 write BSD boot entries.