“Things are only real after one has learned to agree on their realness. What took place this evening, for instance, cannot possibly be real to you, because no one could agree with you about it. ‘Do you mean that you didn’t see what happened?’. Of course I did. But I don’t count. I am the one who’s lying to you, remember?”
Carlos Castaneda

Tales of Power

Ubuntu/Kubuntu Grub Load Error

n

If you had an installation of Ubuntu or Kubuntu and now it won’t load and all you are left with is something like “sh: grub>” – DON’T PANIC! It’s happened to me twice before (which caused me to create a fresh installation), but this time I took some more time to search and I found a solution.

Why did this happen? There is a good chance that Ubuntu installed some updates. One of those updates was probably to a program called Grub. This is a small program that is one of the first to run when you start your computer. It’s job is to properly load the underlying Linux operating system (which then loads the graphical usual interface you were expecting). It seems that when Grub is updated – something in it’s configuration gets messed up which is why you are frantically searching for a solution.

First, take a deep breath, you probably haven’t lost any information and you may be minutes away from having your familiar operating system restored. There are two steps to this process: (1) manually starting your operating system from within the Grub program; (2) manually reconfiguring to automatically update it’s configuration to start properly.

There is one nice feature and trick you will need to do this process. When you type in commands in the command-line, and those commands need to refer to a file, the key “tab” does an auto-complete. For example: suppose you have a file that starts with the letters “myfile…” stored in a folder called “/myfolder”. If you type “/myfolder/myfile” and then click tab it will automatically find the file and complete the rest of it’s name. If it finds more then one file – it will show you a list of options which match – and you can then manually enter it.

Step1: Manually Starting the Operating System

In this process you will need to enter numerous commands at the command line. The actual commands are marked in bold, optional commands are marked in italics, the rest of the text is complimentary comments & explanations.

NTFS is a method for organizing files on your hard drive, and we need to load a module that will be able to read it by entering:

insmod ntfs

Next we need to tell the program where the operating system can be found – this is a reference to a partition on a hard drive. If, like me, you are working with a WUBI installation (I am running Kubuntu 9.10 on a computer with one hard drive and one partition) then Ubuntu is on the first hard driver’s second partition. Numbering starts at 0 – so the first hard drive is “hd0” and the second partition is “1” and the command you need to type is:

set root=(hd0,1)

In any other configuration you need to figure out which hard drive and which partition contains the Ubuntu installation. You can type an ls command which will show you what hard drives and partitions are currently available.

I am not sure what these two command do, but it seems they create some kind of temporary space for the operating system to load:

loopback loop0 /ubuntu/disks/root.disk
set root=(loop0)

In this next step you are going to need to use the auto-complete feature mentioned above. You will need to enter this command in two steps:
type in: linux /boot/vmlinuz
then press tab and you will probably be shown a number of options. I found “vmlinuz-2.6.31-14-generic”, “vmlinuz-2.6.31-15-generic”, “vmlinuz-2.6.31-16-generic”. I tried to the latest version, the one labeled “16”, but that didn’t work. The one labeled “15” did work for me. So you may also have to try and see what works for you. Complete the command(for example):

linux /boot/vmlinuz-2.6.31-15-generic root=/dev/sda1 loop=/ubuntu/disks/root.disk ro

Please note that “sda1” is another way of referring to the first hard drive “a” and second partition “1” (zero is the first partition). You may need to replace this with a reference to your installed partition.

In this next step you will again be using the auto-complete feature to create a command like this:

initrd /boot/initrd.img-2.6.31-15-generic

I believe that the the numbers, which indicate a version of the linux kernel, should match those entered in the previous command.

Finally, give the command to boot the operating system (this will probably cause the screen to scroll with lots of information – which is a good sign that indicates that the system is indeed loading):
boot

Step2: Updating the Grub Configuration

If you are experiencing relief – that’s great and it means you only have one more thing to do. This is to make sure that the next time you reboot your computer it will be able to load automatically. You will need to open a terminal window and type in the following command:

sudo update-grub

If you experience other problems you may want to continue browsing and reading this thread – which will probably continue to evolve and update as more people encounter this problem in different settings and variations. Good luck 🙂

# Add the ntfs module
insmod ntfs
# Set root (normally would be sda1, or hd0,1 Change as necessary
set root=(hd0,1)
loopback loop0 /ubuntu/disks/root.disk

# Yes, set root for a second time. I don’t know why…
set root=(loop0)
# Set the kernel. You can (and should) use Tab (twice) to complete entries such as the kernel when possible – type vml and then TAB twice and it will autocomplete to the point where there are two possibilities. Tab complete ensures the path/file names as typed exist. Additionally, if you suspect the new kernel is the problem, you might want to select an earlier one. vmlinuz…. should be a complete kernel entry such as “vmlinuz-2.6.31-15-generic-pae” *
linux /boot/vmlinuz…. root=/dev/sda1 loop=/ubuntu/disks/root.disk ro
# Set the initrd image – complete or tab to get the full name Example: “/boot/initrd.img-2.6.31-15-generic-pae”
initrd /boot/initrd/initrd.img…
# Boot.
boot
This entry was posted in outside, Tech Stuff. You are welcome to read 3 comments and to add yours

2 Comments

  1. Anonymous
    Posted January 7, 2010 at 8:52 am | Permalink

    Thanks a ton!

    Awesome post!

    After looking for googling for hours, these steps did the trick for me.

  2. Posted January 7, 2010 at 11:41 am | Permalink

    I'm glad it helped 🙂 thanks for writing!

One Trackback

  • By Installing Ubuntu/Kubuntu | iamronen on February 27, 2010 at 9:31 am

    […] I can do is brutally shut it off. Sometimes it reboots just fine, numerous time it has stopped at a GRUB error and other times nothing could be done to rescue it. From what I’ve been able to gather this […]

Leave a Reply

  • Outside

  • Subscribe via Email