Results 1 to 4 of 4

Thread: Grub 2 question

  1. #1
    Join Date
    Jun 2008
    Location
    Stoney Stanton - England
    Posts
    1,169

    Default Grub 2 question

    I am being a bit cheeky posting here.

    Although one of the many advantages of using linux is that it gives you lots of different distros to try - I've been really poor in this respect. I have been using opensuse (or suse as it was called then) since I came across a boxed set of 8.1 in P C World. Until recently the only other distro I've tried was ubuntu - which I hated. I hated the look, I hated gnome and I hated atp or apt - whatever it is called (being so used to rpm).

    I gave openmandriva a try on our downstairs laptop - this has win 7 which is used by the rest of the family. It is a BIOS based system and I set it up as a duel boot using grub 2. I quite like openmadriva as it is a kde based distro and uses rpm although I won't be replacing opensuse on my main p/c (which has 13.1 & 13.2 rc 0). My problem is that although openmandriva has a config system (a little like yast but not as good) the change to make win 7 the default booting system doesn't work. Is it possible to manually change the grub 2 config file (shown below) to make the change? If so what change do I need to make? Thanks.

    Code:
    #
    # 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
    set default="0"
    
    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='hd0,msdos6'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6  2c10d679-1615-4bfc-a8b0-41fc28127f58
    else
      search --no-floppy --fs-uuid --set=root 2c10d679-1615-4bfc-a8b0-41fc28127f58
    fi
        font="/usr/share/grub/unicode.pf2"
    fi
    
    if loadfont $font ; then
      set gfxmode=1680x1050,1360x768,1280x800,1024x768,1024x600,800x600,640x480
      load_video
      insmod gfxterm
      set locale_dir=$prefix/locale
      set lang=en_GB
      insmod gettext
    fi
    terminal_output gfxterm
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos6'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6  2c10d679-1615-4bfc-a8b0-41fc28127f58
    else
      search --no-floppy --fs-uuid --set=root 2c10d679-1615-4bfc-a8b0-41fc28127f58
    fi
    insmod gfxmenu
    loadfont ($root)/boot/grub2/themes/OpenMandriva/dejavu_sans_bold_14.pf2
    loadfont ($root)/boot/grub2/themes/OpenMandriva/dejavu_sans_mono_11.pf2
    loadfont ($root)/boot/grub2/themes/OpenMandriva/terminal_font_11.pf2
    insmod png
    set theme=($root)/boot/grub2/themes/OpenMandriva/theme.txt
    export theme
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos6'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6  2c10d679-1615-4bfc-a8b0-41fc28127f58
    else
      search --no-floppy --fs-uuid --set=root 2c10d679-1615-4bfc-a8b0-41fc28127f58
    fi
    insmod png
    background_image -m stretch /boot/grub2/themes/OpenMandriva/terminal_background.png
    set timeout=10
    ### END /etc/grub.d/00_header ###
    
    ### BEGIN /etc/grub.d/10_linux ###
    menuentry 'OpenMandriva Lx' --class openmandriva --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-2c10d679-1615-4bfc-a8b0-41fc28127f58' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos6'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6  2c10d679-1615-4bfc-a8b0-41fc28127f58
        else
          search --no-floppy --fs-uuid --set=root 2c10d679-1615-4bfc-a8b0-41fc28127f58
        fi
        echo    'Loading Linux 3.11.8-nrjQL-desktop-1omv ...'
        linux  /boot/vmlinuz-3.11.8-nrjQL-desktop-1omv root=UUID=2c10d679-1615-4bfc-a8b0-41fc28127f58 ro   quiet logo.nologo splash=silent acpi_osi=Linux acpi_backlight=vendor resume=/dev/sda7 init=/lib/systemd/systemd resume=/dev/sda7 init=/lib/systemd/systemd
        echo    'Loading initial ramdisk ...'
        initrd    /boot/initramfs-3.11.8-nrjQL-desktop-1omv.img
    }
    submenu 'Advanced options for OpenMandriva Lx' $menuentry_id_option 'gnulinux-advanced-2c10d679-1615-4bfc-a8b0-41fc28127f58' {
        menuentry 'OpenMandriva Lx, with Linux 3.11.8-nrjQL-desktop-1omv' --class openmandriva --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.11.8-nrjQL-desktop-1omv-advanced-2c10d679-1615-4bfc-a8b0-41fc28127f58' {
            load_video
            set gfxpayload=keep
            insmod gzio
            insmod part_msdos
            insmod ext2
            set root='hd0,msdos6'
            if [ x$feature_platform_search_hint = xy ]; then
              search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6  2c10d679-1615-4bfc-a8b0-41fc28127f58
            else
              search --no-floppy --fs-uuid --set=root 2c10d679-1615-4bfc-a8b0-41fc28127f58
            fi
            echo    'Loading Linux 3.11.8-nrjQL-desktop-1omv ...'
            linux  /boot/vmlinuz-3.11.8-nrjQL-desktop-1omv root=UUID=2c10d679-1615-4bfc-a8b0-41fc28127f58 ro   quiet logo.nologo splash=silent acpi_osi=Linux acpi_backlight=vendor resume=/dev/sda7 init=/lib/systemd/systemd resume=/dev/sda7 init=/lib/systemd/systemd
            echo    'Loading initial ramdisk ...'
            initrd    /boot/initramfs-3.11.8-nrjQL-desktop-1omv.img
        }
    }
    
    ### END /etc/grub.d/10_linux ###
    
    ### BEGIN /etc/grub.d/20_linux_xen ###
    
    ### END /etc/grub.d/20_linux_xen ###
    
    ### BEGIN /etc/grub.d/30_os-prober ###
    menuentry 'Windows Recovery Environment (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-DAA41C49A41C2B11' {
        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  DAA41C49A41C2B11
        else
          search --no-floppy --fs-uuid --set=root DAA41C49A41C2B11
        fi
        drivemap -s (hd0) ${root}
        chainloader +1
    }
    menuentry 'Windows 7 (loader) (on /dev/sda2)' --class windows --class os $menuentry_id_option 'osprober-chain-C6923E11923E0689' {
        insmod part_msdos
        insmod ntfs
        set root='hd0,msdos2'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  C6923E11923E0689
        else
          search --no-floppy --fs-uuid --set=root C6923E11923E0689
        fi
        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.
    ### 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 ###

  2. #2
    Join Date
    Dec 2008
    Location
    Montana, USA
    Posts
    676

    Default Re: Grub 2 question

    Not sure the Mandriva system is the same as openSuse, but in the openSuse version there is a file /etc/default that may be altered. You'll need to be root to do this.

    The default choice is set to be the last choice made. Looks like you could change GRUB_DEFAULT from "saved" to which ever you wanted so it would always be the default.

    A comment from that file says:
    Code:
    # If you change this file, run 'grub2-mkconfig -o /boot/grub2/grub.cfg' afterwards to update
    # /boot/grub2/grub.cfg.
    Bart

  3. #3
    Join Date
    Sep 2012
    Posts
    7,101

    Default Re: Grub 2 question

    Quote Originally Posted by montana_suse_user View Post
    there is a file /etc/default that may be altered.
    It is /etc/default/grub
    The default choice is set to be the last choice made.
    It is openSUSE (YaST) default. In OP case default either is not set or is explicitly set to the first entry (default=0).

    And it is not the last choice - it is whatever is set in GRUB2 environment. There is another option to save last booted entry in environment, which is not set in OP case.

    Looks like you could change GRUB_DEFAULT from "saved" to which ever you wanted so it would always be the default.
    That would be
    Code:
    GRUB_DEFAULT=osprober-chain-C6923E11923E0689
    It is can also be set to "saved" (as in openSUSE) and default entry set using grub-set-default:
    Code:
    grub2-set-default osprober-chain-C6923E11923E0689
    The problem at the end is how to ensure the change won't be undone by Mandriva configuration tools, and that can only be answered by someone having experience with modern Mandriva.

    A comment from that file says:
    Code:
    # If you change this file, run 'grub2-mkconfig -o /boot/grub2/grub.cfg' afterwards to update
    # /boot/grub2/grub.cfg.
    Last unknown question - whether Mandriva is using grub2 as prefix or simply grub as upstream.

  4. #4
    Join Date
    Jun 2008
    Location
    Stoney Stanton - England
    Posts
    1,169

    Default Re: Grub 2 question

    Many thanks for the very helpful postings. I will give it a try.

Posting Permissions

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