View previous topic :: View next topic |
Author |
Message |
ralf1 n00b
Joined: 29 Mar 2014 Posts: 7
|
Posted: Sat Mar 29, 2014 3:46 pm Post subject: Dual boot fails after second execution of grub2-mkconfig |
|
|
Big Hello to the community.
I installed a dual boot system with Gentoo and Windows7 using grub2. Everything worked fine after the initial installation. But after the second execution of grub2-mkconfig, the Windows partitions are no longer recognized by grub2.
Here is what I did:
1) Boot with Gentoo LiveCD and partition the disk with fdisk:
Code: |
/dev/sda1 NTFS C:
/dev/sda2 NTFS S:
/dev/sda3 NTFS D:
/dev/sda4 Extended
/dev/sda5 Linux boot
/dev/sda6 Linux swap swap
/dev/sda7 Linux root
/dev/sda8 Linux home
|
2) Install Windows 7 on /dev/sda1
3) Install Gentoo with Gentoo LiveCD beginning with /dev/sda5
4) Install grub2
5) Install sys-boot/os-prober and sys-fs/ntfs3g
6) Execute grub2-mkconfig -o /boot/grub/grub.cfg
grub2-mkconfig found both Gentoo and Windows 7 and created the boot menu with both options.
And here is the problem: When I re-run grub2-mkconfig (after a kernel modification) then it does not recognize Windows anymore. It is not in the boot menu and the related section in /boot/grub/grub.cfg is empty:
Code: |
### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###
|
Is there a known solution for this issue? |
|
Back to top |
|
|
Keruskerfuerst Advocate
Joined: 01 Feb 2006 Posts: 2289 Location: near Augsburg, Germany
|
Posted: Sat Apr 05, 2014 6:44 pm Post subject: |
|
|
Can you post the grub configuration? |
|
Back to top |
|
|
ralf1 n00b
Joined: 29 Mar 2014 Posts: 7
|
Posted: Mon Apr 07, 2014 4:47 pm Post subject: |
|
|
This is /boot/grub/grub.cfg after the second execution of grub2-mkconfig:
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
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 ext2
set root='hd0,msdos7'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos7 --hint-efi=hd0,msdos7 --hint-baremetal=ahci0,msdos7 48572790-de22-43db-ba9b-8c31095b22f1
else
search --no-floppy --fs-uuid --set=root 48572790-de22-43db-ba9b-8c31095b22f1
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=en_US
insmod gettext
fi
terminal_output gfxterm
if sleep --interruptible 0 ; then
set timeout=10
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-48572790-de22-43db-ba9b-8c31095b22f1' {
load_video
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos5'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 de932d3e-a4a5-48d7-b299-4031f42ec3c2
else
search --no-floppy --fs-uuid --set=root de932d3e-a4a5-48d7-b299-4031f42ec3c2
fi
echo 'Loading Linux 3.12.13-gentoo-r1 ...'
linux /kernel-3.12.13-gentoo-r1 root=/dev/sda7 ro
}
submenu 'Advanced options for Gentoo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-48572790-de22-43db-ba9b-8c31095b22f1' {
menuentry 'Gentoo GNU/Linux, with Linux 3.12.13-gentoo-r1' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.12.13-gentoo-r1-advanced-48572790-de22-43db-ba9b-8c31095b22f1' {
load_video
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos5'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 de932d3e-a4a5-48d7-b299-4031f42ec3c2
else
search --no-floppy --fs-uuid --set=root de932d3e-a4a5-48d7-b299-4031f42ec3c2
fi
echo 'Loading Linux 3.12.13-gentoo-r1 ...'
linux /kernel-3.12.13-gentoo-r1 root=/dev/sda7 ro
}
menuentry 'Gentoo GNU/Linux, with Linux 3.12.13-gentoo-r1 (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.12.13-gentoo-r1-recovery-48572790-de22-43db-ba9b-8c31095b22f1' {
load_video
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos5'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 de932d3e-a4a5-48d7-b299-4031f42ec3c2
else
search --no-floppy --fs-uuid --set=root de932d3e-a4a5-48d7-b299-4031f42ec3c2
fi
echo 'Loading Linux 3.12.13-gentoo-r1 ...'
linux /kernel-3.12.13-gentoo-r1 root=/dev/sda7 ro single
}
menuentry 'Gentoo GNU/Linux, with Linux 3.12.13-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.12.13-gentoo-advanced-48572790-de22-43db-ba9b-8c31095b22f1' {
load_video
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos5'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 de932d3e-a4a5-48d7-b299-4031f42ec3c2
else
search --no-floppy --fs-uuid --set=root de932d3e-a4a5-48d7-b299-4031f42ec3c2
fi
echo 'Loading Linux 3.12.13-gentoo ...'
linux /kernel-3.12.13-gentoo root=/dev/sda7 ro
}
menuentry 'Gentoo GNU/Linux, with Linux 3.12.13-gentoo (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.12.13-gentoo-recovery-48572790-de22-43db-ba9b-8c31095b22f1' {
load_video
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos5'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 de932d3e-a4a5-48d7-b299-4031f42ec3c2
else
search --no-floppy --fs-uuid --set=root de932d3e-a4a5-48d7-b299-4031f42ec3c2
fi
echo 'Loading Linux 3.12.13-gentoo ...'
linux /kernel-3.12.13-gentoo root=/dev/sda7 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 ###
### 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 |
|
|
qrthur n00b
Joined: 01 Apr 2014 Posts: 10
|
Posted: Mon Apr 07, 2014 6:26 pm Post subject: |
|
|
Hey,
try to add this to your /etc/grub/40_custom
Code: | menuentry "Windows 7" {
set root=(hd0, 2) ## or maybe (hd0, 3)
chainloader +1
boot
} |
It will be taken into account when you will do a grub2-mkconfig.
I am not sure about the cleanliness of my solution, but it works for me. |
|
Back to top |
|
|
natrix Guru
Joined: 23 Aug 2013 Posts: 556
|
Posted: Tue Apr 08, 2014 4:42 am Post subject: |
|
|
Hello ralf1:
Change the /boot partition to a primary partition Ext2:
Code: | /dev/sda1 NTFS C:
/dev/sda2 NTFS S:
/dev/sda3 NTFS D:
/dev/sda4 Linux(Ext2) boot
/dev/sda5 Extended
/dev/sda6 Linux swap swap
/dev/sda7 Linux root
/dev/sda8 Linux home |
|
|
Back to top |
|
|
qrthur n00b
Joined: 01 Apr 2014 Posts: 10
|
Posted: Tue Apr 08, 2014 10:38 am Post subject: |
|
|
natrix wrote: | Hello ralf1:
Change the /boot partition to a primary partition Ext2:
Code: | /dev/sda1 NTFS C:
/dev/sda2 NTFS S:
/dev/sda3 NTFS D:
/dev/sda4 Linux(Ext2) boot
/dev/sda5 Extended
/dev/sda6 Linux swap swap
/dev/sda7 Linux root
/dev/sda8 Linux home |
|
If I am not mistaken, this is not necessary. My laptop boots perfectly and my /boot partition is a logical one. Maybe you can spare yourself the time, because if you do this you have to destroy a Windows partition since you can not have more than 4 primary/extended partitions. (Unless you delete the S: partition, assuming it is the "System Reserved partition" following this article)
However I've read several times that /boot should use ext2 as natrix mentioned. |
|
Back to top |
|
|
ralf1 n00b
Joined: 29 Mar 2014 Posts: 7
|
Posted: Tue Apr 08, 2014 10:45 pm Post subject: |
|
|
/boot is formatted as ext2, I did not describe that clearly. Windows partition (S:) is a partition containing only the Windows swap file.
I am not happy with the idea to move one of the Windows partitions into a logical partition because I wonder how Windows will cope with that.
On the other hand Gentoo boots from a logical partition, haven't seen any problems with that.
The problem seems to be os-prober. It doesn't recognize Windows after the first run of grub2-mkconfig anymore. I copied the menu entry for Windows into file 40_custom as it was created with the first invocation of grub2-mkconfig. And I deinstalled sys-boot/os-prober and sys-fs/ntfs3g because it doesn't work anymore:
Code: |
### 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 'Windows 7 (loader) (auf /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-0CBECED9BECEBA8A' {
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 0CBECED9BECEBA8A
else
search --no-floppy --fs-uuid --set=root 0CBECED9BECEBA8A
fi
chainloader +1
}
### END /etc/grub.d/40_custom ###
|
However, qrthur's proposal works too, with a small modification:
Code: |
menuentry 'Windows 7' {
set root='hd0,msdos1'
chainloader +1
boot
}
|
|
|
Back to top |
|
|
aschueler Tux's lil' helper
Joined: 09 Apr 2004 Posts: 119
|
Posted: Sat Apr 19, 2014 4:18 pm Post subject: |
|
|
I have probably made every mistake there is installing gentoo, and some I learned from.
One of those was to try to let grub2 find all my bootable partitions while they were not mounted, which of course means it never found them. Did you mount the windows partition? |
|
Back to top |
|
|
ralf1 n00b
Joined: 29 Mar 2014 Posts: 7
|
Posted: Thu Apr 24, 2014 7:35 am Post subject: |
|
|
aschueler wrote: | Did you mount the windows partition? |
No. And even if I try, it is rejected because NTFS is not compiled in the kernel.
That leaves the the question why it did work the first time applied with the Gentoo installation CD. If I remember correctly, I mounted only the Linux partitions before executing grub2-mkconfig. Perhaps a kernel with NTFS compiled is required. |
|
Back to top |
|
|
aschueler Tux's lil' helper
Joined: 09 Apr 2004 Posts: 119
|
Posted: Fri Apr 25, 2014 1:22 am Post subject: |
|
|
I guess the gentoo live cd kernel hast ntfs support and your current kernel does not. However, I don't see how the os probe will "see" bootable operating systems on hard drives not mounted. Try putting ntfs in your kernel, mounting everything (which is a funny pun), and re do the grub2-mkconfig operation. |
|
Back to top |
|
|
nenemsis5 n00b
Joined: 23 Oct 2007 Posts: 72
|
Posted: Tue May 06, 2014 11:34 am Post subject: |
|
|
test this . boot the linux kernel and exercute "grub2-mkconfig -o /boot/grub/grub.cfg". generating grub.cfg in chroot environment wont work. |
|
Back to top |
|
|
natrix Guru
Joined: 23 Aug 2013 Posts: 556
|
Posted: Tue May 06, 2014 10:44 pm Post subject: |
|
|
Solution:
Code: | #mount /boot
#emerge --ask sys-boot/os-prober
#grub2-mkconfig -o /boot/grub/grub.cfg
|
If the problem continue:
Code: | #mount /boot
#chmod -x /etc/grub.d/{20_linux_xen,30_os-prober,40_custom,41_custom}
#grub2-mkconfig -o /boot/grub/grub.cfg
|
And if you use uefi read it:
https://wiki.gentoo.org/wiki/UEFI_Dual_boot_with_Windows_7/8 |
|
Back to top |
|
|
ralf1 n00b
Joined: 29 Mar 2014 Posts: 7
|
Posted: Thu May 08, 2014 5:30 pm Post subject: |
|
|
nenemsis5 wrote: | ... generating grub.cfg in chroot environment wont work ... |
Well, that was what I did initially and it was successful:
1) Formatting the hard drive (including the NTFS partitions) with the Gentoo LiveCD.
2) Installing Windows 7.
3) Installing Gentoo with the LiveCD which includes: chroot, installing grub2, os-prober, ntfs3g and running grub2-mkconfig. |
|
Back to top |
|
|
ralf1 n00b
Joined: 29 Mar 2014 Posts: 7
|
Posted: Thu May 08, 2014 7:42 pm Post subject: |
|
|
I repeated some tests and the following did work:
- mount /boot
- emerge os-prober
- emerge ntfs3g -OR- enable NTFS support in the kernel
- run grub2-mkconfig -o /boot/grub/grub.cfg
It was not necessary to mount the Windows 7 partition |
|
Back to top |
|
|
nenemsis5 n00b
Joined: 23 Oct 2007 Posts: 72
|
Posted: Tue Jun 03, 2014 12:34 am Post subject: |
|
|
following step u should try: i did too and it works
1) formart disk
2) install win 7
3) install gentoo
4) reboot
5) grub2-mkconfig again so os-prober will find also win 7 |
|
Back to top |
|
|
ralf1 n00b
Joined: 29 Mar 2014 Posts: 7
|
Posted: Wed Jun 04, 2014 8:02 am Post subject: |
|
|
nenemsis5 wrote: | following step u should try: i did too and it works
1) formart disk
2) install win 7
3) install gentoo
4) reboot
5) grub2-mkconfig again so os-prober will find also win 7 |
That is what did not work in my case and why I opened this thread.
However this thread shows some workarounds to get grub2-mkconfig running again. |
|
Back to top |
|
|
|