Differences between revisions 1 and 3 (spanning 2 versions)
Revision 1 as of 2005-05-06 14:56:58
Size: 973
Editor: anonymous
Comment:
Revision 3 as of 2007-07-21 16:27:02
Size: 2952
Editor: FranklinPiat
Comment: Updating procedure for Etch (using d-i)
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
## Auto-converted by kwiki2moinmoin v2005-10-07 #language en
Line 5: Line 5:
To recover grub you need a console from a live CD. For example, boot with Debian installation CD and hit crtl+alt+F2. Knoppix makes the work too. Then mount the Debian '' in the hard disk, change the mount point to be the new '' and exec grub-install. = Recover Debian/Etch =

== Standard procedure ==
The Debian Installer (DVD,netinst CD,floppy, netboot, etc.) can be used to rescue systems, for example if they fail to boot after an upgrade. You should '''read and follow the instruction''' "Recovering a Broken System" section of the Installation Guide[[FootNote(http://www.debian.org/releases/)]] (look for it in the index) [link to [http://www.debian.org/releases/stable/i386/ch08s07.html stable/i386]].

=== Troubleshooting : 'grub-install /dev/sda' failed. ===
If D-I's "Reinstall GRUB boot loader" option fails, with error message
'''{{{
Unable to install GRUB in /dev/sda
Executing 'grub-install /dev/sda' failed.
This is a fatal error.
}}}'''
Also, the d-i log console (Alt-F4) displays {{{grub-installer: /dev/scsi/host0/bus0/target0/lun0/disc does not have any corresponding BIOS Drive}}}
You can still use the following method to reinstall grub.
Choose "Execute a shell in ''Your root partition''" in the d-i rescue menu.

'''Locate your root partition''' :
{{{fdisk -l

Disk /dev/sda: 39.9 GB, 39996820992 bytes
255 heads, 63 sectors/track, 4862 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 111 891576 7 HPFS/NTFS
/dev/sda2 167 230 514080 82 Linux swap
/dev/sda3 231 784 4450005 83 Linux
/dev/sda4 785 4862 32756535 f W95 Ext'd (LBA)
/dev/sda5 785 4862 32756503+ 83 Linux
}}}
'''Reinstall grub bootloader ''' ~-([http://www.gnu.org/software/grub/manual/grub.html#Installation-under-UNIX grub manual])-~
{{{
grub
grub>root (hd0,3) //assuming your root partition is /dev/sda3
grub>setup (hd0)
grub>quit
exit
}}}
choose "Reboot the system", everything should be fine.


= Debian/Sarge and previous =

To recover grub Debian/sarge, Debian/woody.. you need a console from a live CD. For example, boot with Debian installation CD and hit ctrl+alt+F2. Other live CDs will also work, such as Knoppix. Then mount the Debian partition '' on the hard disk, change the mount point to be the new root'' and exec grub-install.
Line 18: Line 61:
May be you need to load the fs module manually before mounting, for example You may need to load the fs module manually before mounting, for example:

Recover Grub

Imagine for any reason you have any other crapy OS installed next to Debian. And for any reason you need to reinstall it because is really broken. Again, imagine this crappy OS has a crappy installation and overwrites the disk MBR to own the full computer. What's next? reinstall Debian? no

Recover Debian/Etch

Standard procedure

The Debian Installer (DVD,netinst CD,floppy, netboot, etc.) can be used to rescue systems, for example if they fail to boot after an upgrade. You should read and follow the instruction "Recovering a Broken System" section of the Installation Guide?FootNote(http://www.debian.org/releases/) (look for it in the index) [link to [http://www.debian.org/releases/stable/i386/ch08s07.html stable/i386]].

Troubleshooting : 'grub-install /dev/sda' failed.

If D-I's "Reinstall GRUB boot loader" option fails, with error message

Unable to install GRUB in /dev/sda
Executing 'grub-install /dev/sda' failed.
This is a fatal error.

Also, the d-i log console (Alt-F4) displays grub-installer: /dev/scsi/host0/bus0/target0/lun0/disc does not have any corresponding BIOS Drive You can still use the following method to reinstall grub. Choose "Execute a shell in Your root partition" in the d-i rescue menu.

Locate your root partition : {{{fdisk -l

Disk /dev/sda: 39.9 GB, 39996820992 bytes 255 heads, 63 sectors/track, 4862 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

  • Device Boot Start End Blocks Id System

/dev/sda1 * 1 111 891576 7 HPFS/NTFS /dev/sda2 167 230 514080 82 Linux swap /dev/sda3 231 784 4450005 83 Linux /dev/sda4 785 4862 32756535 f W95 Ext'd (LBA) /dev/sda5 785 4862 32756503+ 83 Linux }}} Reinstall grub bootloader ([http://www.gnu.org/software/grub/manual/grub.html#Installation-under-UNIX grub manual])

grub
grub>root (hd0,3) //assuming your root partition is /dev/sda3
grub>setup (hd0)
grub>quit
exit

choose "Reboot the system", everything should be fine.

Debian/Sarge and previous

To recover grub Debian/sarge, Debian/woody.. you need a console from a live CD. For example, boot with Debian installation CD and hit ctrl+alt+F2. Other live CDs will also work, such as Knoppix. Then mount the Debian partition on the hard disk, change the mount point to be the new root and exec grub-install.

May be these commands clarify the steps. For this example, Debian is in /dev/hda2

 # mkdir /my-debian
 # mount /dev/hda2 /my-debian
 # chroot /my-debian
 # grub-install /dev/hda
 # exit
 # umount /my-debian
 # reboot

You may need to load the fs module manually before mounting, for example:

 # modprobe reiserfs

That's all. No more, no less.