GNU GRUB 终端——代替 Ubuntu 登录屏幕

GNU GRUB 终端——代替 Ubuntu 登录屏幕

笔记:在将其标记为重复之前,请完整阅读该问题。

我一直在正常使用 Ubuntu 12.04,但是今天当我打开笔记本电脑并从两个选项中选择 Ubuntu(Windows 和 Ubuntu)时,出现了以下屏幕:

在此处输入图片描述

我在这里搜索了很多次,但找不到可行的解决方案。

一个解决方案建议我先ls在不同的分区中执行操作,然后查看文件所在的位置vmliuzinitrd但我没有找到这些文件的位置。

我也调整了笔记本电脑的亮度,这可能是屏幕卡住的原因。

编辑1:

我仍然无法找到包含该initrd.img文件的目录。

grub> ls 
(memdisk) (hd0) (hd0,msdos3) (hd0,msdos2) (hd0,msdos1)
grub> set pager=1
grub> ls (memdisk)/
wubuilder.cfg
grub> ls (hd0)/
error: unknown filesystem.
grub> ls (hd0,3)/
$AttrDef $BadClus $Bitmap $Boot $Extend/ $LogFile $MFT $MFTMirr $RECYCLE.BIN/ $Secure $UpCase $Volume ./ Code School/ Downloads/ Movies/ System Volume Information/ ubuntu/ wubuilder
grub> ls (hd0, 2)/
Programming Files (x86)/ Users/ $AttrDef $BadClus $Bitmap $Boot $Extend/ $LogFile $MFT $MFTMirr $RECYCLE.BIN/ $Secure $UpCase $Volume ./ Documents and Settings/ hiberfil.sys Intel/ MSOCache/ pagefile.sys PerfLogs/ Program Files/ ProgramDAta/ Recovery/ Setup/ swsetup/ System Volume Information/ Windows/ wubildr wubildr.mbr
grub> ls (hd0, 1)/
$AttrDef $BadClus $Bitmap $Boot $Extend/ $LogFile $MFT $MFTMirr $RECYCLE.BIN/ $Secure $UpCase $Volume ./ Boot/ bootmgr BOOTSECT.BAK System Volume Information/

编辑2:

另外,请注意,我已经安装了 Ubuntu 12.04 和 Windows 7。我的 Ubuntu 位于以下位置;我通过启动 Windows 操作系统进行了检查:

grub ls (hd0,3)/ubuntu/
install/ uninstall-wubi.exe winboot/ 

答案1

如果你没有安装 Wubi.exe:

grub提示符下尝试以下命令:

set pager=1
ls

现在,假设的输出ls是:(hd0) (hd0,msdos2) (hd0,msdos1),为了找到 Linux 根文件系统,请运行:

ls (hd0,1)/ 它将为您提供其中的所有文件/文件夹,/bin/ boot/ cdrom/ dev/ etc/ home/ lib/等。

完成后继续:

set root=(hd0,1)
linux /boot/vmlinuz-3.13.0-29-generic root=/dev/sda1
initrd /boot/initrd.img-3.13.0-29-generic
boot

当然,vmlinuz-3.13.0-29-genericinitrd.img-3.13.0-29-generic你在/boot

/dev/sda1是根系统的位置。如果/dev/sda1没有效果,您可能需要更改它。

如果您使用 Wubi.exe 安装:

如果你使用 Wubi 安装 Ubuntu,请按照五笔指南

  1. 启动 Windows,chkdsk /r从安装 Ubuntu 的同一驱动器上的 Windows 运行,干净关闭,然后尝试再次启动 Ubuntu。

  2. 如果还是不行,请检查是否有C:\ubuntu\disks\root.disk文件。如果缺少此文件,请在 Windows 上启动,打开Windows Explorer,将其设置为能够查看隐藏文件夹,然后查找名为C:\found.000或 的隐藏文件夹dir0000.chk。将文件从 found.000 移动到目录中的原始位置\ubuntu\disks。您可能必须将其重命名为root.disk

答案2

运行这些命令

grub> linux  (hd0,1)/vmlinuz root=/dev/sda1
grub> initrd  (hd0,1)/initrd.img
grub> boot

用你的硬盘号和 /dev/sda1替换hd0为保存 /boot 的分区,如果你没有多个硬盘并且使用默认安装,那么这个方法就可以正常工作

查看此处了解更多信息

当你可以再次启动时你应该解决了你的问题

sudo update-grub
sudo grub-install /dev/sda

相关内容