[SOLVED] Windows 7 Killed Grub

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
douglas.gray

[SOLVED] Windows 7 Killed Grub

Post by douglas.gray »

I just upgraded my Windows instance to Windows 7. Unfortunately, now my computer does not load GRUB to give me the choice to boot into Linux Mint. I'm relatively certain my Linux instance is still intact. How do I get GRUB to load without reinstalling Linux Mint?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Leppie

Re: Windows 7 Killed Grub

Post by Leppie »

depending on which partition you installed helena into, you should be able to restore grub booting off the mint livecd. once in helena running off the livecd, open a terminal and issue these commands:

Code: Select all

sudo mount /dev/sda5 /mnt
sudo grub-install --recheck --root-directory=/mnt /dev/sda
NOTES: - if you didn't install into sda5, change this part to correct partition.
- the second command installs to the mbr so no number after sda (it's not a typo)!
douglas.gray

Re: Windows 7 Killed Grub

Post by douglas.gray »

Thanks for the info. Have a new problem. I ran these commands, but I'm getting some kind of "BASH-like" shell prompt once GRUB loads. I'm not getting the menu. The cursor indicates that I'm operating within GRUB, but I have no ideas what commands to use to get GRUB to work. Any ideas?
Leppie

Re: Windows 7 Killed Grub

Post by Leppie »

is there no error message?

what is the output of the "set" (without the quotes) command?
douglas.gray

Re: Windows 7 Killed Grub

Post by douglas.gray »

No error message. Title at the top of the pages says "GNU GRUB version 1.97~beta4" Then there's a long statement in brackets that starts with "Minimal BASH-like line editing is supported..."

?=0
color_highlight=
color_normal=
pager=
prefix=(UUID=8cb66874b66860a6)/boot/grub
root=hd1,5

The root says hd1,5, because that's what I set it to. it's the partition that has my current Linux Mint instance on it.
Leppie

Re: Windows 7 Killed Grub

Post by Leppie »

douglas.gray wrote:prefix=(UUID=8cb66874b66860a6)/boot/grub
root=hd1,5
is your linux install on a fat32 partition?
douglas.gray

Re: Windows 7 Killed Grub

Post by douglas.gray »

It's ext2.
Leppie

Re: Windows 7 Killed Grub

Post by Leppie »

douglas.gray wrote:It's ext2.
then try the following, if the drive isn't located in /dev/sdb amend accordingly;

Code: Select all

set root=(hd1,5)
insmod ext2
insmod linux
linux /vmlinuz root=/dev/sdb5 ro
initrd /intrd.img
boot
but you actually may want to check the partition first:

Code: Select all

sudo fsck.ext2 -pf /dev/sdb5  ##amend if drive is not sdb
douglas.gray

Re: Windows 7 Killed Grub

Post by douglas.gray »

Boots into Linux. When I reboot, I'm back to the BASH Shell.
Leppie

Re: Windows 7 Killed Grub

Post by Leppie »

douglas.gray wrote:Boots into Linux. When I reboot, I'm back to the BASH Shell.
ok, boot into linux with the previous instructions. then issue the following commands:

Code: Select all

sudo grub-install --recheck /dev/sdb
sudo update-grub
douglas.gray

Re: Windows 7 Killed Grub

Post by douglas.gray »

Seemed to work fine. It saw Linux and it saw Windows 7. But when I rebooted, I got the BASH shell again. Windows is on sda. Could that have something to do with it?
Leppie

Re: Windows 7 Killed Grub

Post by Leppie »

douglas.gray wrote:Seemed to work fine. It saw Linux and it saw Windows 7. But when I rebooted, I got the BASH shell again. Windows is on sda. Could that have something to do with it?
no, that shouldn't make any difference.
could you post your device.map?

Code: Select all

cat /boot/grub/device.map
douglas.gray

Re: Windows 7 Killed Grub

Post by douglas.gray »

(hd0) /dev/sda
(hd1) /dev/sdb
Leppie

Re: Windows 7 Killed Grub

Post by Leppie »

this all seems to be ok.
could you please download and run the boot info script and post the generated RESULTS.txt?
douglas.gray

Re: Windows 7 Killed Grub

Post by douglas.gray »

Sorry for the paste. The forum doesn't accept .txt files.

============================= Boot Info Summary: ==============================

=> Grub 2 is installed in the MBR of /dev/sda and looks for
(UUID=8cb66874b66860a6)/boot/grub.
=> Grub 2 is installed in the MBR of /dev/sdb and looks on the same drive in
partition #5 for /boot/grub.
sda1: _________________________________________________________________________

File system: ntfs
Boot sector type: Windows Vista/7
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files/dirs: /bootmgr /Boot/bcd

sda2: _________________________________________________________________________

File system: ntfs
Boot sector type: Windows Vista/7
Boot sector info: No errors found in the Boot Parameter Block.
Operating System: Windows 7
Boot files/dirs: /bootmgr /Boot/BCD /Windows/System32/winload.exe
/IO.SYS /MSDOS.SYS

sdb1: _________________________________________________________________________

File system: ntfs
Boot sector type: Windows Vista/7
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files/dirs: /boot/grub/core.img

sdb2: _________________________________________________________________________

File system: Extended Partition
Boot sector type: -
Boot sector info:

sdb5: _________________________________________________________________________

File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Linux Mint 8 Helena - Main
Edition
Boot files/dirs: /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sdb6: _________________________________________________________________________

File system: swap
Boot sector type: -
Boot sector info:

sdb3: _________________________________________________________________________

File system: ntfs
Boot sector type: Windows Vista/7
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files/dirs:

=========================== Drive/Partition Info: =============================

Drive: sda ___________________ _____________________________________________________

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0xf9eb3a6c

Partition Boot Start End Size Id System

/dev/sda1 63 20,466,809 20,466,747 12 Compaq diagnostics
/dev/sda2 * 20,467,712 197,826,559 177,358,848 6 FAT16


Drive: sdb ___________________ _____________________________________________________

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x156e6419

Partition Boot Start End Size Id System

/dev/sdb1 63 155,241,864 155,241,802 7 HPFS/NTFS
/dev/sdb2 266,438,025 512,007,614 245,569,590 5 Extended
/dev/sdb5 266,438,088 391,214,879 124,776,792 83 Linux
/dev/sdb6 501,950,988 512,007,614 10,056,627 82 Linux swap / Solaris
/dev/sdb3 512,008,192 655,368,191 143,360,000 7 HPFS/NTFS


blkid -c /dev/null: ____________________________________________________________

Device UUID TYPE LABEL

/dev/sda1 74B8A9C3E49BED2A ntfs PQSERVICE
/dev/sda2 DCDC98A0DC98768C ntfs ACER
/dev/sdb1 8CB66874B66860A6 ntfs UserData
/dev/sdb3 3E4C9C024C9BB35F ntfs Applications
/dev/sdb5 a246479d-fbcf-4c5e-afa3-5fc34341732e ext4
/dev/sdb6 4aebb9de-9d18-4570-8bb4-5f016759766d swap

============================ "mount | grep ^/dev output: ===========================

Device Mount_Point Type Options

/dev/sdb5 / ext4 (rw,errors=remount-ro)
/dev/sdb1 /media/UserData fuseblk (rw,nosuid,nodev,allow_other,default_permissions,blksize=4096)
/dev/sda2 /media/ACER fuseblk (rw,nosuid,nodev,allow_other,default_permissions,blksize=4096)


=================== sdb1: Location of files loaded by Grub: ===================


.0GB: boot/grub/core.img

=========================== sdb5/boot/grub/grub.cfg: ===========================

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s /boot/grub/grubenv ]; then
have_grubenv=true
load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
saved_entry=${prev_saved_entry}
save_env saved_entry
prev_saved_entry=
save_env prev_saved_entry
fi
insmod ext2
set root=(hd1,5)
search --no-floppy --fs-uuid --set a246479d-fbcf-4c5e-afa3-5fc34341732e
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
insmod gfxterm
insmod vbe
if terminal_output gfxterm ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_output
terminal gfxterm
fi
fi
if [ ${recordfail} = 1 ]; then
set timeout=-1
else
set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/white
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/06_mint_theme ###
insmod ext2
set root=(hd1,5)
search --no-floppy --fs-uuid --set a246479d-fbcf-4c5e-afa3-5fc34341732e
insmod png
if background_image /boot/grub/linuxmint.png ; then
set color_normal=white/black
set color_highlight=white/light-gray
else
set menu_color_normal=white/black
set menu_color_highlight=white/light-gray
fi
### END /etc/grub.d/06_mint_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Linux Mint 8 Helena, linux 2.6.31-14-generic (/dev/sdb5)" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
set quiet=1
insmod ext2
set root=(hd1,5)
search --no-floppy --fs-uuid --set a246479d-fbcf-4c5e-afa3-5fc34341732e
linux /boot/vmlinuz-2.6.31-14-generic root=UUID=a246479d-fbcf-4c5e-afa3-5fc34341732e ro quiet splash
initrd /boot/initrd.img-2.6.31-14-generic
}
menuentry "Linux Mint 8 Helena, linux 2.6.31-14-generic (recovery mode)" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
insmod ext2
set root=(hd1,5)
search --no-floppy --fs-uuid --set a246479d-fbcf-4c5e-afa3-5fc34341732e
linux /boot/vmlinuz-2.6.31-14-generic root=UUID=a246479d-fbcf-4c5e-afa3-5fc34341732e ro single
initrd /boot/initrd.img-2.6.31-14-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows Vista (loader) (on /dev/sda1)" {
insmod ntfs
set root=(hd0,1)
search --no-floppy --fs-uuid --set 74b8a9c3e49bed2a
chainloader +1
}
menuentry "Windows 7 (loader) (on /dev/sda2)" {
insmod ntfs
set root=(hd0,2)
search --no-floppy --fs-uuid --set dcdc98a0dc98768c
chainloader +1
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

=============================== sdb5/etc/fstab: ===============================

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# / was on /dev/sdb5 during installation
UUID=a246479d-fbcf-4c5e-afa3-5fc34341732e / ext4 errors=remount-ro 0 1
# swap was on /dev/sdb6 during installation
UUID=4aebb9de-9d18-4570-8bb4-5f016759766d none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
Leppie

Re: Windows 7 Killed Grub

Post by Leppie »

don't worry bout the paste ;)

there are 2 possibilities now:
1. restore the mbr of sda to defaults and keep the grub2 in the mbr of sdb. changing the boot order in your pc's bios will allow for booting all os's using grub2.
2. re-install grub2 to the mbr of sda1

the advantage of method 2 is that it's quicker (and easier).
the advantage of method 1 is that if one of the disks is ever taken out ot this system, the remaining os will still be bootable without any further intervention.
douglas.gray

Re: Windows 7 Killed Grub

Post by douglas.gray »

I'm thinking the easier at this point. I figure I can go back and do the other at a later date.
Leppie

Re: Windows 7 Killed Grub

Post by Leppie »

then boot into mint with the instructions provided earlier. then in a terminal issue the following command:

Code: Select all

sudo grub-install --recheck /dev/sda
alternatively, booting off a livecd, issue the following commands in a terminal:

Code: Select all

sudo mount /dev/sdb5 /mnt
sudo grub-install --recheck --root-directory=/mnt /dev/sda
douglas.gray

Re: Windows 7 Killed Grub

Post by douglas.gray »

WORKED! Thanks for all of your help!!!
Locked

Return to “Beginner Questions”