GRUB went MIA after Windows 7 Installation [OpenSUSE 12.1)

Hi, I’m new.

After a routine install of Windows 7 (I have done things like this before) I inserted OpenSuse 12.1 netinstall CD and rebooted.

My disk configuration (by heart, according to fdisk -l if I remember correctly):

sda 900 GB NTFS Data partition (boot)
sdb 250 GB Linux/Swap partitions
sdc 250 GB Windows 7 partition (boot)

So I booted from CD and started “Rescue System”


Rescue> grub
grub> find /boot/grub/menu.lst
(hd1,1)
grub> root (hd1,1)
...
grub> setup (hd1)
...
grub>quit

Now in my experience (I had fixed GRUB on another PC with these commands less than a week ago) GRUB was supposed to be working again.

Windows started.

I decided to try again, but this time I was in a hurry… So instead of setup (hd1) I told it to use hd0. Guess what? Error 22.

After a little googling (Se7en has no fixmbr command) I was able to make Windows boot again with:

bootsect /nt60 ALL /mbr

(AFAIK this tells Windows to write again its boot code on every NTFS partition and then update the MBR)

Finally I got Seven running again, but I have no clue whatsoever on how to get GRUB back, since it is so kind to behave in a totally different way than it always used to.

What should I try next?

http://forums.opensuse.org/new-user-how-faq-read-only/unreviewed-how-faq/429971-re-install-grub-quickly-parted-magic.html#post2097786

You should install to hd0

setup (hd0)

I tried. It gave me a GRUB error 22. :\

Please let me see your fdisk info

fdisk -l

I suspect the boot flag is not in the correct place

Boot flag is on both NTFS partitions (see my first post).

I’ll dobule check right now and get back to you, anyway.

You need a boot flag on hd1,1

Are you sure the hd boot order hasn’t changed? Some people pull the power on hd’s when they reinstall windows or mess with the bootloader. If you do the boot order changes.

If you install Grub in the MBR of a hard disk , with setup(hd0), setup(hd1) etc, the bootflag is irrelevant.
Do you have 3 hard disks?

Yes, 3 phisical harddisk as I wrote in my first post.

@caf4926: before I mess everything up,
should I do this from Gparted?
Do I have to remove the boot flag on the other harddisks?
hd1,1 is sdb2 right?
After that on which disk should I give setup?

Karl, don’t you remember when I asked you to unset the bootflag on your sandbox computer and reboot? What happened then? :wink:

Yes you are correct
That was Fedora IIRC

@p_t_a
You carry this one, I have to go cook for the family
I’ll check in later

Please double check the boot order
@p_t_a
I hope will look after you for the time I am away

Back from BIOS!

  1. Hitachi (900GB) (DATA) (BOOT) sda

  2. Maxtor (250 GB) (LINUX) sdb

  3. Maxtor (250 GB) (WINDOWS) (BOOT) sdc

Boot device priority:

DVD-RW
Hitachi
USB

Before I installed Se7en, these values where the same
(I remember DATA was the BOOT disk because I had messed up with XP boot files and it took me 2 days to fix it)

There are two possibilities (for each disk):
Either there is a bootloader installed in the MBR (Grub or another one) and the bootflag becomes irrelevant.
Or it has a generic bootcode (like WIndows systems) and the partition which has the bootflag will be booted. Notice that this partition can in turn have a bootmanager (such as Grub) in its bootsector.

(hdX, 1) is indeed sdX2 in Legacy Grub notation (only). In Grub2 (used by Ubuntu and Fedora 16), (hdX, 1) is sdX1.
But you can not be sure that hd1 is sdb, because these kernel devices are generated at boot time and the order in which they appear may vary. You should not think in terms of sda, sdb, sdc.

Notice that it’s possible that the disk which is called “sda” during (any) Linux setup appears as “sdb” when you reboot. So it can sometimes get very confusing.

What is the expected result?

Now I am totally lost.

I do not even know where GRUB was installed in first place.

I’ll write down the whole life of this PC so maybe you can figure out where I should do what to GRUB.

  1. Formatted empty HD: sda (according to Gparted live) 900Gb NTFS, sdb (gparted) 250Gb Ext4; sdc (gparted) 250Gb NTFS
  2. Installed Windows XP 32 Bit on 250Gb NTFS
  3. Installed openSUSE from Net-install CD on 250Gb Ext4, default GRUB settings
  4. Deleted from 900Gb NTFS Windows startup files, bad idea
  5. Copied those files back in 900Gb Data, Windows would start again
  6. NOT SURE I DID
    ? FIXMBR and the re-install grub with setup (hd1)? 1. Installed Windows 7 64bit over Windows XP
  7. Tried grub root (hd1,1) setup(hd1). Windows, no GRUB
  8. Tried grub root (hd1,1) setup (hd0), Error 22, nothing started
  9. Fixed MBR with Windows 7 DVD, writing boot sector on every NTFS disk available, then overwriting MBR
  10. Checked where boot flag was: both NTFS disks
  11. Launched Gparted live to make sure disk order was as posted. It is (sda => Data, sdb => Linux, sdc => Windows)

After all this messing up, any idea how to save my HAL9000?

@simosito,
I asked what you want, not what you did.
Do you want to dual boot openSUSE and Windows? Is that the expected result?

And so you want to install Linux on what looks like your second hard disk now? Is that right?

  • And which OS does boot now?

Linux is already installed, I just want it to dual-boot like it used to.

Use Parted Magic or a Linux Live CD to get the contents of
/boot/grub/menu.lst

Lets see what it says

OK. Then all you have to do is to reinstall Grub if you booted from Grub in MBR before or reset the bootflag on the partition which had Grub in its bootsector (most likely your Linux root partitition if it’s a primary one or the extended partition if your root partition is a logical one).

I suggest you boot from a Linux live CD, open a root terminal and post the output of

fdisk -l

and the output of

findgrub 
  • if I can find the URL of the latest version of this script - since I never bookmark anyting. Give me 5 minutes.

OK, from a linux live CD, open a root terminal and download this file in /tmp.
I don’t know if wget is on the live CD. But if it is, it would be as easy as:

cd /tmp
wget  [noparse]http://www.unixversal.com/linux/openSUSE/findgrub-3.5.1.tgz[/noparse]

Otherwise use firefox.

Then extract the archive in /tmp (it contains only 2 files):

tar -xvzf findgrub-3.5.1.tgz

If you didn’t open a root terminal but a normal terminal, become root now:

 su -l 

Then type the following:


/tmp/findgrub
/tmp/findgrub -M

And post the output.

menu.lst


# Modified by YaST2. Last modification on dom dic 18 10:16:52 CET 2011
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# For the new kernel it try to figure out old parameters. In case we are not able to recognize it (e.g. change of flavor or strange install order ) it it use as fallback installation parameters from /etc/sysconfig/bootloader

default 0
timeout 8
gfxmenu (hd2,1)/boot/message

###Don't change this comment - YaST2 identifier: Original name: linux###
title openSUSE 12.1
    root (hd2,1)
    kernel /boot/vmlinuz-3.1.0-1.2-desktop root=/dev/disk/by-path/pci-0000:00:11.0-scsi-1:0:0:0-part2    resume=/dev/disk/by-path/pci-0000:00:11.0-scsi-1:0:0:0-part1 splash=silent quiet showopts vga=0x31a
    initrd /boot/initrd-3.1.0-1.2-desktop

###Don't change this comment - YaST2 identifier: Original name: windows 1###
title windows 1
    rootnoverify (hd0,0)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 12.1
    root (hd2,1)
    kernel /boot/vmlinuz-3.1.0-1.2-desktop root=/dev/disk/by-path/pci-0000:00:11.0-scsi-1:0:0:0-part2 showopts apm=off noresume nosmp maxcpus=0 edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset  x11failsafe vga=0x31a
    initrd /boot/initrd-3.1.0-1.2-desktop

fdisk -l


Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
58 heads, 56 sectors/track, 601454 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000b6a02

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048  1953523711   976760832    7  HPFS/NTFS/exFAT

Disk /dev/sdb: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000792b9

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     4208639     2103296   82  Linux swap / Solaris
/dev/sdb2         4208640   488396799   242094080   83  Linux

Disk /dev/sdc: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc2290fbc

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *        2048   488396799   244197376    7  HPFS/NTFS/exFAT

findgrub


Find Grub Version 3.5.1 - Written for openSUSE Forums

 - reading MBR on disk /dev/sda                       ...
 - searching partition /dev/sda1      (NTFS)          ... --> Windows7/Vista Loader found in /dev/sda1

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can add the following entry to /boot/grub/menu.lst :

###Don't change this comment - YaST2 identifier: Original name: WindowsBootLoader###
title Windows on /dev/sda1
    rootnoverify (hd0,0)
    chainloader +1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


 - reading MBR on disk /dev/sdb                       ...
 - skipping partition  /dev/sdb1      (swap)         
 - reading bootsector  /dev/sdb2      (LINUX)         ...

 - reading MBR on disk /dev/sdc                       ...
 - searching partition /dev/sdc1      (NTFS)          ...

********************************************************************************
WARNING: /boot/grub/device.map not found.
         Displayed BIOS device mapping may be incorrect!
********************************************************************************

findgrub -m


Find Grub Version 3.5.1 - Written for openSUSE Forums

--- DEVICE.MAP: sda is ata drive hd0
--- DEVICE.MAP: - /dev/sda
--- DEVICE.MAP: - /dev/disk/by-id/ata-Hitachi_HDS721010DLE630_MSE5215V0AKS1L
--- DEVICE.MAP: - /dev/disk/by-id/scsi-SATA_Hitachi_HDS7210_MSE5215V0AKS1L
--- DEVICE.MAP: - /dev/disk/by-id/wwn-0x5000cca37cc4ce51
--- DEVICE.MAP: - /dev/disk/by-path/pci-0000:00:11.0-scsi-0:0:0:0
--- DEVICE.MAP: => sda might be BIOS drive hd0
--- DEVICE.MAP:
--- DEVICE.MAP: sdb is ata drive hd1
--- DEVICE.MAP: - /dev/sdb
--- DEVICE.MAP: - /dev/disk/by-id/ata-MAXTOR_STM3250820AS_9QE2BXPD
--- DEVICE.MAP: - /dev/disk/by-id/scsi-SATA_MAXTOR_STM32508_9QE2BXPD
--- DEVICE.MAP: - /dev/disk/by-path/pci-0000:00:11.0-scsi-1:0:0:0
--- DEVICE.MAP: => sdb might be BIOS drive hd1
--- DEVICE.MAP:
--- DEVICE.MAP: sdc is ata drive hd2
--- DEVICE.MAP: - /dev/sdc
--- DEVICE.MAP: - /dev/disk/by-id/ata-MAXTOR_STM3250820AS_5QE3HKKH
--- DEVICE.MAP: - /dev/disk/by-id/scsi-SATA_MAXTOR_STM32508_5QE3HKKH
--- DEVICE.MAP: - /dev/disk/by-path/pci-0000:00:11.0-scsi-2:0:0:0
--- DEVICE.MAP: => sdc might be BIOS drive hd2
--- DEVICE.MAP:
********************************************************************************

 - reading MBR on disk /dev/sda                       ...
 - searching partition /dev/sda1      (NTFS)          ... --> Windows7/Vista Loader found in /dev/sda1

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can add the following entry to /boot/grub/menu.lst :

###Don't change this comment - YaST2 identifier: Original name: WindowsBootLoader###
title Windows on /dev/sda1
    rootnoverify (hd0,0)
    chainloader +1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


 - reading MBR on disk /dev/sdb                       ...
 - skipping partition  /dev/sdb1      (swap)         
 - reading bootsector  /dev/sdb2      (LINUX)         ...

 - reading MBR on disk /dev/sdc                       ...
 - searching partition /dev/sdc1      (NTFS)          ...

********************************************************************************
WARNING: /boot/grub/device.map not found.
         Displayed BIOS device mapping may be incorrect!
********************************************************************************

Did I forget something?