Adding Windows to Grub

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
edes
Level 1
Level 1
Posts: 3
Joined: Mon Oct 18, 2010 9:10 pm

Adding Windows to Grub

Postby edes » Mon Oct 18, 2010 9:16 pm

I think I messed up somewhere in the installation of Linux Mint 10 and didn't choose dual boot. Is there any way I can make the Grub menu appear, and add Windows to it? Windows is still in the drive. I checked.

User avatar
caf4926
Level 7
Level 7
Posts: 1848
Joined: Mon Mar 22, 2010 3:21 pm
Location: UK Lake District

Re: Adding Windows to Grub

Postby caf4926 » Mon Oct 18, 2010 10:29 pm

Try this from the Linux terminal

Code: Select all

sudo update-grub
You can see from the output if it picks it up, but if you can't, just reboot and see win is there
Image
Mint 18

edes
Level 1
Level 1
Posts: 3
Joined: Mon Oct 18, 2010 9:10 pm

Re: Adding Windows to Grub

Postby edes » Tue Oct 19, 2010 7:29 pm

Nope. This was the output:

$ sudo update-grub
[sudo] password for [user]:
Generating grub.cfg ...
Found Debian background: linuxmint.png
Found linux image: /boot/vmlinuz-2.6.35-22-generic
Found initrd image: /boot/initrd.img-2.6.35-22-generic
Found memtest86+ image: /boot/memtest86+.bin
done

Do I need to mount the partition before scanning? If so, how?

libssd
Level 4
Level 4
Posts: 289
Joined: Tue Jun 22, 2010 11:26 am

Re: Adding Windows to Grub

Postby libssd » Tue Oct 19, 2010 7:46 pm

Check this out: https://help.ubuntu.com/community/Grub2

I'm currently running Linux only, and too lazy to switch drives to see what the menuentry section is on my partitioned drive, but if someone else can provide a copy of the menuentry stanza for Windows, should may be able to add it manually.

User avatar
dawgdoc
Level 9
Level 9
Posts: 2720
Joined: Mon Oct 05, 2009 12:53 am
Location: Formerly of Kentucky, the land of Mint Juleps

Re: Adding Windows to Grub

Postby dawgdoc » Tue Oct 19, 2010 11:01 pm

Here is my menuentry for WinXP on a tri-boot system.

Code: Select all

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows XP Media Center Edition (on /dev/sda1)" {
   insmod ntfs
   set root='(hd0,1)'
   search --no-floppy --fs-uuid --set 6fb6826e16780179
   drivemap -s (hd0) ${root}
   chainloader +1
}

Check the Creating the Custom Menu section of the Grub2 tutorial which libssd posted to see how to use this.
check to see if the following are correct on your system
    /dev/sda1
    '(hd0,1)'
    6fb6826e16780179
the uuid # is bound to be different, that one is for my WinXP partition, you can check it with this terminal command

Code: Select all

blkid

You should not edit grub.cfg these tutorials tell you which files to edit to change grub.cfg
Also see THIS about the specific file 30_os-prober to accomplish what you want. The instructions are in section 3.
Image

SYSTEM: Compaq Presario CQ62 -- Mint 17 Cinnamon
READING: Little Brother by Cory Doctorow

cwsnyder
Level 6
Level 6
Posts: 1242
Joined: Wed Oct 20, 2010 6:49 am
Location: Nappanee, IN, USA

Re: Adding Windows to Grub

Postby cwsnyder » Wed Oct 20, 2010 7:14 am

Also be aware if your Windows is Vista or 7, they use a Vista loader partition which they expect to find next to the MBR, and that is not compatible with GRUB 1.x or GRUB 2. Windows won't boot without it, and GRUB will be trashed, likely on your first Windows update, if you try to use GRUB to replace it.

Windows XP will work with GRUB, just not later versions. :evil:
LMDE Mate 64-bit, LM17.3 Cinnamon 64-bit
Debian Mate 64-bit, Xubuntu xenial 64-bit, Ubuntu-Mate 14.04 64-bit, Antergos Xfce 64-bit, PCLinuxOS Mate 64-bit

User avatar
euthypro
Level 3
Level 3
Posts: 104
Joined: Wed Jan 17, 2007 12:10 pm
Location: Dumaguete, Philippines

Re: Adding Windows to Grub

Postby euthypro » Wed Oct 20, 2010 9:17 am

@cwsnyder,

Can you explain what you mean a little better? I dual-boot Linux and Windows 7 on two laptops, and I have no problems with Grub 2. Grub 2 is installed to the MBR, and no need to touch the small WIndows 7 system partition or replace it with Grub.

Angel

User avatar
caf4926
Level 7
Level 7
Posts: 1848
Joined: Mon Mar 22, 2010 3:21 pm
Location: UK Lake District

Re: Adding Windows to Grub

Postby caf4926 » Thu Oct 21, 2010 1:22 am

edes wrote:I think I messed up somewhere in the installation of Linux Mint 10 and didn't choose dual boot. Is there any way I can make the Grub menu appear, and add Windows to it? Windows is still in the drive. I checked.


Perhaps you should post for us the result of:

Code: Select all

sudo fdisk -l



Just clear things up a little:
Grub 2 and grub-legacy both work with win7/vista
Image
Mint 18

User avatar
oobetimer
Level 7
Level 7
Posts: 1880
Joined: Tue Jun 01, 2010 12:53 pm
Location: Finland / above the Arctic Circle
Contact:

Re: Adding Windows to Grub

Postby oobetimer » Thu Oct 21, 2010 3:11 am

edes wrote:I think I messed up somewhere in the installation of Linux Mint 10 and didn't choose dual boot. Is there any way I can make the Grub menu appear, and add Windows to it? Windows is still in the drive. I checked.


Terminal commands

sudo os-prober

sudo update-grub

cwsnyder
Level 6
Level 6
Posts: 1242
Joined: Wed Oct 20, 2010 6:49 am
Location: Nappanee, IN, USA

Re: Adding Windows to Grub

Postby cwsnyder » Thu Oct 21, 2010 7:30 am

Maybe they have fixed GRUB since I used it last, but with Windows XP or the Windows Vista boot loader, GRUB normally installs in the MBR and (if installed correctly) points to the Windows installation.

My Windows XP install (not OEM, an eMachines restore disk installation) has failed to boot after a Windows update because it no longer the first partition, and doesn't 'own' the MBR. Any 'fix' required either Windows re-installation, which overwrote GRUB, or Windows fixes which did the same.

I have had the same problems with Windows 7, which uses the Windows Vista boot loader.

I have actually given up on dual-booting on the same drive because of those problems and installed a second drive for my Linux installation, selecting either my Windows HDD or my Linux HDD from BIOS when I change systems. I got tired of fixing GRUB after a Windows re-install or a serious update. It does mean that my Windows drive is sdb when I boot into Linux, but it is the same sdb each time.

When I was actively using Windows in parallel with Linux, re-installing Windows was something I expected to have to do about once a year when something was corrupted to the point it would no longer boot.

The curious thing is that my Linux GRUB discovers and points to the boot partition of Windows 7 and can be selected to go to Windows 7. When I try to boot into Windows XP from Linux, it complains that XP is not the first boot disk and freezes up, requiring a reboot.

My system has been working this way since late 2008 with few problems, so I am unlikely to change the setup, having gone from Ubuntu 8.10, 9.04, 9.10, #! 9.04 (interim when I found out neither Ubuntu 10.04 nor 10.10 live disks would work on my system without rework which I don't have the time or resources to fix), to Linux Mint Debian now. I actually quad-boot with Windows XP/7 on a 200G PATA and a 500G SATA with my primary Linux partitions (for daily use and experimentation) and Debian Lenny as my secondary (stable and recovery install). All on one eMachines T5212 Intel Pentium D805 processor, 2G RAM. nVidia 6200 video, system.
LMDE Mate 64-bit, LM17.3 Cinnamon 64-bit
Debian Mate 64-bit, Xubuntu xenial 64-bit, Ubuntu-Mate 14.04 64-bit, Antergos Xfce 64-bit, PCLinuxOS Mate 64-bit

User avatar
euthypro
Level 3
Level 3
Posts: 104
Joined: Wed Jan 17, 2007 12:10 pm
Location: Dumaguete, Philippines

Re: Adding Windows to Grub

Postby euthypro » Thu Oct 21, 2010 9:25 am

I've read about certain WIndows 7 apps, especially recovery tools by the PC makers, (like Dell DataSafe) either trying to restore the MBR or writing to a section which will trash Grub. Some info here:

http://www.pctechs.org/?p=34264

With XP, I've had no problems. I still have the original OEM install of XP running on this laptop after 4 years. I have gone from Mint 2 to Mint 9, resized partitions a couple of times, and XP keeps soldiering on, running like new. (Here's where I knock on wood. :D ) I even have a free Vista upgrade, which I never installed. Didn't want to screw up a good thing. XP doesn't get much use anymore, but it's still there.

My experience with Windows 7 is much shorter, only about 3 months on my wife's laptops, so time will have to tell. So far dual-booting works flawlessly, letting Grub do the work. Since they are laptops, I can't do multiple hard drives, but I have taken note of alternatives, just in case.

Angel

User avatar
caf4926
Level 7
Level 7
Posts: 1848
Joined: Mon Mar 22, 2010 3:21 pm
Location: UK Lake District

Re: Adding Windows to Grub

Postby caf4926 » Thu Oct 21, 2010 10:58 pm

Only issues I have ever come across
1. as mentioned by @euthypro
2. Vista service pack updates couldn't install where grub exists (work around: restore mbr, install service pack, re-install grub)
Image
Mint 18

breaker
Level 5
Level 5
Posts: 609
Joined: Sun Mar 16, 2008 5:28 am

Re: Adding Windows to Grub

Postby breaker » Fri Oct 22, 2010 3:15 am

@edes If

Code: Select all

sudo fdisk -l
doesn't reveal anything, please download and run the Boot Info Script and post the body of the generated RESULTS.TXT into the body of a forum post (perhaps in code tags), which will provide us with detailed boot information.

How to use it: http://ubuntuforums.org/showthread.php?t=1291280 http://bootinfoscript.sourceforge.net/
Where to get it: http://sourceforge.net/projects/bootinfoscript/

Thanks
rtfm - read the fine manual...
Boot info script: http://ubuntuforums.org/showthread.php?t=1291280
grub2 https://help.ubuntu.com/community/Grub2
PC-BIOS based booting, mbr, boot records; http://thestarman.pcministry.com/

cwsnyder
Level 6
Level 6
Posts: 1242
Joined: Wed Oct 20, 2010 6:49 am
Location: Nappanee, IN, USA

Re: Adding Windows to Grub

Postby cwsnyder » Fri Oct 22, 2010 5:57 am

@euthypro
The comments to the article you linked to finally explained why I have been having problems from the beginning with my Windows XP install:
the manufacturer's (eMachines) restore disks use PC Angel software which writes to the same area GRUB uses. That is probably also why I couldn't use VMware's utility to convert my XP install to a virtual machine, which is why I still have an XP partition after using Linux for almost 3 years (I still have a Visioneer USB flatbed scanner which only works under XP).
LMDE Mate 64-bit, LM17.3 Cinnamon 64-bit
Debian Mate 64-bit, Xubuntu xenial 64-bit, Ubuntu-Mate 14.04 64-bit, Antergos Xfce 64-bit, PCLinuxOS Mate 64-bit

nmumbach
Level 1
Level 1
Posts: 3
Joined: Sat Jul 12, 2014 11:49 am

Re: Adding Windows to Grub

Postby nmumbach » Mon Feb 23, 2015 12:38 pm

Long Story ... maybe it will help someone else in similar situation. :)
-started with Win7pro, added WinXP, added LMDE about a year ago
-had problems with sluggish performance, even after a fresh wipe and re-load; MB diags passed, Memtest86 passed, WD Disk Diagnostics passed, EVENTUALLY. Slower than predicted.
-reformatted, tried installing Mint xfce rather than LMDE Cinnamon, for perhaps better VirtualBox and/or VmWare success or even WINE, which has never provided me with any Windows apps (I'm running mostly boring old DOS/Windows games, rather than modern RPGs that PlayOnLinux offers).
-install failed, disk problems. Replaced WD hard drive with new Hitachi, hopefully better reliability.
-installed Mint 17.1 with xfce, manual partitioning, intentionally over-sized.
/boot - 512MB ext2
/swap - 16GB swap
/root - 40GB ext4
/tmp - 20GB ext4
/var - 20GB ext4
/home - huge ext4
/winXP - 20GB ntfs
/win7 - 20GB ntfs
-Mint install succeeds and boots
-try to install WinXp and/or Win7, which fail despite the NTFS partitions... I apparently left no recognizable boot space for them.
-use gparted live to re-size and move /boot to the right, with 100MB empty space preceding, then format the 100MB space to FAT32
-try to load Win7, fails; try to load WinXP, succeeds; try Win7 again, succeeds. Do Win7 updates, mostly succeeds. Reboot.
-No Linux, No WinXP, auto boot into Win7. Run BootRepair acquired from SourceForge, reboot, find Linux Mint, no Windows.
-run BootRepair trying different options, no joy. Still only Linux Mint.
-Search for help on adding windows to grub on linux mint, found this thread.
-saw the suggestion to "sudo os-prober" and "sudo update-grub" posted by oobetimer, and tried it.
-BANG! success! :D Thank you oobetimer.

User avatar
karlchen
Level 16
Level 16
Posts: 6573
Joined: Sat Dec 31, 2011 7:21 am

Re: Adding Windows to Grub

Postby karlchen » Mon Feb 23, 2015 12:58 pm

<Moderator on>
Hello, nmumbach,
thank you very much for saying thank you to oobetimer. Yet, this thread had been resting in peace for more than 4 years. So in order to prevent its rest being disturbed once more, it will be locked now.
Cheers,
Karl
<Moderator /off>
Image


Return to “Installation & Boot”

Who is online

Users browsing this forum: No registered users and 16 guests