How To Reinstall Debian Or Repair Install

Starting with Windows 8 most Desktop PC have EFI as firmware instead of the legacy BIOS. If your EFI based PC is not booting debian, here is an easy way to reinstall grub-efi, the bootloader used by debian on these PCs.
Contents
How to Reinstall Debian or Repair Install?? Greetings, Just installed Debian Sarge/2.4 on my lil' HP Jornada 728 HPC. Install was done using various files downloaded to CF Card and then extracted to Linux partition and other files that were put on the FAT partition. I got most files from 720degrees.org. Debian Cleanup Tip #4: find broken packages and reinstall them. If you’re a tinkerer and hand-edit some files for some quick tests, or if you tend to re-install newer versions of some packages from the sources, you might have overwritten some packaged files and it would be good to be able to detect this (and remedy to the problem). Debsums is the tool that makes it possible.
- Troubleshooting
To reinstall grub, you need either a live CD/USB to access your current system , or you can use the rEFInd boot manager on a live CD/USB to boot your current system.
Using the rEFInd rescue media
At the author's web page http://www.rodsbooks.com/refind/getting.html, you will find updated direct links to all sorts of packaging. To boot from a rescue media, select either the CD iso or the image for USB stick, most firmware offers the choice nowadays. If choosing the latter make sure to follow the instructions in the readme. It is recommended to read the author's web pages to get a better understanding of what you are doing.
Boot your computer with the Refind media
Refind will parse your hard drive for installed kernels, and provide you a graphic menu to boot them. Choose your Linux Kernel and boot it.
Reinstalling grub-efi on your hard drive
Check that the computer booted in computer in EFI mode:
After starting a root shell ( if you boot from a live media, you should start a chroot shell instead, as explained in https://help.ubuntu.com/community/Grub2/Installing#via_ChRoot ) check that your EFI system partition (most probably /dev/sda1) is mounted on /boot/efi. If the /boot/efi directory does not exist, you will need to create it.
Reinstall the grub-efi package
Some of the required fixes are also made in this update with many security and network enhancements. It is compatible with all SATA drives with all the basic necessaries a computer system need. Windows XP Professional SP3 has all the preloaded drivers for SATA drives. Overview of Microsoft Windows XP Professional SP3Although Microsoft has ended support for Windows XP but still it is widely used across the world because of its fast speed and reliability.
Put the debian bootloader in /boot/efi and create an appropriate entry in the computer NVRAM
Re create a grub config file based on your disk partitioning schema
You should check afterwards that:
Check 1. the bootloader is existing in /boot/efi/EFI/debian/grubx64.efi
Check 2. the nvram entry was properly created.
You can now reboot, and Grub should greet you.
Troubleshooting
If after this steps you're not booting, the EFI of your PC might have some bugs.
Problem1: Weak EFI implementation only recognizes the fallback bootloader
The uefi firmware refuses to boot the debian/grubx64.efi bootloader, and so we have to hijack the uefi fallback boot loader. See http://mjg59.livejournal.com/138188.html for details.
Using debian installer in rescue mode, /dev/sda1 being the FAT32 ESP partition, /dev/sda2 the root partition
Once booted into your normal Debian, tell grub to ensure the fallback boot loader up to date. To do that, run the following:
Note: The above command will permanently hijack the fallback boot loader, which might be undesirable in dual-boot setups.

Problem2: EFI boot entries disappear after reboot
The uefi firmware did not create a proper boot entry in NVRAM. This has been seen in a Lenovo Thinkcenter M92Z. The symptom for this will be a missing HD path after the debian entry in the efibootmgr --verbose output.
You can then try to install Refind as your bootloader in the hard drive, following the steps at this gist: https://gist.github.com/EmmanuelKasper/9590327.
CategoryBootProcessRescueLive