Adding Windows to Grub

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read this

Adding Windows to Grub

Postby edes on 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.
edes
Level 1
Level 1
 
Posts: 4
Joined: Mon Oct 18, 2010 9:10 pm

Linux Mint is funded by ads and donations.
 

Re: Adding Windows to Grub

Postby caf4926 on 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 16 Cinnamon_64
User avatar
caf4926
Level 7
Level 7
 
Posts: 1784
Joined: Mon Mar 22, 2010 3:21 pm
Location: UK Lake District

Re: Adding Windows to Grub

Postby edes on 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?
edes
Level 1
Level 1
 
Posts: 4
Joined: Mon Oct 18, 2010 9:10 pm

Re: Adding Windows to Grub

Postby libssd on 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.
libssd
Level 4
Level 4
 
Posts: 289
Joined: Tue Jun 22, 2010 11:26 am

Re: Adding Windows to Grub

Postby dawgdoc on 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 Dual-Boot: Mint 13 Gnome x32 PAE, LMDE
READING: The Autobiography of Benvenuto Cellini
User avatar
dawgdoc
Level 9
Level 9
 
Posts: 2690
Joined: Mon Oct 05, 2009 12:53 am
Location: Kentucky, USA the land of Mint Juleps

Re: Adding Windows to Grub

Postby cwsnyder on 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, LM16 Mate 64-bit
Debian Xfce 64-bit, Xubuntu 13.10 64-bit, Xubuntu Trusty Tahr 64-bit, Antergos Xfce 64-bit, PCLinuxOS LXDE 64-bit
cwsnyder
Level 6
Level 6
 
Posts: 1039
Joined: Wed Oct 20, 2010 6:49 am
Location: Nappanee, IN, USA

Re: Adding Windows to Grub

Postby euthypro on 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
euthypro
Level 3
Level 3
 
Posts: 105
Joined: Wed Jan 17, 2007 12:10 pm
Location: Dumaguete, Philippines

Re: Adding Windows to Grub

Postby caf4926 on 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 16 Cinnamon_64
User avatar
caf4926
Level 7
Level 7
 
Posts: 1784
Joined: Mon Mar 22, 2010 3:21 pm
Location: UK Lake District

Re: Adding Windows to Grub

Postby oobetimer on 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
User avatar
oobetimer
Level 7
Level 7
 
Posts: 1889
Joined: Tue Jun 01, 2010 12:53 pm
Location: Finland / above the Arctic Circle

Re: Adding Windows to Grub

Postby cwsnyder on 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, LM16 Mate 64-bit
Debian Xfce 64-bit, Xubuntu 13.10 64-bit, Xubuntu Trusty Tahr 64-bit, Antergos Xfce 64-bit, PCLinuxOS LXDE 64-bit
cwsnyder
Level 6
Level 6
 
Posts: 1039
Joined: Wed Oct 20, 2010 6:49 am
Location: Nappanee, IN, USA

Re: Adding Windows to Grub

Postby euthypro on 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
euthypro
Level 3
Level 3
 
Posts: 105
Joined: Wed Jan 17, 2007 12:10 pm
Location: Dumaguete, Philippines

Re: Adding Windows to Grub

Postby caf4926 on 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 16 Cinnamon_64
User avatar
caf4926
Level 7
Level 7
 
Posts: 1784
Joined: Mon Mar 22, 2010 3:21 pm
Location: UK Lake District

Re: Adding Windows to Grub

Postby breaker on 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/
breaker
Level 5
Level 5
 
Posts: 613
Joined: Sun Mar 16, 2008 5:28 am

Re: Adding Windows to Grub

Postby cwsnyder on 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, LM16 Mate 64-bit
Debian Xfce 64-bit, Xubuntu 13.10 64-bit, Xubuntu Trusty Tahr 64-bit, Antergos Xfce 64-bit, PCLinuxOS LXDE 64-bit
cwsnyder
Level 6
Level 6
 
Posts: 1039
Joined: Wed Oct 20, 2010 6:49 am
Location: Nappanee, IN, USA

Linux Mint is funded by ads and donations.
 

Return to Installation & Boot

Who is online

Users browsing this forum: No registered users and 9 guests