3

After the update to latest kernel (2.6.32-31-generic), when I start my PC, all I get is the grub2 prompt. I don't get any errors, it simple wont boot.

I tried this https://help.ubuntu.com/community/Grub2#Boot%20a%20Specific%20Kernel%20Manually but my problem seems to be the /boot on a separate partition and the tutorial doesn't cover this part.

If I'll can boot, I suppose I'll can do a grub-update, but first I need to get in.

I have Ubuntu 10.04, but I think this is a grub related question and linux version is irrelevant.

Please help, Thanks!

3 Answers 3

4

I could recover grub many times by following these instructions at: https://wiki.ubuntu.com/Grub2#Recover

First of all, you must start your system from a live cd. Then

"METHOD 3 - CHROOT

This method of installation uses the chroot command to gain access to the broken system's files. Once the chroot command is issued, the LiveCD treats the broken system's / as its own. Commands run in a chroot environment will affect the broken systems filesystems and not those of the LiveCD.

1) Boot to the LiveCD Desktop (Ubuntu 9.10 or later). Please note that the Live CD must be the same as the system you are fixing - either 32-bit or 64-bit (if not then the chroot will fail).

2) Open a terminal - Applications, Accessories, Terminal.

3) Determine your normal system partition - (the switch is a lowercase "L")

sudo fdisk -l  

If you aren't sure, run

df -Th 
Look for the correct disk size and ext3 or ext4 format.

4) Mount your normal system partition:

Substitute the correct partition: sda1, sdb5, etc.

sudo mount /dev/sdXX /mnt  
# Example: sudo mount /dev/sda1 /mnt

5) Only if you have a separate boot partition: sdYY is the /boot partition designation (for example sdb3)

sudo mount /dev/sdYY /mnt/boot 

6) Mount the critical virtual filesystems:

sudo mount --bind /dev  /mnt/dev
sudo mount --bind /dev/pts  /mnt/dev/pts
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys  /mnt/sys 

7) Chroot into your normal system device:

sudo chroot /mnt 

8) If there is no /boot/grub/grub.cfg or it's not correct, create one using

update-grub 

9) Reinstall GRUB 2:

Substitute the correct device - sda, sdb, etc. Do not specify a partition number.

grub-install /dev/sdX 

10) Verify the install (use the correct device, for example sda. Do not specify a partition):

sudo grub-install --recheck /dev/sdX 
11) Exit chroot: CTRL-D on keyboard

12) Unmount virtual filesystems:

sudo umount /mnt/dev/pts
sudo umount /mnt/dev
sudo umount /mnt/proc
sudo umount /mnt/sys 

13) If you mounted a separate /boot partition:

sudo umount /mnt/boot 

14) Unmount the LiveCD's /usr directory:

sudo umount /mnt/usr 

15) Unmount last device:

sudo umount /mnt 

16) Reboot.

sudo reboot 
"

2
  • yes, I know about this method, but actually I just found what I was searching for. I'll post my method as an answer too, and although it seems to be unfair to mark my own question as the correct one, it's the way I solved my problem.
    – s3v3n
    Apr 22, 2011 at 18:44
  • 1
    Ok I'm glad you could solve this yourself ;-)
    – desgua
    Apr 22, 2011 at 18:47
1

After some more searches, I found what I actually wanted and this solved my problem. This article explains how to manually boot if the /boot and / are on separate partitions: http://ubuntuaddict.com/ubuntu-how-to-boot-from-a-grub2-prompt-when-there-are-separate-boot-and-partitions/

In my case I had /boot on sda7 and / on sda8, so these are the commands that worked for me:

grub> set prefix=(hd0,7)/grub
grub> insmod linux
grub> set root=(hd0,8)
grub> linux (hd0,7)/vmlinuz-2.6.32-31-generic root=/dev/sda8 ro
grub> initrd (hd0,7)/initrd.img-2.6.32-31-generic
grub> boot

Please be careful: grub2 counts hard drives from 0, and partitions from 1.

That successfully booted into my ubuntu, and in a terminal I typed:

sudo update-grub

I noticed that actually these are two commands update-grub and update-grub2, that actually are launchers for the same script /usr/sbin/grub-mkconfig, but with different options. ( see update-grub2 --help, cat /usr/sbin/update-grub and cat /usr/sbin/update-grub2 ).

After the reboot all worked fine :)

1
  • Since it's my own answer, askubuntu will allow me to accept it as the correct answer in 2 days.
    – s3v3n
    Apr 22, 2011 at 18:59
0

Booting the older kernel from the grub prompt should not be necessary, if you can get the grub boot menu to appear.

When booting, hold left shift. This will open the Grub2 boot menu. Select the kernel prior to the most recent one (third menu option from the top) and boot it.

1
  • The menu doesn't show up at all. It just drops me to the grub2 prompt.
    – s3v3n
    Apr 22, 2011 at 18:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .