After reinstalling windows...(reinstalling openSuse's boot loader)

Hi.
I’m new of this forum and of openSuse.
Recently, I have had to reinstall openSuse from scratch (I’m sorry if I don’t speak english very well…) because I installed, after it, Haiku with his bootloader, and I didn’t find other ways for have openSuse’s bootloader back.

Now I’m going to re-install windows (I have to update it from 32-bit to 64-bit version), but I wouldn’t have the same troubles I have had few days ago…(I’ve lost 1.5 days of my life looking for a solution for re-install openSuse’s bootloader), neither I would like to have to re-install openSuse from scratch.

Could you tell me what should I do, please?

Thank you very much

Alessandro

How is the boot loader installed (in opensuse).

Typical places are MBR, “/” (the root partition), “/boot” (if that is a separate partition) or the external partition.

If you don’t remember, then you can use Yast Bootloader. The screen should tell you which booting software (probably grub2 or grub2-efi) and from where you boot. Make a note of that, then click the cancel button because you don’t want to reinstall at this moment.

Then tell us what you learned about your boot setup. We can give better advice when we know what you are doing.

Thank you for the reply

It’s installed in the extended partition and it’s GRUB2.
I upload a GParted screenshot, wishing it’s useful.

http://appinginf.altervista.org/prova/schermata6.png

I’ve just noticed that if you boot from openSuse dvd, there is the “system rescue” option.
I’ve tried to select it, but after loading it open a command line prompt and ask to login, but my credentials don’t work. confused.

Ok Did you install Haiku after you installed openSUSE?? It is unclear.

If so what ever boot loader Haiku uses must have over written the grub code. Looks like you are using old BIOS and not EFI booting. With you layout you had two way that grub could be installed.

  1. grub boot in the MBR
  2. grub boot in extended with generic in mbr and a boot flag set on extended

we have no idea what Haiku has done or uses

You’re right, probably i was unclear.

yes

exactly

It should be the second (I’m SURE GRUB2 is installed in extended. Here is a screenshot:

http://appinginf.altervista.org/prova/schermata7.png

Haiku installed his bootloader, that wasn’t able to launch openSuse.

But the problem is not this one:
As I told before, I solved the problems caused by Haiku re-installing openSuse.

The problem, now, is that I want to re-install windows, and I fear I will be forced to re-install openSuse, because Windows don’t let you choose which OS to boot.

You can just reinstall grub but you must do it from a live or repair DVD. It may require using chroot to pretend you are running code from the disk on the DVD.
But If you installed openSUSE using generic boot code, installing grub to extended and setting the boot flag then installing Windows only requires resetting the boot flag to the extended partition in your case. Assuming you used the same partitioning as you showed. If not we need to see what you actually have since that can change things.

Not very helpful. A screen shot of the Yast bootloader screen would have been better.

I’ll take your word for it that grub is on the extended partition.

Here’s what you can do:

  1. Make a copy of that boot partition
# dd if=/dev/sda2 of=bootsect count=1
  1. Make a note of where you saved that “bootsect” file. Perhaps the root directory would be a good place (so make it “/bootsect” in place of the “bootsect”.
  2. Possibly copy that boot sector to a USB flash drive for extra safety.
  3. Install Windows.
  4. Restore the booting. More details below. The Windows install is sure to have messed it up.

To restore the boot setup:

Boot from your install media, and select the “system rescue” option. When given a login prompt, type “root” (without the quotes). No password is required.

Mount your root partition


# mount /dev/sda5 /mnt

Check that you can find that “bootsect” file


ls -l /mnt/bootsect

Next, restort the boot sector to the extended partition


# dd if=/mnt/bootsect of=/dev/sda2 bs=440 count=1

Next, you will have to set the extended partition as the active partition.


# fdisk /dev/sda
p

That should show the partition table. One of the partitions – I’m guessing that it will be “/dev/sda3” will be marked as active (a “*” on that line).

continuing in your fdisk session


a
3
a
2

That’s what you type in. “fdisk” will ask which partition. The “3” in the second of those lines should be changed to whichever partition shows as active (the earlier line with “*”). This removes the active flag from that partition. The “2” in the fourth line marks the extended partition as active.

Continue with


w

which tells fdisk to save the changes.

The reboot. That should take you straight into opensuse. You probably cannot get into Windows at that stage. But it’s easy to fix that once you are in opensuse.

Finally, in opensuse:


# grub2-mkconfig -o /boot/grub2/grub.cfg

That should regenerate the boot menu, and put Windows in that menu.

If this all fails, there are other rescue possibilities. Hopefully this will work, giving you a relatively easy recovery.

Yes, what I showed to you is the current situation (I’m still on openSuse).
So, you think that after installing windows, it could be sufficient to boot from a Gparted live cd and set the boot flag to the extended partition?

EDIT: I’m sorry, I didn’t see the last post. Now I’m going to read it.

](https://forums.opensuse.org/member.php/49759-nrickert)@nrickert](https://forums.opensuse.org/member.php/49759-nrickert), your guide scares me…xD

but I’ll give a try!

I’ll let you know what will happen!

thank you very much!

ok, I’m stupid: after printing nrickert’s post, I said: “ok, let’s try!” and I’ve installed Windows…without saving the extented partition! :frowning:

However, once Windows took control of my computer, I booted from openSuse DVD (USB drive, actually) and choose “install”. After that, it let me choose between install or update.

I choosed update and…it reinstalled also the boot loader!

So now all works fine!

I’m sorry for causing you guys to lose some of your time…hopefully this thread will be useful for someone…

Thanks of all…

Alessandro

At least you have it working again.

I’m sure that took a lot more of your time than it did of my time.

ok, then I think an admin could mark this thread as [SOLVED], right?

Threads are not marked as solved. Not all solutions fit all users. Just (as you have already done here) say in a post that you have solved it and how you did that, for the benefit of others who read the post.

… and, as reference to your apology for wasting time, most of us do not see it that way. We are here because we enjoy helping solve these things, so we do not feel we are wasting time at all (except for those, of course, who keep asking the same question over and over again but refuse to give us the information requested or try the solutions we suggest).

Welcome aboard, and I hope you enjoy openSUSE as much as we do.

Why not just reinstall to the same partition, but don’t format it and use the same user name. I’ve been doing it for years, my data is always there and openSuSE (GRUB) is in control of the boot process. :wink:

[http://paste.opensuse.org/43375180

[IMG]http://paste.opensuse.org/43375180](http://paste.opensuse.org/43375180)