33

I did a dumb thing... I forgot that Ubuntu 10.04 (Lucid Lynx) switched to GRUB 2 which puts a ton of *.mod files (kernel modules) in /boot/grub. I thought they were soundtrack files put there erroneously, and I moved them. Needless to say, the next reboot was traumatic. I was presented with something I had no memory of ever seeing... a 'grub rescue>' prompt.

With the help of Fixing GRUB error: “error: unknown filesystem” however, I was able to recover...

  • I discovered that GRUB rescue does not have 'cd', 'cp' or any other filesystem commands except its own variation of 'ls'.
  • So first I had to find the partition with the /boot directory containing vmlinuz file and other boot image files... (approximation from memory of failed attempts, as well as blank lines for clarity, added 2014-07-10 by docsalvage)

    grub rescue>  ls  
    (hd0,4) (hd0,3) (hd0,2) (hd0,1)  
    
    grub rescue>  ls (hd0,4)/boot
    ... some kind of 'not found' message
    
    grub rescue>  ls (hd0,3)/boot
    ... some kind of 'not found' message
    
    grub rescue>  ls (hd0,2)/boot
    ... grub ... initrd.img-2.6.32-33-generic ... vmlinuz-2.6.32-33-generic 
    
  • I found a /boot directory containing the vmlinuz file vmlinuz-2.6.32-33-generic on partition (hd0,2).

  • Then I manually booted from the 'grub rescue>' prompt. The following commands will...

    • Set the root to use the /boot directory on partition (hd0,2).
    • Load kernel module linux.
    • Set that module to use the kernel image vmlinuz-2.6.32-33-generic.
    • Set initrd(initialize RAM disk) to use the image initrd.img-2.6.32-33-generic.
    • Boot Linux.
  • grub rescue>  set root=(hd0,2)/boot  
    grub rescue>  insmod linux  
    grub rescue>  linux (hd0,2)/boot/vmlinuz-2.6.32-33-generic root=/dev/sda2
    grub rescue>  initrd (hd0,2)/boot/initrd.img-2.6.32-33-generic  
    grub rescue>  boot  
    
  • This boots and crashes to the BusyBox prompt which DOES have some rudimentary filesystem commands.

  • Then I moved the *.mod files back to the /boot/grub directory...

    busybox>  cd /boot  
    busybox>  mv mod/* grub
    busybox>  reboot
    
  • The reboot was successful, but that was a lot of work.

Is there an easier way?

9
  • 1
    Boot-Repair would be way easier, in my opinion. Check out one of my multiple answers on Boot-Repair for details on using it.
    – SirCharlo
    Oct 11, 2012 at 19:56
  • 1
    The "easiest" way is not always the best way. I strongly disagree with all the comments that suggest using a Live CD; it's really very difficult to boot from a Live CD on systems that don't have a CD/DVD reader.
    – Simón
    Sep 14, 2013 at 23:15
  • ican not locate the partition with the /boot directory.All partitions upon ls command give unknown filesystem output.
    – Rafed Nole
    Jul 9, 2014 at 18:36
  • 1
    Your post was very helpful for manually booting the kernel and initrd, but my system could not find dev, sys or proc, etc/fstab or sbin/init. That led me to another post, which suggested loading the kernel and setting the root as detailed in the manual boot directions in the grub documentation, eg: grub> linux (hd0,X)/boot/vmlinuz-a.b.c-d-generic root=/dev/sdaX, where X is the partition with /boot, a.b.c-d is the kernel version. Then my system booted fine! Thanks! Sep 26, 2014 at 7:16
  • 1
    in addition to [Fixing GRUB error: “error: unknown filesystem” [duplicate]](askubuntu.com/q/142300/36961) another great link that covers these steps is How to Rescue a Non-booting GRUB 2 on Linux, the grub 2 manual is also very helpful Sep 26, 2014 at 7:40

5 Answers 5

7

Here are some general and basic instructions to help with boot errors such as GRUB loading stage 1.5 error 15 (e.g. after the installation of Windows on different disk drive) :

  1. Boot with a LiveDVD (e.g., the Ubuntu Desktop disk).

  2. Open a terminal, and re-write the grub configuration using these commands:

    • sudo mount /dev/sdXY /mnt
    • sudo grub-install --root-directory=/mnt /dev/sdX

Where /dev/sdX is the disk where Ubuntu is installed, and /dev/sdXY is the partition on the disk where Ubuntu is installed. In other words, /dev/sdXY contains /boot and so on.

Use fdisk -l to verify the Ubuntu installation location.

2
  • Did not work. Perhaps if the directions were more specific, it would have worked. Jun 4, 2013 at 18:36
  • When I had a grub2 problem on a machine without cd drive I was able to recover by using my Gparted Live usb memory stick drive. I booted into Gparted live. THEN I started a terminal and typed fdisk -l (that's letter ell, not number 1) The output from that let me identify the partition which had the root partition and from there I followed the excellent instructions above and I was soon happily dual booting again.
    – Vic
    Mar 3, 2014 at 21:45
5

No. I think you pretty much found the easiest way to recover from the state of your system using grub rescue; it is a very minimalistic system giving just enough capability to boot the system.

BTW, I believe you must have found the .mod files and executed insmod linux or the linux command would have failed.

The only other way, as mentioned, would be to boot a Live CD and reinstall grub2 after chroot'ing to the 'broken' system.

3
  • You're absolutely right! I forgot that I'd done that. Added to my original post above for future reference. I need to be more disciplined in keeping careful notes in these situations. Please advise if further edits are needed. Oct 10, 2012 at 5:11
  • I also had to specify root when loading the kernel as in the grub docs eg grub> linux (hd0,2)/boot/vmlinuz-2.6.32-33-generic root=/dev/sda2 Sep 26, 2014 at 7:19
  • Also note, if you found the .mod files, you can restore „grub rescue” to fully-featured GRUB: # Inspect the current prefix (and other preset variables): set # Find out which devices are available: ls # Set to the correct value, which might be something like this: set prefix=(hd0,1)/grub set root=(hd0,1) insmod normal normal Source: gnu.org/software/grub/manual/html_node/…
    – MegaBrutal
    Jan 20, 2015 at 19:24
4
  1. Boot into Live CD

  2. Open Terminal (CTRL+ALT+T)

  3. Enter the following commands:

sudo fdisk -l

And find your Ubuntu partition (should be /dev/sda1 if it is the first partition)

sudo mount /dev/sda1 /mnt

sudo mount --bind /sys /mnt/sys

sudo mount --bind /proc /mnt/proc

sudo mount --bind /dev /mnt/dev

sudo chroot /mnt

Now reinstall Grub2

sudo apt-get install --reinstall grub2
1
  • 2
    Is this a better way better than sudo mount /dev/sda1 /mnt and sudo grub-install --root-directory=/mnt/ /dev/sda && sudo update-grub?
    – user91091
    Oct 8, 2012 at 17:28
4

I had the same problem when I upgraded my system.

I suggest the following simple steps:

  1. Boot your system with ubuntu live CD or live USB.
  2. Open the terminal and run the command sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update
  3. Then install boot repair by running the command sudo apt-get install -y boot-repair && boot-repair

  4. Launch the boot repair after installing. For example, from the menu, use System->Administration->Boot-Repair (Ubuntu 10.04 only) and follow the instructions.

    It may take 15-20 min to figure out the problem and to fix it.

For more help go to the link https://help.ubuntu.com/community/Boot-Repair

0

You could boot live CD, mount your hard drive, open nautilus as root and copy those files to /boot.

You must log in to answer this question.

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