Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
grub2 with windows dual-boot
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Mati
Apprentice
Apprentice


Joined: 02 Sep 2008
Posts: 172

PostPosted: Mon Mar 09, 2015 8:48 pm    Post subject: grub2 with windows dual-boot Reply with quote

Hi,

i cannot start my windows using grub2. What am i supposed to insert into grub.cfg to get it working. It appears in the boot menu but when hitting it does not start.
Currently my grub.cfg loooks like this:

Code:

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="0"
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 xfs
set root='hd0,msdos14'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos14 --hint-efi=hd0,msdos14 --hint-baremetal=ahci0,msdos14  f6036196-466d-4b9a-81e6-5ede215bfc51
else
  search --no-floppy --fs-uuid --set=root f6036196-466d-4b9a-81e6-5ede215bfc51
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=de_DE
  insmod gettext
fi
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-f6036196-466d-4b9a-81e6-5ede215bfc51' {
        load_video
        insmod gzio
        insmod part_msdos
        insmod xfs
        set root='hd0,msdos14'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos14 --hint-efi=hd0,msdos14 --hint-baremetal=ahci0,msdos14  f6036196-466d-4b9a-81e6-5ede215bfc51
        else
          search --no-floppy --fs-uuid --set=root f6036196-466d-4b9a-81e6-5ede215bfc51
        fi
        echo    'Linux 3.18.7-gentoo wird geladen …'
        linux   /boot/kernel-3.18.7-gentoo root=/dev/sda14 ro 
}
submenu 'Erweiterte Optionen für Gentoo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-f6036196-466d-4b9a-81e6-5ede215bfc51' {
        menuentry 'Gentoo GNU/Linux, mit Linux 3.18.7-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.18.7-gentoo-advanced-f6036196-466d-4b9a-81e6-5ede215bfc51' {
                load_video
                insmod gzio
                insmod part_msdos
                insmod xfs
                set root='hd0,msdos14'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos14 --hint-efi=hd0,msdos14 --hint-baremetal=ahci0,msdos14  f6036196-466d-4b9a-81e6-5ede215bfc51
                else
                  search --no-floppy --fs-uuid --set=root f6036196-466d-4b9a-81e6-5ede215bfc51
                fi
                echo    'Linux 3.18.7-gentoo wird geladen …'
                linux   /boot/kernel-3.18.7-gentoo root=/dev/sda14 ro 
        }
        menuentry 'Gentoo GNU/Linux, mit Linux 3.18.7-gentoo (Wiederherstellungsmodus)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.18.7-gentoo-recovery-f6036196-466d-4b9a-81e6-5ede215bfc51' {
                load_video
                insmod gzio
                insmod part_msdos
                insmod xfs
                set root='hd0,msdos14'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos14 --hint-efi=hd0,msdos14 --hint-baremetal=ahci0,msdos14  f6036196-466d-4b9a-81e6-5ede215bfc51
                else
                  search --no-floppy --fs-uuid --set=root f6036196-466d-4b9a-81e6-5ede215bfc51
                fi
                echo    'Linux 3.18.7-gentoo wird geladen …'
                linux   /boot/kernel-3.18.7-gentoo root=/dev/sda14 ro single
        }
        menuentry 'Gentoo GNU/Linux, mit Linux 3.12.21-gentoo-r1' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.12.21-gentoo-r1-advanced-f6036196-466d-4b9a-81e6-5ede215bfc51' {
                load_video
                insmod gzio
                insmod part_msdos
                insmod xfs
                set root='hd0,msdos14'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos14 --hint-efi=hd0,msdos14 --hint-baremetal=ahci0,msdos14  f6036196-466d-4b9a-81e6-5ede215bfc51
                else
                  search --no-floppy --fs-uuid --set=root f6036196-466d-4b9a-81e6-5ede215bfc51
                fi
                echo    'Linux 3.12.21-gentoo-r1 wird geladen …'
                linux   /boot/vmlinuz-3.12.21-gentoo-r1 root=/dev/sda14 ro 
        }
        menuentry 'Gentoo GNU/Linux, mit Linux 3.12.21-gentoo-r1 (Wiederherstellungsmodus)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.12.21-gentoo-r1-recovery-f6036196-466d-4b9a-81e6-5ede215bfc51' {
                load_video
               insmod gzio
                insmod part_msdos
                insmod xfs
                set root='hd0,msdos14'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos14 --hint-efi=hd0,msdos14 --hint-baremetal=ahci0,msdos14  f6036196-466d-4b9a-81e6-5ede215bfc51
                else
                  search --no-floppy --fs-uuid --set=root f6036196-466d-4b9a-81e6-5ede215bfc51
                fi
                echo    'Linux 3.12.21-gentoo-r1 wird geladen …'
                linux   /boot/vmlinuz-3.12.21-gentoo-r1 root=/dev/sda14 ro single
        }
}

### 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 XP" {
   set root='hd0,3'
   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 ###

Back to top
View user's profile Send private message
Fitzcarraldo
Veteran
Veteran


Joined: 30 Aug 2008
Posts: 1655
Location: United Kingdom

PostPosted: Mon Mar 09, 2015 10:42 pm    Post subject: Reply with quote

When I run:

Code:
grub2-mkconfig -o /boot/grub/grub.cfg

I end up with the following in grub.cfg for the two Windows 7 partitions I have (sda1 is the hidden factory restore partition and sda2 is the C: drive):

Code:
### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows Vista (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-A6863E9F863E7043' {
        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  A6863E9F863E7043
        else
          search --no-floppy --fs-uuid --set=root A6863E9F863E7043
        fi
        parttool ${root} hidden-
        chainloader +1
}
menuentry 'Windows Vista (loader) (on /dev/sda2)' --class windows --class os $menuentry_id_option 'osprober-chain-A2243DA8243D7FF9' {
        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  A2243DA8243D7FF9
        else
          search --no-floppy --fs-uuid --set=root A2243DA8243D7FF9
        fi
        parttool ${root} hidden-
        chainloader +1
}
### END /etc/grub.d/30_os-prober ###


Here are the versions of GRUB and OS Prober that I have got installed:

Code:
# eix -I sys-boot/grub
[I] sys-boot/grub
     Available versions: 
     (0)    0.97-r12 (~)0.97-r13 0.97-r14
     (2)    2.00_p5107-r2^t 2.02_beta2-r3^t (~)2.02_beta2-r6^t (~)2.02_beta2-r7^t [m](**)9999-r1^t
       {custom-cflags debug device-mapper doc efiemu +fonts libzfs mount +multislot ncurses netboot nls sdl static test +themes truetype GRUB_PLATFORMS="coreboot efi-32 efi-64 emu ieee1275 loongson multiboot pc qemu qemu-mips xen yeeloong"}
     Installed versions:  2.02_beta2-r7(2)^t(21:16:14 08/02/15)(fonts multislot nls sdl themes truetype -debug -device-mapper -doc -efiemu -libzfs -mount -static -test GRUB_PLATFORMS="pc -coreboot -efi-32 -efi-64 -emu -ieee1275 -loongson -multiboot -qemu -qemu-mips -xen")
     Homepage:            http://www.gnu.org/software/grub/
     Description:         GNU GRUB boot loader

# eix -I os-prober
[I] sys-boot/os-prober
     Available versions:  1.53 (~)1.56 (~)1.57 (~)1.57-r1 (~)1.62
     Installed versions:  1.62(23:47:13 21/09/13)
     Homepage:            http://packages.debian.org/source/sid/os-prober
     Description:         Utility to detect other OSs on a set of drives

_________________
Clevo W230SS: amd64 OpenRC elogind nvidia-drivers & xf86-video-intel.
Compal NBLB2: ~amd64 OpenRC elogind xf86-video-ati. Dual boot Win 7 Pro 64-bit.
KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum