Page 1 of 2
How to add Windows to grub 2?
Posted: 07 Oct 2015, 00:20
by dedanna1029
I had to manually update the kernel in Mageia today; create a local source for updates so I could do it, and add it to local sources in MCC-->Configure sources.
Update I did, and it did install and add the new kernel to grub2; however in doing so, it dropped the Windows Boot Manager entry. I had to go to "Boot Menu" and tell BIOS to use the Windows Boot Manager to get back to Windows.
I'm on Windows 8.1. I kind of need that entry back but a brand spanking new to grub2, and have no clue how to re-add it.
Got a how-to?
Thanks!
Re: How to add Windows to grub 2?
Posted: 07 Oct 2015, 10:25
by viking60
1) check your HD
This will tell you where your Windows install is
2) create the
15_Windows file in
/etc/grub.dCode: Select all
#! /bin/sh -e
echo "Adding Windows" >&2
cat < < EOF
menuentry "Windows" {
set root=(hd0,1)
chainloader +1
}
EOFThis code has Windows on sda1 on the first partition. Since you only have one HD you have hd0 and if windows is on the first partition you will have it on hd0,1 if it is on the second partition you will have it on hd0,2 (hd0,1 is probably correct in your case so the script above should only be to copy and paste)
3)Save and chmod
4 Make it stick on every boot
PS if you have UEFI then this does not apply:
https://wiki.mageia.org/en/Archive:_UEFI_how-tohttps://ask.fedoraproject.org/en/questi ... -disabled/Barry is the Mageia Grub guru

Re: How to add Windows to grub 2?
Posted: 07 Oct 2015, 16:36
by dedanna1029
Thanks, yes, it's on UEFI with Secure Boot turned off. Oh, boy.
Edit: Y'know, I just thought of something. I'm going to be installing another Linux OS on the last third of this hard drive... it will want to take over the bootloader, correct? I can get into Windows via Shut down--->Novo button--->Boot menu--->Windows Boot Manager for now. Would this have a negative effect on the hard drive, the switching back and forth?
Re: How to add Windows to grub 2?
Posted: 07 Oct 2015, 17:18
by dedanna1029
I think I'll go ahead and follow your instructions anyway.
Update:
This got it, thanks so much!

My question now would be, why did it dump in the first place? Was it because I had to manually update the kernel, or when I did, since Mageia keeps the older kernel and makes a new entry in grub for it, did the new menu entry just replace the Windows one?
Re: How to add Windows to grub 2?
Posted: 07 Oct 2015, 21:00
by dedanna1029
Well, I thought I had it - I rebooted, saw the Windows option there.
I went ahead and booted into Mageia, and it went straight to "Welcome to grub2!" and then grub rescue.
I put in the Mageia disk, and told it to reinstall the bootloader. It couldn't because "target is busy."
I tried three times, same thing.
I can't get into Mageia now. I'm trying to install F23 now, and am having issues with it; it wants a separate /boot/efi partition which I can't create with the installer. I don't know what size it should be, anything. I'm wondering if it's because the Mageia bootloader is messed up? OR, damn, I didn't run update-grub after. I put the entry for Windows into /boot/grub2/custom.cfg. Should I have put it into /etc/grub.d/40_custom instead?
Re: How to add Windows to grub 2?
Posted: 07 Oct 2015, 21:06
by viking60
Both are possible.
Using /etc/grub.d/40_custom is maybe tidier and gives better overview.
Re: How to add Windows to grub 2?
Posted: 07 Oct 2015, 21:17
by dedanna1029
So, can I still run update-grub from the grub rescue prompt?
Re: How to add Windows to grub 2?
Posted: 07 Oct 2015, 21:25
by viking60
I am not sure about that one - I don't think so.
Time to use the Viking berserk rescue DVD - supergrup will find working OS's and rescue the day for you


If you have the small MultiCD then Rescatux can fix it too.
Re: How to add Windows to grub 2?
Posted: 07 Oct 2015, 21:48
by dedanna1029
Oh yeah! Why didn't I think of that? Because I panicked.
And to think I was just about to give up and reinstall.
I tried update-grub, it was a no-go. So was using the Mageia disk and telling it to upgrade, and install the bootloader to /dev/sda again.
When I went into that though, when it came to the partitioning, it did say it couldn't read the partition table because it was too corrupt.
I'm wondering if something deeper is going on here, but will try the rescue dvd anyway.
Thank you for the reminder!
Re: How to add Windows to grub 2?
Posted: 07 Oct 2015, 22:09
by dedanna1029
viking.iso:
How can I get to the tools menu? I can't boot to the dvd on usb, and Windows can't access it... or says it can't. It wants to format the usb stick.
I'm out of dvd disks to burn it to.
Re: How to add Windows to grub 2?
Posted: 07 Oct 2015, 22:34
by viking60
This might do it.
If access to the stick is via a UEFI-enabled computer with a Windows 7 (or higher) x64, the Bootloader can be copied and renamed to the stick. You can do this on the system partition under:
C:\Windows\Boot\EFI for the file bootmgfw.efi
Copy it to the stick in the \EFI\BOOT\ folder and rename this file BOOTX64.EFI (notice the reverse order of efi and boot)
The file bootmgfw.efi can also be extracted from a Windows 7 (or higher) x64 - DVD. It is located in the 2.7 GByte large archive Install.wim in the subdirectory \sources. The archive can be extracted with an archiving program. This file is located in the subdirectory "1" of the archive at 1\Windows\Boot\EFI\.
More
here
Re: How to add Windows to grub 2?
Posted: 08 Oct 2015, 01:09
by dedanna1029
OK, thanks.
I just reinstalled Mageia. Same issue when I upgraded the kernel via usb, and this occurred to me to be the problem.
When I installed it as an update, it removed btrfs-progs and os-prober...

My / partition is btrfs... os-prober is obviously needed... Said that they were in conflict with the new kernel-desktop.
Houston, I do believe I've run into
this.
Update: I've just reinstalled again with reiserfs for both / and /home. I try to update the kernel, and...

I'm done for today, and disgusted. I'm not going any further until tomorrow or the next day.