<Solved>Help! Grub 2 completely broken

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
Post Reply
Gaugamela
Level 1
Level 1
Posts: 38
Joined: Wed Dec 21, 2011 11:59 am

<Solved>Help! Grub 2 completely broken

Post by Gaugamela »

Hello, I am having serious problems with Grub 2.

I installed Mint 12 one week ago and everything was working satisfactorily but today I had some issues. I was extracting a large file and saw that my Mint partition was out of disk space which I found weird since it was supposed to be a 30Gb partition.

I used the Gnome Disk Utility tool and verified that my Linux partition that I had done for Ubuntu 11.04 was broken in 5 smaller partitions with 4 of them of the type Linux swap (0x82). Now the problem is that I tried to erase these partitions to merge them with the partition that had the Mint OS. I erased one, creating free space in the disk but couldn't merge and made two of them with usage type for fylesystem and EXT4 extension.

Since I wasn't able to do what I wanted I shutdown my laptop to boot into Windows but I had the following problem:

error: unknowns filesystem
Grub rescue>

I already tried to do the following steps to solve my problem:

1 - I booted to the Live USB Mint to see if I could fix it by there however if I try to reinstall Mint the installation program doesn't recognize my Windows partition and will erase all my data which I obviously don't want!

2 - From Terminal I tried to do the following:

mount /dev/sda2 /mnt

grub-install --root-directory=/mnt /dev/sda

But it gave the following error:

grub-probe: error: cannot find a device for /boot (is /dev mounted?).
/usr/sbin/grub-setup: warn: no signature.
/usr/sbin/grub-setup: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
/usr/sbin/grub-setup: error: will not proceed with blocklists.

I am getting a bit desperate because of this. Can anyone help me?

Here is my information from Boot Repair: http://paste.ubuntu.com/783796/
Last edited by Gaugamela on Sat Dec 31, 2011 1:34 pm, edited 1 time in total.
fliteshare
Level 1
Level 1
Posts: 5
Joined: Wed May 27, 2009 7:27 pm

Re: Help! Grub 2 completely broken

Post by fliteshare »

Safety first
Do a partition copy with partedmagic of your /C: and /home partition to an external drive
More info at http://partedmagic.com/doku.php

Then I would try:

Code: Select all

sudo update-grub
supposedly this will make grub2 go look for boot sectors on your system and rebuild your grub2 bootmenu.
With a bit of luck grub2 will rediscover your windows boot sector and you can boot into windows again.

If that doesn't work, you can always fall back and use your partition copies
to do an entire reinstall and restore of your system.

Be careful and good luck.
User avatar
Roken
Level 5
Level 5
Posts: 735
Joined: Fri Nov 19, 2010 4:55 pm
Location: Warrington, UK

Re: Help! Grub 2 completely broken

Post by Roken »

No no no. We need to know your partition layout first. Paste the output of:

Code: Select all

sudo fdisk -l
when running from your liveCD. It will likely have more than one partition, so it would help to determine which has your /boot directory on it. Also from the live CD, mount your Linux partitions (not the swap partitions) and

Code: Select all

ls /mount/point/boot 
replacing /mount/point with wherever you mount the disks.

Paste the output of those, too (including any errors).
Kernel Linux Tex 4.8.13-1-ARCH (64 bit) xfce , burg
Arch
GTX680 4Gb
OSS4
AMD Phenom II X4 (965BE) @ 3.6 Ghz
8Gb RAM
wayne128
Level 10
Level 10
Posts: 3410
Joined: Tue Jul 13, 2010 12:15 am

Re: Help! Grub 2 completely broken

Post by wayne128 »

from your pastebin, your Mint is at /dev/sda8

so, your first step is to try this

1. boot from Mint Live DVD
2. mount mint partition by
sudo mount /dev/sda8 /mnt
3. reinstall grub to MBR by
sudo grub-install --root-directory=/mnt /dev/sda
4. reboot and see if Mint can get booted up.
Gaugamela
Level 1
Level 1
Posts: 38
Joined: Wed Dec 21, 2011 11:59 am

Re: Help! Grub 2 completely broken

Post by Gaugamela »

An update to what happened to me. I did the following steps from this tutorial about installing Grub2 https://help.ubuntu.com/community/Grub2 ... ing_GRUB_2:

1. set prefix=(hdX,Y)/boot/grub
Use the values determined earlier. Example: If the Ubuntu system is on sda5, enter: set prefix=(hd0,5)/boot/grub
2.* set root=(hdX,Y)
Example: set root=(hd0,5)
3. insmod normal
Attempt to load the normal module.
4. normal
Activate the normal module. If successful, the GRUB 2 menu may appear.

And I managed to make the grub2 menu appear and run Mint and Windows 7. After this I did a sudo update grub but it didn't solve my problem.
Then I did a force reinstall of grub 2 and with that my laptop now recognizes that there's a grub since it starts with a grub prompt grub> instead of grub rescue>.
Right now I need to write the following when booting:

configfile (hd0,8)/boot/grub/grub.cfg

And with this it initiates the grub menu.
However, nothing that I do avoids the need of write this command everytime I want to start my laptop and the Live USB that I have still doesn't recognize my partitions for me to reinstall mint.

I think my problem was that I erased one swap partition that I wanted to merge with my main Mint partition and that messed up the partition order established in Grub. Suppose I can't do that. :S
What are they necessary for?
Gaugamela
Level 1
Level 1
Posts: 38
Joined: Wed Dec 21, 2011 11:59 am

Re: Help! Grub 2 completely broken

Post by Gaugamela »

wayne128 wrote:from your pastebin, your Mint is at /dev/sda8

so, your first step is to try this

1. boot from Mint Live DVD
2. mount mint partition by
sudo mount /dev/sda8 /mnt
3. reinstall grub to MBR by
sudo grub-install --root-directory=/mnt /dev/sda
4. reboot and see if Mint can get booted up.
I get the following error:
grub-probe: error: cannot find a device for /boot (is /dev mounted?).
/usr/sbin/grub-setup: warn: no signature.
/usr/sbin/grub-setup: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
/usr/sbin/grub-setup: error: will not proceed with blocklists.

I don't know why the f*ck the /dev/sda8 isn't mounted when I write the commands you tell me to write.

When trying to mount the mint partition I get the following mistake:
mount: can't find dev/sda8/mnt in /etc/fstab or /etc/mtab
User avatar
Roken
Level 5
Level 5
Posts: 735
Joined: Fri Nov 19, 2010 4:55 pm
Location: Warrington, UK

Re: Help! Grub 2 completely broken

Post by Roken »

Gaugamela wrote: When trying to mount the mint partition I get the following mistake:
mount: can't find dev/sda8/mnt in /etc/fstab or /etc/mtab
You've missed a space - /dev/sda8 /mnt (dev/sda8[space]/mnt)
Kernel Linux Tex 4.8.13-1-ARCH (64 bit) xfce , burg
Arch
GTX680 4Gb
OSS4
AMD Phenom II X4 (965BE) @ 3.6 Ghz
8Gb RAM
Gaugamela
Level 1
Level 1
Posts: 38
Joined: Wed Dec 21, 2011 11:59 am

Re: Help! Grub 2 completely broken

Post by Gaugamela »

Roken wrote:
Gaugamela wrote: When trying to mount the mint partition I get the following mistake:
mount: can't find dev/sda8/mnt in /etc/fstab or /etc/mtab
You've missed a space - /dev/sda8 /mnt (dev/sda8[space]/mnt)
ok corrected the command and then I wrote the following command: grub-install --root-directory=/mnt/dev/sda

Got the following error:
grub-probe: error: cannot find a device for /boot (is /dev mounted?).
install_device not specified.
Usage: grub-install.real [OPTION] install_device
Install GRUB on your drive.

-h, --help print this message and exit
-v, --version print the version information and exit
--modules=MODULES pre-load specified modules MODULES
--boot-directory=DIR install GRUB images under the directory DIR/grub
instead of the /boot/grub directory
--grub-setup=FILE use FILE as grub-setup
--grub-mkimage=FILE use FILE as grub-mkimage
--grub-mkrelpath=FILE use FILE as grub-mkrelpath
--grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
--grub-probe=FILE use FILE as grub-probe
--no-floppy do not probe any floppy drive
--allow-floppy Make the drive also bootable as floppy
(default for fdX devices). May break on some BIOSes.
--recheck probe a device map even if it already exists
--force install even if problems are detected
--disk-module=MODULE disk module to use

INSTALL_DEVICE can be a GRUB device name or a system device filename.

grub-install.real copies GRUB images into /boot/grub, and uses grub-setup
to install grub into the boot sector.

Report bugs to <bug-grub@gnu.org>.

I don't understand why isn't it detecting the /dev
User avatar
Roken
Level 5
Level 5
Posts: 735
Joined: Fri Nov 19, 2010 4:55 pm
Location: Warrington, UK

Re: Help! Grub 2 completely broken

Post by Roken »

Gaugamela wrote: ok corrected the command and then I wrote the following command: grub-install --root-directory=/mnt/dev/sda
Nope, another space :)

Code: Select all

grub-install --root-directory=/mnt[space]/dev/sda
Kernel Linux Tex 4.8.13-1-ARCH (64 bit) xfce , burg
Arch
GTX680 4Gb
OSS4
AMD Phenom II X4 (965BE) @ 3.6 Ghz
8Gb RAM
Gaugamela
Level 1
Level 1
Posts: 38
Joined: Wed Dec 21, 2011 11:59 am

Re: Help! Grub 2 completely broken

Post by Gaugamela »

Roken wrote:
Gaugamela wrote: ok corrected the command and then I wrote the following command: grub-install --root-directory=/mnt/dev/sda
Nope, another space :)

Code: Select all

grub-install --root-directory=/mnt[space]/dev/sda
With spaces it gave the following mistake>
grub-probe: error: cannot find a device for /boot (is /dev mounted?).
/usr/sbin/grub-setup: warn: no signature.
/usr/sbin/grub-setup: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
/usr/sbin/grub-setup: error: will not proceed with blocklists.

FIXED!!!

Ok, I managed to correct the error, Grug 2 is already starting normally. I did the following:

grub-install --root-directory=/mnt /dev/sda --force.
The ninstaller princess but it installed grub and the laptop started automatically afterwards. Finally!!
User avatar
Roken
Level 5
Level 5
Posts: 735
Joined: Fri Nov 19, 2010 4:55 pm
Location: Warrington, UK

Re: Help! Grub 2 completely broken

Post by Roken »

OK, we'll try it a different way. Mount sda8 as before:

Code: Select all

sudo mount /dev/sda8 /mnt
Then bind the needed directories from your Mint installation:

Code: Select all

sudo mount ‐‐bind /dev /mnt/dev
sudo mount ‐‐bind /proc /mnt/proc
sudo mount ‐‐bind /sys /mnt/sys
Now chroot into your Mint installation:

Code: Select all

sudo chroot /mnt
Install grub

Code: Select all

sudo grub-install /dev/sda
sudo update-grub
And exit the chroot

Code: Select all

logout
Then reboot and, with luck, your grub will be working again.
Kernel Linux Tex 4.8.13-1-ARCH (64 bit) xfce , burg
Arch
GTX680 4Gb
OSS4
AMD Phenom II X4 (965BE) @ 3.6 Ghz
8Gb RAM
oobetimer

Re: Help! Grub 2 completely broken

Post by oobetimer »

Roken wrote:OK, we'll try it a different way. Mount sda8 as before:

Code: Select all

sudo mount /dev/sda8 /mnt
Then bind the needed directories from your Mint installation:

Code: Select all

sudo mount ‐‐bind /dev /mnt/dev
sudo mount ‐‐bind /proc /mnt/proc
sudo mount ‐‐bind /sys /mnt/sys
Now chroot into your Mint installation:

Code: Select all

sudo chroot /mnt
Install grub

Code: Select all

sudo grub-install /dev/sda
sudo update-grub
And exit the chroot

Code: Select all

logout
Then reboot and, with luck, your grub will be working again.
An another way:

sudo mount /dev/sda8 /mnt

sudo grub-install --boot-directory=/mnt/boot /dev/sda

sudo umount /mnt
Gaugamela
Level 1
Level 1
Posts: 38
Joined: Wed Dec 21, 2011 11:59 am

Re: Help! Grub 2 completely broken

Post by Gaugamela »

Thanks guys but I already solved the problem by doing a forced install of grub. It's now working well.
Curiously, now I can't boot from my LiveUSB Mint version.
Post Reply

Return to “Installation & Boot”