Hi Everyone,
I just had the privilege nay, the honour, of having to recover my computer from total destruction.
I was fiddling around with my GRUB (a bootloader), and somehow erased everything in the main configuration file, /boot/grub/menu.lst
Naturally, when I tried to boot the next time, GRUB panicked and ran to the nearest corner sobbing, leaving my with a limited prompt with a handful of commands at my disposal.
“Ah balls” I thought, how the hell do I fix this?
The one fact to know in this situation is, GRUB creates a backup of your menu.lst file when you install your system, and saves it in the same folder under the name menu.lst.backup. So all you have to do is replace the menu.lst file with the backup.
How can you do that when you can’t boot into an operating system though??
What you need is a Live CD or USB. If you’ve installed Linux, you’ll know what they are. I first tried using the Fedora CD that I recently burnt. It booted to a lovely desktop, after which I opened a terminal and tried to get to work. No luck. Not possible. Fedora won’t let you log in as root, or run any commands as root on the live CD, this was an absolute pain.
I scratched my head, where to go from here, I didn’t have a spare computer handy to burn a new CD. Then I remembered an old Arch Linux Live CD I had lying around somewhere. After some searching, I found it! If you don’t have it, download it and burn the ISO to a CD.
I booted into the Live CD, no need to open a terminal here, cos that’s all you get by default!
I logged in as root, which it thankfully allowed you to do, and got to work. Here’s the commands you’ll need to run -
mkdir /media/disk
This creates a mount point so you can access your hard drive
mount -t ext3 /dev/sdaX /media/disk
This attempts to mount the hard drive onto the mount point you created. The X will take some trial and error to get right, start at 1, and work your way up. If that doesn’t work, try replacing the s with h.
Now that the hard drive is mounted, its a simple job to copy the backup file.
cp /media/disk/boot/grub/menu.lst.backup /media/disk/boot/grub/menu.lst
Now reboot by typing reboot, and you should be on your way again!
Any questions, ask below.
I do realise many Live CD’s will work, but this was the tool at my disposal, and it worked!