How to add Windows to grub 2? Topic is solved

Need help with your Linux distro? All questions are good - not all answers are -but we try

Moderator: jkerr82508

User avatar
dedanna1029
Sound-Berserk
Posts: 8780
Joined: 14 Mar 2010, 20:29
Contact:

How to add Windows to grub 2?

Postby dedanna1029 » 07 Oct 2015, 00:20

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!
I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
No gods, no masters.
"A druid is by nature anarchistic, that is, submits to no one."
http://uk.druidcollege.org/faqs.html

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: How to add Windows to grub 2?

Postby viking60 » 07 Oct 2015, 10:25

1) check your HD

Code: Select all

fdisk -l


This will tell you where your Windows install is

2) create the 15_Windows file in /etc/grub.d

Code: Select all

 #! /bin/sh -e
echo "Adding Windows" >&2
cat < < EOF
menuentry "Windows" {
set root=(hd0,1)
chainloader +1
}
EOF


This 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

Code: Select all

chmod +x /etc/grub.d/15_Windows


4 Make it stick on every boot

Code: Select all

update-grub


PS if you have UEFI then this does not apply:
:A
https://wiki.mageia.org/en/Archive:_UEFI_how-to
https://ask.fedoraproject.org/en/questi ... -disabled/

Barry is the Mageia Grub guru +1
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
dedanna1029
Sound-Berserk
Posts: 8780
Joined: 14 Mar 2010, 20:29
Contact:

Re: How to add Windows to grub 2?

Postby dedanna1029 » 07 Oct 2015, 16:36

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?
I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
No gods, no masters.
"A druid is by nature anarchistic, that is, submits to no one."
http://uk.druidcollege.org/faqs.html

User avatar
dedanna1029
Sound-Berserk
Posts: 8780
Joined: 14 Mar 2010, 20:29
Contact:

Re: How to add Windows to grub 2?

Postby dedanna1029 » 07 Oct 2015, 17:18

I think I'll go ahead and follow your instructions anyway.

Update: This got it, thanks so much! :) :B

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?
I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
No gods, no masters.
"A druid is by nature anarchistic, that is, submits to no one."
http://uk.druidcollege.org/faqs.html

User avatar
dedanna1029
Sound-Berserk
Posts: 8780
Joined: 14 Mar 2010, 20:29
Contact:

Re: How to add Windows to grub 2?

Postby dedanna1029 » 07 Oct 2015, 21:00

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?
I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
No gods, no masters.
"A druid is by nature anarchistic, that is, submits to no one."
http://uk.druidcollege.org/faqs.html

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: How to add Windows to grub 2?

Postby viking60 » 07 Oct 2015, 21:06

Both are possible.
Using /etc/grub.d/40_custom is maybe tidier and gives better overview.
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
dedanna1029
Sound-Berserk
Posts: 8780
Joined: 14 Mar 2010, 20:29
Contact:

Re: How to add Windows to grub 2?

Postby dedanna1029 » 07 Oct 2015, 21:17

So, can I still run update-grub from the grub rescue prompt?
I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
No gods, no masters.
"A druid is by nature anarchistic, that is, submits to no one."
http://uk.druidcollege.org/faqs.html

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: How to add Windows to grub 2?

Postby viking60 » 07 Oct 2015, 21:25

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 +1
Image
If you have the small MultiCD then Rescatux can fix it too.
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
dedanna1029
Sound-Berserk
Posts: 8780
Joined: 14 Mar 2010, 20:29
Contact:

Re: How to add Windows to grub 2?

Postby dedanna1029 » 07 Oct 2015, 21:48

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!
I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
No gods, no masters.
"A druid is by nature anarchistic, that is, submits to no one."
http://uk.druidcollege.org/faqs.html

User avatar
dedanna1029
Sound-Berserk
Posts: 8780
Joined: 14 Mar 2010, 20:29
Contact:

Re: How to add Windows to grub 2?

Postby dedanna1029 » 07 Oct 2015, 22:09

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.
I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
No gods, no masters.
"A druid is by nature anarchistic, that is, submits to no one."
http://uk.druidcollege.org/faqs.html

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: How to add Windows to grub 2?

Postby viking60 » 07 Oct 2015, 22:34

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
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
dedanna1029
Sound-Berserk
Posts: 8780
Joined: 14 Mar 2010, 20:29
Contact:

Re: How to add Windows to grub 2?

Postby dedanna1029 » 08 Oct 2015, 01:09

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... :idea: :!:

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...

Image

I'm done for today, and disgusted. I'm not going any further until tomorrow or the next day.
I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
No gods, no masters.
"A druid is by nature anarchistic, that is, submits to no one."
http://uk.druidcollege.org/faqs.html


Return to “Help”