Traduction française disponible sur http://grub.enbug.org/GRUB2LiveCDInstallGuide-FR

If you just want to see the commands without all the text scroll down to the bottom.

GRUB 2: Live CD Install Guide

I am not an expert on linux, and much less on GRUB. These are steps I took in repairing my GRUB 2 installation, with major assistance from fezie (aka FelixZielcke), of course.

History

A little bit about why this guide ended up being written. You can skip this section and go straight to Step One: Booting. For those of you interested only in the list of commands executed, scroll down to the bottom of the page.

I read somewhere during the upgrade process that GRUB 2 does not use menu.lst anymore, so I thought the old gushy stuff would be cleaned up. However, this wasn't the case, but before I noticed that, I went ahead and read the new config file, modified it to my liking, etc. when all of a sudden I see a menu.lst. My ignorance led me to thinking that all of the files inside the /boot/grub folder were from GRUB Legacy (that's just simply not the case, though) and so I decided to clean out the folder and ran grub-mkconfig -o /boot/grub/grub.cfg to recreate the config again. The command executed and created a new grub.cfg for me and proceeded to tell me that the file was created fine. After this I think to myself, "Viola! I'm done! So fresh and so clean, clean!"

Mind you, (another side note) grub-install is the key command to run if you want to actually install GRUB 2, but unfortunately I didn't run it manually, either I ignored something or it isn't mentioned anywhere during install. Anyhow, I went ahead and restarted my machine all happy and dandy thinking I would be seeing a whole new and improved GRUB. I wait and see the usual "Stage 1.5" part (which belongs to GRUB Legacy, not GRUB 2, but I didn't know this then) and just half a second later, I am presented with this beautifully written text saying "Error 15." Great, no system to boot into and no idea on how to go about this issue either and so this is where all the hours of Googling started to no avail. I found a page of someone saying that they had fix a problem they had by going on the IRC channel and I jumped on that bandwagon too and got my problem fixed.

I received an enormous amount of help from fezie (aka FelixZielcke) in the IRC channel. Unfortunately, he doesn't have a personal wiki page, so he gets mentioned by name.

PS. Regardless of how I botched up my system, you should be able to reinstall GRUB 2 using these instructions.

Step One: Booting

Step Two: Mounting and chroot'ing

If you got a separate /boot partition, you'll have to mount it too.

Step Three: GRUB 2 Install

Prefix: once you chroot into a system you should technically be considered root (hence the name), however, there is hundreds of linux distributions and not all should follow the exact same steps. This means that you might encounter a system where you will still need to type sudo before any command.

Step Four: Unmounting

This step might not be absolutely necessary, but I like to do it just for my own peace of mind.

Commands list

This is a list of the commands executed in order,

  1. sudo fdisk -l

  2. sudo mount /dev/sda1 /mnt

  3. sudo mount --bind /dev /mnt/dev

  4. sudo mount --bind /proc /mnt/proc

  5. sudo mount --bind /sys /mnt/sys

  6. sudo chroot /mnt

  7. (optional, only if you're on Ubuntu/Debian) apt-get install grub-pc

  8. grub-mkconfig -o /boot/grub/grub.cfg

  9. grub-install /dev/sda (try grub-install --recheck /dev/sda if it fails)

  10. Ctrl+D (to exit out of chroot)

  11. sudo umount /mnt/dev

  12. sudo umount /mnt

GrubWiki: Grub2LiveCdInstallGuide (last edited 2009-12-23 16:55:59 by FelixZielcke)