How to repair your grub
From Linux Mint
At the moment it seems that the "Grub terminal" does not work as expected. This has to be investigated and possibly this article has to be rewritten
There is a method described in the How to section of the forum that can be used instead of this solution if you find that the grub terminal refuses to cooperate
http://www.linuxmint.com/forum/viewtopic.php?f=42&t=19208
Contents |
Re-install Grub with Live CD
This article is used so much used in support that it is locked from editing to avoid that it is destroyed.
Unfortunately we even had the entire howto section of the wiki destroyed once and parts of it several times.
If you want to contribute please do so in the discussion tab and if it is good I will include it in the main article /husse
This method is also the best method to use from a hard disk installed operating system. It can be done from a grub floppy disk too, or just about anywhere there is already a grub installation present with the necessary Grub files.
You can use this to install Grub to anywhere too, it doesn't have to be only to the MBR of a first hard disk. Grub can be installed to any other hard disk, or to a usbdisk, or floppy disk this way.
The most common use for this operation is to fix your MBR after a Windows re-install has corrupted your MBR with the IPL for the Windows bootloader, so you can only boot Windows. Another use is if some "unfriendly" Linux installer has messed with grub - that happens - or if you just want to change which menu.lst you want to use.
mint@mint~:$ sudo grub
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For
the first word, TAB lists possible command
completions. Anywhere else TAB lists the possible
completions of a device/filename. ]
grub>_
This is an example of one use of a grub shell. This is a Grub shell, because it has a grub prompt, like this, 'grub>_'
Note that grub starts counting from 0 so (hd0) in grub is really hd1 (or sd1, grub does not use sd either)
Locate a boot folder/partition to use
grub> find /boot/grub/stage1
(hd0,1) (hd0,3)
This tells where the necessary Grub files may be located used to install grub from.
grub> root (hd0,1)
Filesystem type is ext2fs, partition type 0x83
The root (hd0,1) will tell grub which operating system partition contains the grub to install from. It has to be one of the ones listed by the 'find' command (above).
The Grub menu from the operating system's /boot/grub/menu.lst that is selected here is the one that will appear on boot up. In other words, if (hd0,1) contains Mint, and grub is installed from (hd0,1), Mint's Grub menu will appear on boot up. If (hd0,3) contains Kubuntu, and grub is installed from (hd0,3), Kubuntu's Grub menu will appear on boot up.
Grub should recognize the filesystem, and will reply with an output similar to the one shown above. If not, then check to make sure you didn't make a mistake.
grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes Checking if "/boot/grub/stage2" exists... yes Checking if "/boot/grub/e2fs_stage1_5" exists... yes Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 15 sectors are embedded. succeeded Running "install /boot/grub/stage1 d (hd0) (hd0)1+15 p (hd0,1)/boot/grub/stage 2 /boot/grub/menu.lst"... succeeded Done.
The 'setup' command is the command that tells Grub exactly where to install Grub to. You may get "16 sectors are embedded" (or some other number - not sure) and "(hd0)1+15 p" is then changed to "(hd0)1+16 p"
Installing Grub to MBR:
'setup (hd0)' is the command to install Grub's stage1 to MBR.
Stage1_5 will also be installed to the 15 sectors following the MBR in the first track of the hard disk.
grub> quit
Installing Grub to PBR (Partition Boot Record):
grub> setup (hd0,1)
This installs Grub into the second partition of the first disk
If you install GRUB into a partition or a drive other than the first one, you must chain-load GRUB from another boot loader.
If you do that you're supposed to know how to chainload
grub> quit
quit makes you leave the grub "terminal" On occasion this has generated an "error 27". If so use the reset button or if in a gnome/KDE terminal just close it. Reboot and you will find your grub menu again.
If the method above does not work, maybe Super Grub helps you:
http://supergrub.forjamari.linex.org/
Mint's Grub
Mint has a special version of Grub called gfxgrub. This enables the nice Grub splash and has been used since Celena.
Some hardware "does not like" this version of grub, notably Mac(book).
If you have installed successfully, but the first boot fails completely this may depend on gfxgrub. (I.e. if you get stuck directly after the BIOS splash)
Then you have to boot with the live CD and do some editing.
Find the folder /boot/grub of the Mint you just installed. It would be best to do this in the GUI and not in a terminal. Open menu.lst for editing.
Comment out the following two lines (add ## first on the line)
- gfxmenu=/etc/grub/message.mint
- color cyan/blue white/blue
Instructions on how to do this follows below [1]
Make a copy of menu.lst just in case. If you have a terminal in the /boot/grub folder you do
sudo cp menu.lst /path_to_that_Mints_home
or wherever you want to put the copy
This helps in many cases, but not all.
If this did not help you have to install a regular grub. Download "Supergrub" (about 5 MB small), burn to a CD and follow the instructions. It's important to have the copy of menu.lst so you can restore the list of installed operating systems
Grub in Ubiquity - the installer
At the very last screen of the install you find an "Advanced" button in the lower right corner. This hides an option to select location for Grub. Here it is possible to use "/dev/sdx" as Ubiquity will transform that to the correct syntax for Grub
How to edit from the live CD
Remember that you still don't have a password so you are not asked to give one when you use sudo.
There are two main methods to open the folder needed (/boot/grub)
- The main edition
This "automounts". Double click the "Computer" icon on the desktop.
You'll see all the partitions in the computer.
Double click a partition and it opens up
If you have many partitions you have to search a bit as unfortunately the "/dev/sdx" is not shown
Find (the right) /boot/grub folder
In a terminal
gksudo gedit menu.lst
and make the changes
- KDE edition
No automount I'm afraid...
Open the menu and open QTParted, find the Mint root partition
Once you know the "designation" of the Mint root partition make a folder mnt. The simplest is to keep it in home
Open the terminal and just issue the command
sudo mkdir mnt
Now you've got a folder mnt in "mint's home" in the file system of the live CD
Then
mount -t ext3 sda2 mnt
Of course you adjust sda2 to your needs
Open mnt and navigate to /boot/grub which now should be the folder on your installed Mint
Then right click menu.lst and choose "Edit as root" and make the changes
- Other editions
They could "automount" and then it's like the main edition
If not follow the instructions for the KDE edition only open a terminal in the folder and use sudo + the name of a simple editor (could be mousepad in XFCE)
If you find it confusing that you find a folder on the hard disk in the file system of the live CD, remember "everything" in Linux is files....

