Linux Messed Up Grub2 after reinstalling Win 7

MaRKiV

Adept
May 17, 2007
288
15
82
A bit of a background, i hv been dual booting Win Xp and Ubuntu 9.04, then upgraded to Karmic. Later did a upgrade to Win 7. All the while I was able to dual and triple boot without any issues.

Recently, I had a bit of a problem with windows 7 and to reinstall it, after that as expected Grub2 was lost and I recovered Karmic via live cd as in


But now i get 2 entries for Win 7 entry

ubuntu@ubuntu:~$ sudo os-prober
/dev/sda1:Windows 7 (loader):Windows:chain
/dev/sdb1:Ubuntu karmic (development branch) (9.10):Ubuntu:linux
/dev/sdb4:Windows 7 (loader):Windows1:chain

the second entry for Win 7 is wrong. I have only one Win 7 in sda1 and karmic in sdb1.

Here is my Fdisk output.
ubuntu@ubuntu:~$ sudo fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x4a634a62

Device Boot Start End Blocks Id System
/dev/sda1 * 1 3916 31455238+ 7 HPFS/NTFS
/dev/sda2 3917 60800 456920730 f W95 Ext'd (LBA)
/dev/sda3 60801 60801 7168 7 HPFS/NTFS
/dev/sda5 3917 10443 52428096 7 HPFS/NTFS
/dev/sda6 10444 23191 102398278+ 7 HPFS/NTFS
/dev/sda7 23192 35939 102398278+ 7 HPFS/NTFS
/dev/sda8 35940 48687 102398278+ 7 HPFS/NTFS
/dev/sda9 48688 60800 97297641 7 HPFS/NTFS

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x7218f129

Device Boot Start End Blocks Id System
/dev/sdb1 1 1911 15350076 83 Linux
/dev/sdb2 1912 3661 14056875 83 Linux
/dev/sdb3 3662 3792 1052257+ 82 Linux swap / Solaris
/dev/sdb4 * 3793 19457 125829112+ 7 HPFS/NTFS

Disk /dev/sdc: 40.1 GB, 40060403712 bytes
255 heads, 63 sectors/track, 4870 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0c250c24

Device Boot Start End Blocks Id System
/dev/sdc1 1 4870 39118243+ 7 HPFS/NTFS

How do i remove the sdb4 entry from the list?

I hv tried the following nothing helps

$ sudo apt-get install --reinstall libdebian-installer4
$ sudo os-prober
$ sudo update-grub

Please help...
TIA
 

vishalrao

Global Moral Police
Skilled
Nov 10, 2007
5,380
1,693
302
Pune, India
Yea grub2 is new stuff causing a little annoyances... can you read online grub2 tutorials... for example, you can simply disable os-prober entries altogether and simply manually add the win7 entry...

the files reside somewhree in /etc/grub.d/default somewhere... just read the online guides anyway to get a general familiarity with grub2 so you can handle grub2 issues easier... :)

See:

GRUB 2 bootloader - Full tutorial

https://wiki.ubuntu.com/Grub2

So you would disable 30_os-prober script and enable 40_custom script (enable/disable executable flat with chmod +x or chmod -x) as you will read in the guides...