How to restore my debian's grub after installing Windows 7

Kernels & Hardware, configuring network, installing services

How to restore my debian's grub after installing Windows 7

Postby tomsawyer » 2010-09-05 11:56

Hi,
I have installed Windows 7 on my laptop . Now, it directly boot from Windows 7 . I think the MBR overwrote my grub . I have found two methods by google , but still does work .
1: boot from debian install CD, Alt +F2 switch to the console. "grub " "root (hd0,0)" "setup (hd0,0)".
2:boot from CD, mount /dev/scsi/host0/bus0/target0/lun0/part1 /mnt ; chroot /mnt ; grub-install /dev/sda.
I wonder if someone can help me , thanks very much.
tomsawyer
 
Posts: 4
Joined: 2010-05-21 00:44

Re: How to restore my debian's grub after installing Windows 7

Postby TobiSGD » 2010-09-05 12:24

Boot from your installer disk, in the bootloader-menu choose Advanced and System Rescue, answer the questions and choose Repair bootloader, done.
User avatar
TobiSGD
 
Posts: 826
Joined: 2010-05-08 22:27
Location: Hannover, Germany

Re: How to restore my debian's grub after installing Windows 7

Postby smallchange » 2010-09-05 12:43

I usually use SysrescueCD for this. It has an option that lets you boot right into your installation so you can fix it from within using
Code: Select all
grub-install /dev/sda
or
Code: Select all
aptitude reinstall grub
Just use the boot command "rescuecd root=/dev/sda1" or whatever your root is. It will even work with LVM Volumes, like "rescuecd root=/dev/mapper/my_root_volume".
smallchange
 
Posts: 1740
Joined: 2009-05-04 15:56

Re: How to restore my debian's grub after installing Windows 7

Postby AMLJ » 2010-09-07 08:39

Download Super Grub Disk from here, burn it to a CD, and then boot from that. It will fix the problem.
AMLJ**0-1-47
User avatar
AMLJ
 
Posts: 973
Joined: 2009-03-18 07:40
Location: Mierlo, Netherlands

Re: How to restore my debian's grub after installing Windows 7

Postby tomsawyer » 2010-09-07 09:48

smallchange wrote:I usually use SysrescueCD for this. It has an option that lets you boot right into your installation so you can fix it from within using
Code: Select all
grub-install /dev/sda
or
Code: Select all
aptitude reinstall grub
Just use the boot command "rescuecd root=/dev/sda1" or whatever your root is. It will even work with LVM Volumes, like "rescuecd root=/dev/mapper/my_root_volume".



thanks for your help . Its works.

However , there's still have one problem . that's is win7 keeps changing the boot flag! https://bbs.archlinux.org/viewtopic.php?id=88604

then , I reinstall my grub from my current /boot partition to MBR by doing as follows:
grub>root (hd0,0)
grub>setup (hd0)

when I reboot , I enter into grub bash line instead of boot menu.

I don't find menu.lst file in /boot/grub .

How could I fix it ?

by the way , I can only boot my system by inputing mass of command line such as kernel /vmlinuz-2.6......
tomsawyer
 
Posts: 4
Joined: 2010-05-21 00:44

Re: How to restore my debian's grub after installing Windows 7

Postby TobiSGD » 2010-09-07 10:52

If you use squeeze or sid, you will not have a menu.lst, because you they use grub 2. In this case boot in your system and do, as root,
Code: Select all
update-grub

If you use lenny, just create a menu.lst.
User avatar
TobiSGD
 
Posts: 826
Joined: 2010-05-08 22:27
Location: Hannover, Germany

Re: How to restore my debian's grub after installing Windows 7

Postby tomsawyer » 2010-09-08 04:56

TobiSGD wrote:If you use squeeze or sid, you will not have a menu.lst, because you they use grub 2. In this case boot in your system and do, as root,
Code: Select all
update-grub

If you use lenny, just create a menu.lst.


I do create a menu.lst in my /boot/grub

but after I installed it into MBR as follows:
grub>root (hd0,0)
grub>setup (hd0)

I reboot my laptop , it enter into grub bash console instead of grub menu .

I use find command to look for menu.lst
grub>find /boot/grub/menu.lst

there's no found file.

so , I don't know how to do with it . How to create menu.lst in grub.
tomsawyer
 
Posts: 4
Joined: 2010-05-21 00:44

Re: How to restore my debian's grub after installing Windows 7

Postby TobiSGD » 2010-09-08 08:17

In this case I would try to reinstall grub. Boot into your system and try this,as root:
Code: Select all
apt-get --purge remove grub
apt-get install grub


This should generate a valid menu.lst in /boot/grub.
User avatar
TobiSGD
 
Posts: 826
Joined: 2010-05-08 22:27
Location: Hannover, Germany


Return to System configuration

Who is online

Users browsing this forum: No registered users and 3 guests

fashionable