Error: You need to load the kernel first in Grub

I have Lubuntu 11.10 installed on /dev/sda3, and Xubuntu 11.10 on /dev/sda5. A while ago, while being on Lubuntu, I made a mistake somewhere in creating a Live USB: by mistake, I installed a Live USB bootloader into /dev/sda3. This didn't result in any problem at that time.

Today, I updated the kernel. I had to restart Lubuntu. In Grub, Lubuntu suddenly didn't appear anymore, and I booted automatically in Xubuntu. I tried to run update-grub and tried to use grub-customizer to get Lubuntu back in Grub, but this didn't work. I ran os-prober, but it doesn't show me Lubuntu.

Then, I tried to add a new entry to /etc/grub.d/ on /dev/sda5 called 12_lubuntu. It contained the following:

#!/bin/sh -e
echo "Lubuntu"
cat << EOF
menuentry "Lubuntu" {
set root=(hd0,3)
linux /boot/vmlinuz
initrd /boot/initrd.img
}
EOF

After doing that, I ran update-grub and with grub-customizer, I wrote the Grub-configuration to MBR, that is: /dev/sda.

Suddenly, Lubuntu appeared in Grub. I tried to launch it, but when doing this, the following messages appeared:

Error: File not found
Error: You need to load the kernel first

The output of ls -all in /dev/sda3 is as follows:

gijs@Gijs-PC:/media/9c715f68-f083-46ab-9d55-6139556f31d4$ ls -all
totaal 112
drwxr-xr-x  23 root root  4096 2011-11-25 23:35 .
drwxr-xr-x   5 root root  4096 2011-11-26 10:55 ..
drwxr-xr-x   2 root root  4096 2011-11-22 22:17 bin
drwxr-xr-x   4 root root  4096 2011-11-25 23:36 boot
drwxr-xr-x   2 root root  4096 2011-10-15 21:58 cdrom
drwxr-xr-x   5 root root  4096 2011-10-12 18:08 dev
drwxr-xr-x 146 root root 12288 2011-11-25 23:37 etc
drwxr-xr-x   3 root root  4096 2011-10-15 21:59 home
lrwxrwxrwx   1 root root    37 2011-11-25 23:35 initrd.img -> /boot/initrd.img-3.0.0-14-generic-pae
lrwxrwxrwx   1 root root    33 2011-11-25 23:35 initrd.img.old -> /boot/initrd.img-3.0.0-14-generic
drwxr-xr-x  19 root root  4096 2011-11-22 22:17 lib
drwx------   2 root root 16384 2011-10-15 21:56 lost+found
drwxr-xr-x   5 root root  4096 2011-11-24 20:59 media
drwxr-xr-x   2 root root  4096 2011-10-09 09:29 mnt
drwxr-xr-x   4 root root  4096 2011-11-24 17:15 opt
drwxr-xr-x   2 root root  4096 2011-10-09 09:29 proc
drwx------  13 root root  4096 2011-11-22 17:19 root
drwxr-xr-x   5 root root  4096 2011-10-15 22:01 run
drwxr-xr-x   2 root root  4096 2011-11-22 22:17 sbin
drwxr-xr-x   2 root root  4096 2011-06-21 20:43 selinux
drwxr-xr-x   2 root root  4096 2011-10-12 18:06 srv
drwxr-xr-x   2 root root  4096 2011-07-14 07:11 sys
drwxrwxrwt   8 root root  4096 2011-11-25 23:37 tmp
drwxr-xr-x  10 root root  4096 2011-10-12 18:06 usr
drwxr-xr-x  13 root root  4096 2011-11-25 23:37 var
lrwxrwxrwx   1 root root    33 2011-11-25 23:35 vmlinuz -> boot/vmlinuz-3.0.0-14-generic-pae
lrwxrwxrwx   1 root root    29 2011-11-25 23:35 vmlinuz.old -> boot/vmlinuz-3.0.0-14-generic

I've also found the old 30_os-prober_proxy in /dev/sda3/etc/grub.d, which should contain the old boot stuff. It is as follows:

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/os-prober' | /etc/grub.d/bin/grubcfg_proxy "-*
-'Ubuntu, met Linux 3.0.0-12-generic-pae (on /dev/sda3)'
-'Ubuntu, met Linux 3.0.0-12-generic-pae (herstelmodus) (on /dev/sda3)'
+'Ubuntu, met Linux 3.0.0-12-generic (on /dev/sda3)' as 'Xubuntu'
-'Ubuntu, met Linux 3.0.0-12-generic (herstelmodus) (on /dev/sda3)'
+'Windows 7 (loader) (on /dev/sda2)' as 'Windows 7'
"

How can I make Grub start Lubuntu again?


Solution 1:

Boot-Repair

The majority of grub boot issues can be resolved through using boot-repair - as this community wiki explains, you can install this on a liveCD/USB or directly in a working ubuntu install and it will attempt to find all O/S installs and repair the overall Grub MBR.

Manual Grub2 Installation

If boot-repair fails to work its magic then the traditional manual grub2 installation method described in this community wiki should be investigated.

Search on that web-page for the section Copy LiveCD Files. Replace the example /dev/sdxy statements with the partition that you have installed lubuntu in - for example /dev/sda3

If you are unsure which partition you have installed then you can run the Boot-info-script found on SourceForge.

In the results look for partitions types of ext4 or ext3 - these are the common Ubuntu filesystems unless you previously elected to use something like btrfs or reiserfs etc.

Kernel reinstallation

If the issue is a corrupt kernel installation then you can investigate reinstalling the kernel from a live CD. This is described in this excellent AskUbuntu Q&A

By installing the kernel correctly, Grub should be able to see the Lubuntu installation correctly.