use*_*239 7 linux grub linux-mint
我已经安装了 Linux Mint Cinnamon,但是每当我打开电脑时,它就会进入 grub shell,我不知道为什么,而且我也不知道如何从 shell 启动 GUI Linux Mint,请帮助我
Joa*_*ela 12
我也有同样的问题!解决方案在这里:\n https://www.linux.com/tutorials/how-rescue-non-booting-grub-2-linux/
\n\n引自上述网站。
\n\n[...]
\n\n\n\n\nGRUB 2 命令 shell 与旧版 GRUB 中的 shell 一样强大。您可以使用它来发现启动映像、内核和根文件系统。事实上,它使您可以完全访问本地计算机上的所有文件系统,无论权限或其他保护如何。有些人可能会认为这是一个安全漏洞,但你知道古老的 Unix 格言:谁对机器有物理访问权限,谁就拥有它。
\n\n当您在 grub> 提示符下\xe2\x80\x99 时,您将拥有许多与任何命令 shell 类似的功能,例如历史记录和制表符补全。grub rescue> 模式受到更多限制,没有历史记录,也没有制表符补全。
\n\n如果您正在正常运行的系统上进行练习,请在 GRUB 引导菜单出现时按 C 键以打开 GRUB 命令 shell。您可以通过使用箭头键上下滚动菜单条目来停止启动倒计时。在 GRUB 命令行中进行实验是安全的,因为您在那里所做的任何事情都不是永久的。如果您已经盯着 grub> 或 grub saving> 提示符,那么您\xe2\x80\x99 就准备好了。
\n\n接下来的几个命令适用于
\ngrub>
和grub rescue>
。您应该运行的第一个命令调用分页器,以对长命令输出进行分页:
grub> set pager=1\n
Run Code Online (Sandbox Code Playgroud)\n\n\n\n\n等号两边不能有空格。现在让\xe2\x80\x99s 做一些探索。键入
\nls
以列出 GRUB 看到的所有分区:
grub> ls\n(hd0) (hd0,msdos2) (hd0,msdos1)\n
Run Code Online (Sandbox Code Playgroud)\n\n\n\n\n这些
\nmsdos
东西是什么\xe2\x80\x99?这意味着该系统具有旧式 MS-DOS 分区表,而不是闪亮的新全局唯一标识符分区表 (GPT)。如果您\xe2\x80\x99正在运行GPT,它会显示(hd0,gpt1)
. 现在让\xe2\x80\x99s 进行窥探。使用 ls 命令查看系统上有哪些文件:
grub> ls (hd0,1)/\nlost+found/ bin/ boot/ cdrom/ dev/ etc/ home/ lib/\nlib64/ media/ mnt/ opt/ proc/ root/ run/ sbin/ \nsrv/ sys/ tmp/ usr/ var/ vmlinuz vmlinuz.old\ninitrd.img initrd.img.old\n
Run Code Online (Sandbox Code Playgroud)\n\n\n\n\n万岁,我们找到了根文件系统。您可以省略
\nmsdos
和gpt
标签。如果省略斜杠,它将打印有关分区的信息。您可以使用以下命令读取系统上的任何文件cat
:
grub> cat (hd0,1)/etc/issue\nUbuntu 14.04 LTS n l\n
Run Code Online (Sandbox Code Playgroud)\n\n\n\n\n阅读
\n\n/etc/issue
在多重引导系统上可能对识别各种 Linux 很有用。Booting From grub> \n 这是设置引导文件并从提示符引导系统的方法
\ngrub>
。通过运行ls
命令我们知道 上有一个 Linux 根文件系统(hd0,1)
,您可以继续搜索,直到确认位置/boot/grub
为止。然后使用您自己的根分区、内核和 initrd 映像运行这些命令:
grub> set root=(hd0,1)\ngrub> linux /boot/vmlinuz-3.13.0-29-generic root=/dev/sda1\ngrub> initrd /boot/initrd.img-3.13.0-29-generic\ngrub> boot\n
Run Code Online (Sandbox Code Playgroud)\n\n\n\n\n第一行设置根文件系统所在的分区。第二行告诉 GRUB 您要使用的内核的位置。开始输入
\n\n/boot/vmli
,然后使用制表符补全来填写其余部分。键入root=/dev/sdX
以设置根文件系统的位置。是的,这似乎是多余的,但如果你忽略它,你\xe2\x80\x99将会出现内核恐慌。你怎么知道正确的分区?hd0,1 = /dev/sda1。hd1,1 = /dev/sdb1。hd3,2 = /dev/sdd2。我想你可以推断剩下的。\n 第三行设置 initrd 文件,它必须与内核的版本号相同。第四行启动您的系统。
\n\n在某些 Linux 系统上,当前内核和 initrd 被符号链接到根文件系统的顶层:
\n
$ ls -l /\nvmlinuz -> boot/vmlinuz-3.13.0-29-generic\ninitrd.img -> boot/initrd.img-3.13.0-29-generic\n
Run Code Online (Sandbox Code Playgroud)\n\n所以你可以像这样从 grub> 启动:
\n\ngrub> set root=(hd0,1)\ngrub> linux /vmlinuz root=/dev/sda1\ngrub> initrd /initrd.img\ngrub> boot\n
Run Code Online (Sandbox Code Playgroud)\n\n\n\n\n从 grub-rescue 引导>
\n\n如果您\xe2\x80\x99re在GRUB救援外壳中,命令是不同的,并且您必须加载
\nnormal.mod
和linux.mod
模块:
grub rescue> set prefix=(hd0,1)/boot/grub\ngrub rescue> set root=(hd0,1)\ngrub rescue> insmod normal\ngrub rescue> normal\ngrub rescue> insmod linux\ngrub rescue> linux /boot/vmlinuz-3.13.0-29-generic root=/dev/sda1\ngrub rescue> initrd /boot/initrd.img-3.13.0-29-generic\ngrub rescue> boot\n
Run Code Online (Sandbox Code Playgroud)\n\n\n\n\n加载两个模块后,制表符补全应该开始工作。
\n\n进行永久性修复
\n\n成功引导系统后,运行以下命令来永久修复 GRUB:
\n
# update-grub\nGenerating grub configuration file ...\nFound background: /usr/share/images/grub/Apollo_17_The_Last_Moon_Shot_Edit1.tga\nFound background image: /usr/share/images/grub/Apollo_17_The_Last_Moon_Shot_Edit1.tga\nFound linux image: /boot/vmlinuz-3.13.0-29-generic\nFound initrd image: /boot/initrd.img-3.13.0-29-generic\nFound linux image: /boot/vmlinuz-3.13.0-27-generic\nFound initrd image: /boot/initrd.img-3.13.0-27-generic\nFound linux image: /boot/vmlinuz-3.13.0-24-generic\nFound initrd image: /boot/initrd.img-3.13.0-24-generic\nFound memtest86+ image: /boot/memtest86+.elf\nFound memtest86+ image: /boot/memtest86+.bin\ndone\n# grub-install /dev/sda\nInstalling for i386-pc platform.\nInstallation finished. No error reported.\n
Run Code Online (Sandbox Code Playgroud)\n\n\n\n\n当您运行时,
\ngrub-install
请记住您\xe2\x80\x99将其安装到硬盘驱动器的引导扇区而不是分区,因此不要使用像/dev/sda1
.
作者:卡拉·施罗德
\n 归档时间: |
|
查看次数: |
50334 次 |
最近记录: |