The current testing version of Debian, aka Wheezy, contains a rather annoying bug that prevents the installation of Grub, the multi-OS bootstrapper of Linux. Although this bug will be corrected at some point in the possibly near future, it is already present for a few months, making life harder for the fresh installations. The traditional workaround in order to install Debian Testing is to install a stable version (Squeeze) and then modify your mirrors to upgrade it to a testing version. In this way Grub will be installed correctly. However, if you have encountered the Grub issue, this means you have already completed your install from a broken edition (if you encounter the issue but you haven’t completed the install yet, just finish it in a clean way without a bootloader, and then continue reading here). So, maybe you don’t want to download a new ISO image, burn a new DVD or write a new USB key with it, and then restart the installation process from scratch. The other solution is then to keep the installation that you have just done and to setup the installation of Grub from the stable mirrors. It’s quite straightforward once you know how to do this.
First you need to boot your fresh installation. In order to do this, you can use any valid Debian bootable media, like for example the media you have used to do your installation. In the boot menu, you should select ‘Advanced Options’ and then the ‘Rescue Mode’. This will launch a recovery shell as root user (be careful). In the following screens, select the root partition where Debian is installed in order to mount it (mountpoint /).
The first thing to do now is to make sure the network is started and accessible. You can try a ‘ping debian.org‘.
Next, use vi to modify the /etc/apt/sources.list file. Make sure the installation media (CD, DVD, USB, etc.) is commented out and replace ‘wheezy’ by ‘squeeze’ in the lines where the networked mirrors are specified (lines starting with deb and deb-src followed by a URL, do not modify the ones that contain the URL for the security patches). Save, quit the editor and update aptitude in order to apply the changes: ‘aptitude update‘. Now you can download the grub-pc package from the Squeeze mirrors: ‘aptitude install grub-pc‘. During the install process, you will be asked the partition where you want to get it installed. When this is finished, run ‘update-grub‘ in order to be sure the configuration files are correctly generated. This last step is probably not necessary, but let’s play it on the safe way just in case.
Now, you can remove your bootable media and cleanly reboot the computer: ‘shutdown now -r‘. It should restart fine.
The next thing to do, as root, is to modify back the /etc/apt/sources.list file with ‘wheezy’ instead of ‘squeeze’ and launch again the command ‘aptitude update‘ to apply the change.