LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   installing grub in windows (https://www.linuxquestions.org/questions/linux-newbie-8/installing-grub-in-windows-756922/)

sumeet inani 09-22-2009 12:48 AM

installing grub in windows
 
Hi I am using windows XP.I wish to install GRUB bootloader so that I can modify menu.lst & add lines to boot from an ext2 partition having iso of linux distro.One way is to use live cd & try 'sudo grub-install <device>' but I don't have live cd.I came to know about open source software 'wingrub' but I am not able to understand how to use it even after reading http://grub4dos.sourceforge.net/wiki...s_tutorial.Can anybody tell me what should I do to install GRUB in mbr & have option to boot to c drive which has windows & another partition (/dev/sda2) which has linux.

TaylanUB 09-22-2009 03:06 AM

I don't know much on this stuff yet myself, but after having played around a bit with GRUB while trying to get an Arch installation to work, my `senses' are telling me that GRUB should be installable on any partition of your HDD, as long as it is formatted at all.
Although on a second thought, i actually have no real idea where it would keep all of its files, which are normally kept in /boot/grub in the Unix directory hierarchy. So my senses might be lying. =P

Anyway, i'll just re-direct you to GNU's official GRUB manual: gnu.org/software/grub/manual/grub.html
It includes a section on creating a GRUB boot floppy. And after that it should be easy.


Oh and, actually you don't really need a LIVE CD i think. Your distro installation CD should work just as well.
But i don't exactly know how.

This is how i once had to do it in my very first Linux days (less than a year ago):
1) Insert the CD and boot from it.
2) When you come to some kind of greeting screen or whatever (after booting is done) you should be able to access a command-line-interface (aka CLI) by pressing Ctrl+Alt+F1.
3) In the CLI, you have to enter the command `grub', and it will take you to the GRUB CLI.
4) There you have to `change' your `root' to where-ever your Linux is installed.
4.1) If you don't know already how GRUB sees your HDDs and their partitions, just type root ( and press TAB. You'll see the available HDDs. Let's say you chose root (hd0,. Press TAB again to see the partitions of that HDD. Then choose the correct one of those as well. For example you might now have root (hd0,0) which is the first partition of the first HDD. Or if you have two HDDs in your PC and the Linux is on a second partition of a USB stick, it might be root (hd2,1). (Remember they start with 0. So the 2 means the 3rd drive (the first two being the HDDs) and the 1 means second partition.)
5) Now after having entered the correct root, you have to enter setup (hd0). I think that hd0 there always has to be hd0, as it is now relative to the root you entered or something.


I hope that any of what i wrote will help.
And let me warn you: I take no responsibilities if you screw up anything, even if it's my fault! =P

AwesomeMachine 09-22-2009 03:35 AM

If Windows is installed, and you want to install linux, you boot from the linux CD, and it will install along side Windows, on a separate partition, using grub as the bootloader. You will end up with boot menu options for both Windows and linux.

If you installed linux, and then Windows, boot the linux CD, and choose 'rescue'. Different distros work differently in rescue mode, but you want to chroot to the linux installation and run grub-install or update-grub. Then you will have two boot menu options for Windows and linux.

TaylanUB 09-22-2009 04:12 AM

Quote:

Originally Posted by AwesomeMachine (Post 3692596)
If you installed linux, and then Windows, boot the linux CD, and choose 'rescue'. Different distros work differently in rescue mode, but you want to chroot to the linux installation and run grub-install or update-grub. Then you will have two boot menu options for Windows and linux.

From all i know, not all distros feature a rescue mode in their installation CDs.


By the way, i never thought of it really but how much is it possible to boot from an ISO in your HDD via GRUB anyway?

sumeet inani 09-30-2009 07:39 AM

If you want to try a distro(like livecd version or portable lightweight) without installing them then you can extract content of iso to a primary partition(ext2 or fat32 work fine) & add lines in grub about title,root,kernel & initrd.Details are on this link:http://www.linuxforu.com/teach-me/ti...t-from-an-iso/.Also I found out that you have to install win4grub(available from www.sourceforge.net) which creates menu.lst in c:\grub which you can edit through notepad.I like to distribute whatever little I know.
REMEMBER:During the above process no cd was needed at any instant.

TaylanUB 09-30-2009 08:47 AM

Thanks!
I didn't know you can use GRUB to boot an ISO on your HDD.
Saved me some potentially to-be-wasted CDs. :p


All times are GMT -5. The time now is 08:24 PM.