I'm trying to get Archlinux onto my friend's laptop which already has Windows installed, and I am confused about how to install GRUB using a /boot partition. I went to the Wiki to understand the steps better and I tried out what I understood.
I ended up with a functioning Arch installation with GRUB, but once I booted back into Windows and restarted, GRUB was gone: it kept booting back into Windows with no GRUB. I looked using cfdisk, and the bootable flag changed from /boot back to the Windows partition. I tried setting it again using cfdisk, but the same thing happened once I went into Windows and restarted.
I made the /boot partition 32MB (from the wiki) in size and formatted with ext3. The order of the partitions was as below:
/dev/sda1 Primary Windows
/dev/sda2 Primary /boot
/dev/sda3 Primary /
/dev/sda4 Logical /home
/dev/sda5 Logical swap
EDIT: after checking my own partition setup, i found the boot was 50MB in size. Why the discrepancy?
Last edited by LordRaiden (2008-02-15 05:44:56)
Allan is probably right, in this setup you'd probably want to install grub to MBR (that is achieved by running grub as root and then entering commands root (hd0,1) followed by setup (hd0)). Then it doesn't matter at all which partition will have the bootable flag set, the laptop should always boot into grub menu.
32mb for boot is quite enough (as long as you don't try out many (ie. >2) different kernels).
I was installing GRUB to /boot not the MBR, since my friend wants an intact Windows XP installation.
On another note, I put on both OpenSuse and Ubuntu (choosing to not install GRUB on the MBR) and this is not an issue i.e. cfdisk showed that the respective OpenSuse and Ubuntu partitions had the boot flag on (though not at the same time for the obvious reason) and the flag did not disappear after booting Windows. Moreover, after removing either distribution through formatting, Windows continued booting as normal. (It all seems a bit weird to me...)
If it is harmless to install GRUB onto the MBR, I'll do it; however, going by the search results on Google, it seems as if it either it is a problem or it used to be one.
Thanks for the quick replies.
I don't have much experience with having grub just on /boot partition: it should work the way you wanted. From your first post it seems that the problem is with windows, that it changes the boot flag on its partition (which is a surprise to me... but ... it's windows).
As far as having grub in MBR: it leaves the windows *partition* intact. The main difference from your wanted setup is that on *every* boot, grub shows up. That implies the following: the /boot partition needs to be there, with the files in /boot/grub present (since grub reads some files, menu.lst as one of them), and menu.lst needs to be sensible.
Is it safe? I never had any problem with it, and used this setup for some years on my previous laptop. Of course, if you blindly delete the /boot partition from windows, it will make your computer unbootable, since the part of the grub which is in MBR will hang on not being able to continue booting, since essential parts of grub are deleted. If you want to remove grub from MBR, boot into the windows CD, and run something like "fdisk /MBR" of "fixmbr" or such... google for it.
In my second post, I did say that I installed Ubuntu and OpenSuse using their GRUB and it works fine. To my knowledge, I made sure that neither Ubuntu and OpenSuse installed GRUB on the MBR, but maybe they did anyway. However, I did see that both distributions set the boot flag to their root partitions. I'm wondering if the boot flag is dynamically changed by the OS that boots, or even GRUB (probably not but it would be an explanation).
I think I'll try installing GRUB on the MBR. I'll have to wait for a few days, so I'm open to any other suggestions that anyone else might come up with.
What the standard MBR loader does (in my understanding) is that it looks at primary partitions, finds one which has 'bootable' flag on, and gives control to the boot part of that partition. If it's a windows partition, it just boots windows. If that partition has grub installed on it, the grub takes control from there.
I think grub does NOT change any flags on any partition, nor does any standard program on linux, except those which deal with partitioning (fdisk, cfdisk, parted, etc...) Don't know about windows... but from what you were saying it seems to me that windows change that bootable flag...
I think you should maybe once more try to set the bootable flag to the /boot partition (where your grub resides now), and try to boot it, and so on. Having arch installed there should be no different than having suse or whatever other linux.
What you describe is indeed *very* weird.
One thing which might be an issue is the filesystem: depending on what filesystem you use on the /boot partition, windows might think that it's an empty/unused/corrupted partition, and so they automatically "fix" the issue by setting the bootable flag to their own partition. Do you recall what filesystems did you use?
EDIT: Or another thought: did you use lilo with suse and ubuntu? Maybe windows doesn't recognize grub as something that could boot, but does recognize lilo. (I know you wrote that you used grub, but just to make sure...)
Last edited by bender02 (2008-02-15 17:12:08)
1) The filesystem for the Arch /boot partition was ext3.
2) I definitely used GRUB for both Ubuntu and Suse. To my knowledge, the only visual difference between the Arch GRUB and the Ubuntu and Suse GRUBs was the fact that the latter two do not have a boot partition (everything under / ). There might have a been a slight difference in the versions, but that should be all.
That leaves me completely baffled. I would be grateful if you would let me know where the problem was, if you figure it out.
I have this problem with Arch- after booting win XP, the /boot partition is no longer flagged bootable and the windows boot loader takes over.
However, last week I had the preview release of Fedora Core 9, and even though it put grub on the boot partition and not the MBR, windows would not steal the boot flag. Go figure.
From my experience it seems that the 'makeactive' command in /boot/grub/menu.lst is what causes the boot flag to be switched to the windows partition.