Results 1 to 3 of 3

Thread: updategrub for openSUSE Legacy Grub (not update-grub!)

Threaded View

  1. #1

    Default updategrub for openSUSE Legacy Grub (not update-grub!)

    This document has been modified since pages 1 & 2 were created. Please click HERE for the most recent and up to date information on 'updategrub'.

    updategrub is a script which aims to solve all your boot problems ...

    As I just advised somebody to try it, I think I have to post the code now, so that users and others can have a look at it.

    More seriously, it works similarly to Grub2's update-grub under Ubuntu, using the same helper scripts : os-prober and linux-bootprober. I don't know why os-prober wasn't available for openSUSE. So I packaged it from a Fedora/ArchLinux port (which in turn ported the original Ubuntu/Debian script). os-prober will be installed as dependency when you install updategrub from my repo.

    Like update-grub, updategrub allows to append custom boot entries written in /etc/updategrub/custom (Ubuntu uses /etc/grub.d/40_custom). This file doesn't exist by default. It has a couple options that can be turned on/off in /etc/updategrub/defaults. This file is installed with defaults values. The options are explained in details in /usr/share/doc/packages/updategrub/README.

    As a consequence of installing os-prober, Grub2 users under openSUSE will be able to update Grub2 menu entries as well (assuming they use Grub2 under openSUSE). I added such an option, although updategrub isn't originally intended to work with Grub2.

    If - as I read many times - the advantage of Grub2 over Legacy Grub is that it can update Grub menu boot entries:
    • it wasn't entirely true since it is not the job of Grub2 but the fact of os-prober/linux-bootprober
    • it might not be true anymore since updategrub does it better (I hope so) and with more features.

    updategrub will be installed in /usr/bin and is actually a symlink to /usr/bin/updateLegacyGrub (to avoid future conflicts ?).
    I also added the old good findgrub and cfindgrub scripts to the updategrub package.

    Installation from repo:

    su -l
    zypper ar PTA
    zypper refresh -r PTA
    zypper in updategrub

    updategrub     # updtate /boot/grub/menu.lst
    updategrub -l  # display boot entries which could be added but don't write menu.lst
    updategrub -a  # activate Grub primary partition (same as findgrub -a)
    updategrub -r  # restore previous menu.lst
    updategrub -2  # update Grub2 menu.
    Some of updategrub's options in /etc/updategrub/defaults include:

    CHAINLOADGRUB (default yes)
    add other Grubs chainload entries

    (default is no and should remain NO!)
    make Windows partition active

    SETBOOTFLAG (default is no)
    (set bootflag on Grub primary partition if any, same as updategrub -a)

    You may also influence the order in which other Linux boot entries will be added in linux_order and ignore failsafe like boot entries as well as entries containing specific keywords, as in the example:
    linux_ignore="Gutsy Hardy"

    I don't guarantee it is bugfree. First versions rarely are. I hope you'll tell me if you find some.
    To Windows users - and I do not intend to work for them, please! - the entries that updategrub will add are the ones found and identified by os-prober, basically the same ones you would see in Ubuntu while running update-grub. Since openSUSE already adds those entries (sometimes also wrong ones), at least one (probably the right one) will appear twice. I guess I'll have to add a windows_ignore option in the next release to avoid duplicates.

    updategrub does not modify the part of menu.lst written by openSUSE YaST or zypper. It does not add other openSUSE's kernel boot entries, since os-prober doesn't check the /boot partition of the current OS. However it will add other openSUSE kernel boot entries if they are installed in other partitions (other openSUSE versions or several installs of the same version).

    Quote Added for detail:
    The script is not intended to be 'destructive'. But it's also possible to harm a system, even with non destructive tools. In any case, updategrub -l will print the entries that could be added to standard output without writing menu.lst. I would first run the script with that option. If it displays nothing or garbage, there is no point to run updategrub, as it will write exactly the same thing in Grub menu.

    Whithout the option "-l", updategrub will look for the string "
    Added by updategrub" in menu.lst and delete everything after that point. It will then add a comment "# *** Don't change this comment - Added by updategrub" followed by the date. Obviously if someone came to the idea to write "Added by updategrub" on the top on menu.lst, the whole menu would get deleted, including the openSUSE boot entries.

    To keep it safe, the first time it is executed, updategrub will copy menu.lst in menu.lst.dist once and never touch this copy. Then, each time it is ran, it will save menu.lst in menu.lst.updg, so that the previous menu can be restored with
    updategrub -r

    updategrub -h
    displays the command line options as well as the list of distros known by os-prober. If you want to apply Grub commands to specific boot entries, you would use these names followed by "_options". I would call that "advanced usage". I can not think of anyone (except myself) who would use options for Linux Grub entries. But the feature is there because I needed it.
    Viel Spass.
    Last edited by caf4926; 24-Apr-2011 at 20:39. Reason: add quote details provided by PTA

Similar Threads

  1. How to update grub (legacy) in opensuse?
    By ojosazul in forum Install/Boot/Login
    Replies: 12
    Last Post: 24-Oct-2015, 00:28
  2. updategrub for openSUSE Legacy Grub (not update-grub!)
    By please_try_again in forum Programming/Scripting
    Replies: 11
    Last Post: 22-Dec-2011, 04:55

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts