I installed opensuse in my laptop in which I already installed opensuse.
Now the grub shows first, on boot up. I want to set windows bootloader in front.
In order to do that, I did the following,
If grub shows fisrt, it can not come from sda8 (at least the one you see at start). It might have been installed in the extended partition (usually sda4). So you should either dd the bootsector of sd4 or install Grub in sda8 first and then dd its bootsector to file.
Because only the 4 primary partitions can boot directly: sda1, sda2, sda3 and sda4. So if you see the Grub menu at boot, the Grub bootloader has to be either in the MBR (first sector of the HD) or in the bootsector of one of these partitions. As Windows 7 most of the time already uses 3 primary partitions, I guessed that the Grub bootloader was installed in the 4th. one, the extended partition. From the partition table point of view, the extended partition is just another primary partition. Grub has two parts: stage1 and stage2. stage1 (the bootsector, 512 bytes) is installed in sda4 - I guess, in your case - and stage2, as you mentionned is installed in sda8. But using the bootsector of sda8 is not going to help you booting Linux … unless you install Grub stage1 in the bootsector of this partition, which is perfectly possible. You can install Grub stage1 in several locations.
To find out where Grub is installed you can use the script findgrub … James knows the link better than I do …
In order to start with grub, I set sda9’s flag as boot; see the figure cfdisk /dev/sda | Flickr - Photo Sharing!.
" To find out where Grub is installed you can use the script findgrub"
There is no such commad in my system. When I press findgrub, it show error saying command nnnot found.
by the way who is james? I’m new to this post.
Won’t there be any problem if there is two grub (the one already in sda4 and the one I’m going to install in sda8).
Setting the bootflag of a logical parition is useless. Doing that with cfdisk is even dangerous. You can put yourself in a ‘no boot’ situation. Please do not reboot now! Give me 5 minutes.
findgrub is a script I wrote. It is also part of updatgegrub. The easiest way to install it is to install updategrub, so it will be already in your path.
updategrub/findgrub installation is described here: updategrub for openSUSE Legacy Grub (not update-grub!)
Can you please post the output of fdisk -l to make sure that cfdisk didn’t remove the bootflag from your extended partition (usually it does that, unlike fdisk).
In any case, you have to set the bootflag either on your Windows partition (sda3) or on the extended one (sd4) if it contains Grub (which I assume) if you want to be able to boot anything … unless you have Grub in MBR (which I doubt). If you have a generic boot code and none of sda3 or sda4 has the bootflag, you are in trouble. According to the picture you posted, I assume that your Windows bootable partition is sda3.
For your information, the fact that cfdisk or fdisk allow you to set the bootflag on a logical partition doesn’t make such a partition bootable. So forget about that idea!
Yes win7 is in sda3.
Can I ask you something, I have a doubt about this.
The picture I posted was the initial stage of sda (i.e. before I editing it using cfdisk). In this the boot flag is set to sda9 (which is the root partition of opensuse).
According to you the boot flag must be set to sda1-sda4, but in my system it is in sda9; So how did my system boot till now?
So what do you think, there is a grub in my MBR? or the boot flag is in sda4 (which is not visible using cfdisk)
I changed the boot flag to sda3 using cfdisk, and reboot the system.
The system boot in windows loader (not grub), it shows two options,
windows
openSUSE
Here windows option works; but openSUSE option doesn’t work.
Since I already have an opensuse installation disk, I was able to repair it (load grub at first) by changing the boot flag back to sda9 using cfdisk from rescue mode. Now every thing back to normal, System starts with grub showing opensuse and win7 as option.
Since I had not succeeded to boot using windows loader, I decided start this post
So what I learned from this is that I can make partition bootable using cfdisk (please correct me if I’m wrong).
Not according to me, according to the 64 bytes space available for the partition table in MBR: 16 bytes for each primary partition, one of this byte being the bootflag which value is either 0x00 or 0x80.
The bootflag on sda9 is irrelevant.
The bootflag is in sda4. fdisk -l will show you that. In my previous post, I confused cfdisk and sfdisk. cfdisk works like fdisk: it sets the bootflag on a partition without unsetting it on the others. If you had used sfdisk on sda9, it would have made your computer unbootable.
I’m not familiar with rescue disk and repair programs. So I don’t know what they do. All I can tell you is that what made your computer boot Grub again was not setting the bootflag on sda9 but unsetting it from sda3, provided it was already set on sda4, or the rescue program set it in sda4 but you didn’t see it in cfdisk, or it installed Grub in MBR, in wich case all bootflags are irrelevant now.
May I suggest stopping playing with bootflags? And may I ask why you want to use the Windows bootmanager to boot Linux - which is perfectly possible btw if you give it a file containing a valid bootsector?
Long story short, one of my best friends has a laptop, in which he installed ubuntu and win7, booted with windows bootloader. I want to do the same
hope you understand the spirit.
Ok!
I stop playing with boot flag. Just one question remaining, see the flag of sda9 shows boot, NC. What is NC stands for?
I perfectly understand. I’m just happy that I don’t have such friends. lol!
Anyway, if that’s what you want, here’s how to do it:
[ul]
[li]Leave the bootflag on sda3
[/li][li]Boot Linux (somehow)
[/li][li]Install Grub stage1 on sda9, typing the following (text in red) in a root terminal:
[/li]
grub
grub> find /boot/grub/stage2
(hd0,8)
grub> root (hd0,8)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0,8)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0,8)"... failed (this is not fatal)
Running "embed /boot/grub/e2fs_stage1_5 (hd0,8)"... failed (this is not fatal)
Running "install /boot/grub/stage1 (hd0,8) /boot/grub/stage2 p /boot/grub/menu.lst "... succeeded
Done.
grub> quit
Notice that:
[LIST]
[li]The error messages are normal while installing Grub in a partition bootsector (there is no place to install stage1.5, so it skips it.)
[/li]li means sda9 in Legacy Grub syntax (and unlike in Ubuntu which uses Grub2, a completely different version of Grub ). Don’t get confused!
[/li][/ul]
[li] FInally write the bootsector of sda9 in a file
[/li]
dd if=/dev/sda9 of=/tmp/suse.bin bs=512 count=1
[li] and copy /tmp/suse.bin to your Windows drive in C: (which has to be mounted read/write of course)
[/li][/LIST]
I guess your Windows boot.ini is already correct. … but I haven’t done that for many years. The problem you had is that the bootsector you copied before didn’t contain the Grub bootloader (and it was the one of your swap partition anyway.)