错误:您需要先在 Grub 中加载内核

Exe*_*n-G 6 grub2 lubuntu

我安装了 Lubuntu 11.10,安装了/dev/sda3Xubuntu 11.10 /dev/sda5。不久前,在 Lubuntu 上,我在创建 Live USB 时犯了一个错误:我错误地将 Live USB 引导加载程序安装到/dev/sda3. 这在当时并没有造成任何问题。

今天,我更新了内核。我不得不重新启动 Lubuntu。在Grub中,Lubuntu突然没有出现了,我在Xubuntu中自动启动。我尝试运行update-grub并尝试使用grub-customizer让 Lubuntu 回到 Grub,但这没有用。我跑了os-prober,但它没有显示我 Lubuntu。

然后,我尝试在/etc/grub.d/on /dev/sda5called 中添加一个新条目12_lubuntu。它包含以下内容:

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

这样做之后,我运行update-grub并使用grub-customizer,我将 Grub 配置写入 MBR,即:/dev/sda.

突然,Lubuntu 出现在 Grub 中。我尝试启动它,但是在执行此操作时,出现以下消息:

Error: File not found
Error: You need to load the kernel first
Run Code Online (Sandbox Code Playgroud)

ls -allin的输出/dev/sda3如下:

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
Run Code Online (Sandbox Code Playgroud)

我还发现了旧的30_os-prober_proxyin /dev/sda3/etc/grub.d,它应该包含旧的引导内容。如下:

#!/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'
"
Run Code Online (Sandbox Code Playgroud)

如何让 Grub 再次启动 Lubuntu?

Exe*_*n-G 0

一周前,我又遇到了同样的问题,但现在我自己解决了。事实证明,该问题与 LiveUSB 安装无关。我要做的就是grub-customizer从 Xubuntu 启动,单击FileSelect Partition、单击Next,选择 Lubuntu 的分区,然后单击Mount the selected filesystem。我可以选择选择子安装点,但这不是必需的。我点击了Apply

现在,我必须检查所有可用的复选框,以确保我可以从 Grub 启动 Lubuntu。然后我点击了File,,Save之后,我点击了FileInstall to MBR

我重新启动,可以再次启动到Lubuntu,问题解决了。

如果这不能解决您的问题,我建议您使用 fossfreedom 在下面的另一个答案中提到的工具。