标签: grub2

在哪里可以了解有关如何使用 GRUB `ntldr` 命令(模块?)的更多信息

我最近偶然发现了 GRUBntldr模块。

显然,它可以用来替代chainloader引导 NT >= 6.0 版本的 Windows,如下例所示。(如果 Windows 分区的卷引导记录已损坏,则非常方便。)

menuentry "Windows 7 (bootmgr on /dev/sda1)" --class windows --class os {
    insmod part_msdos
    insmod ntfs
    insmod ntldr
    set root='(hd0,msdos1)'
    search --no-floppy --fs-uuid --set=root 1EA0019AA0017A13
    ntldr ($root)/bootmgr
}
Run Code Online (Sandbox Code Playgroud)

我在哪里可以了解有关如何使用此引导指令的更多信息?我没有看到它上市的时候我在看HTML版本中的GNU GRUB手册


回复 ckhan 的回答

非常感谢!我几乎决定我必须尝试挖掘源代码以了解有关 GRUBntldr命令/模块的更多信息。但是你做得比我做得好得多。

我从来没有想过查看电子邮件档案以了解编写代码的人可能进行了哪些设计讨论。这种方法听起来在未来可能会很有帮助。谢谢你提到它。

我对 GRUBntldr支持的看法

  1. 虽然我不确定这种区别有多大意义,但它ntldr是一个模块,而不是一个命令。或者,如果您愿意,也可以动态加载命令。

    按照您的源代码链接并查看第 152 ( GRUB_MOD_INIT) 和 159 ( GRUB_MOD_FINI) 行,您可以看到要加载的代码,并且……我猜……卸载模块。

    GRUB 显然实现了许多您可能认为是“命令”的功能模块。我所知道的唯一用法区别是,在使用模块之前,必须确保它已加载命令insmod …

windows grub2

17
推荐指数
1
解决办法
2万
查看次数

错误地删除了 /boot 文件夹并重新启动

我错误地从我的文件系统中删除了 /boot 文件夹,重新启动,我现在得到的是:

error: file '/boot/grub/i368-pc/linux.mod' not found.

grub rescue>
Run Code Online (Sandbox Code Playgroud)

boot grub2

17
推荐指数
1
解决办法
1万
查看次数

arch linux- 错误:无法获得“airootfs”的规范路径(grub 到 USB 安装)

我是第一次尝试安装 arch-linux。一切正常,直到我尝试将“grub”引导加载程序安装到 USB 驱动器。

我正在按照 WIKI ARCH LINUX 指南工作。

这两个命令都没有错误:

# mkdir -p /mnt/usb ; mount /dev/sdc1 /mnt/usb

# grub-install --target=i386-pc --recheck --debug --boot-directory=/mnt/usb/boot /dev/sdc
Run Code Online (Sandbox Code Playgroud)

但下一个命令返回错误:

无法获得“airootfs”的规范路径:

# grub-mkconfig -o /mnt/usb/boot/grub/grub.cfg
Run Code Online (Sandbox Code Playgroud)

任何人都可以提供帮助吗?

(试图arch-chroot /mnt /bin/bash 在这个上找不到命令)。

arch-linux grub2 system-installation

17
推荐指数
2
解决办法
3万
查看次数

链式加载两个 Grub2 安装

这真的让我失望。我有 Gentoo 和 Ubuntu,都带有 Grub2。Gentoo 有一个专用/boot分区,而 Ubuntu 没有。我menuentry在 Gentoo 中有一个/etc/grub.d/40_custom可以启动 Ubuntu(并且 Ubuntu 可以正常启动)。

因为 Ubuntu 带有 Grub,所以我想链式加载到那个,而不是维护我设置根、内核、initrd 和其他东西的条目。这是我对链加载器的使用(Ubuntu 已开启/dev/sda4,我已经在那里安装了 Grub):

menuentry 'Chainloader' {
    insmod chain
    set root=(hd0,4)
    chainloader +1
}
Run Code Online (Sandbox Code Playgroud)

它给了我error: Invalid signature,我发现没有可用的解决方案。有人可以指出吗?

这是结果 </dev/sda4 head -c 512 | hd

00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000200
Run Code Online (Sandbox Code Playgroud)

这是 的结果fdisk -l/dev/sda1属于/bootGentoo,Gentoo 属于 …

dual-boot grub2

15
推荐指数
1
解决办法
8800
查看次数

Arch linux:chroot 时 pacman 不起作用

我的电脑上安装了 Ubuntu。我决定安装 Arch linux,但我跳过了关于 Grub 安装的部分,因为它已经安装了。看到 Arch 没有出现在 Grub 的菜单列表中,我决定在 Arch 中安装它。我在 Ubuntu 中安装了 Arch 的分区,然后 chroot 到它。我发出命令pacman -S grub-bios并得到以下信息:

error: could not open file: /etc/mtab: No such file or directory
error: could not determine filesystem mount points
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.
Run Code Online (Sandbox Code Playgroud)

/etc/mtab是指向 的符号链接/proc/self/mounts,但/proc文件夹中没有任何内容。

我究竟做错了什么?

作为补充,我是否朝着正确的方向让 Arch 出现在 Grub 的列表中?编辑:我是能够使拱门出现在GRUB的名单从Ubuntu的做sudo mount /dev/sdaX与Arch的分区号替换X之前)sudo update-grub

arch-linux pacman grub2 proc

15
推荐指数
1
解决办法
2万
查看次数

如何使用 TPM 密封 UEFI 引导系统上的数据?

我想使用存储在 TPM 中的密钥来密封系统上的文件。由于我的系统使用 UEFI 来引导,我不能再使用 TrustedGrub 作为引导加载程序来维护我的信任链。是否有任何替代方法/方法可以在 UEFI 系统上使用 TPM?Grub2 能否在引导 UEFI 时维护信任链?

boot-loader grub2 uefi tpm

15
推荐指数
1
解决办法
3639
查看次数

Grub 安装失败

我有一个很好的 Debian Jessie 安装运行,但后来我运行了apt-get update && apt-get upgrade && apt-get dist-upgrade.

然后重新启动后,它直接进入BIOS。我意识到 Grub 丢失了,所以我运行了一个 live cd 并输入了Rescue mode,挂载了我的根分区,+ 引导分区并运行了这些命令:

Grub 找到 linux 镜像:

root@debian:~# update-grub
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-4.9.0-3-amd64
Found initrd image: /boot/initrd.img-4.9.0-3-amd64
Found linux image: /boot/vmlinuz-4.9.0-0.bpo.3-amd64
Found initrd image: /boot/initrd.img-4.9.0-0.bpo.3-amd64
Found linux image: /boot/vmlinuz-3.16.0-4-amd64
Found initrd image: /boot/initrd.img-3.16.0-4-amd64
Found Ubuntu 16.10 (16.10) on /dev/sdb2
Adding boot menu entry for EFI firmware configuration
done
Run Code Online (Sandbox Code Playgroud)

然后grub-install: …

boot debian grub2 uefi

15
推荐指数
1
解决办法
5万
查看次数

grub2 的搜索命令中的 --hint 选项有什么作用?

我正在查看search命令的官方 GRUB2 文档,如http://www.gnu.org/software/grub/manual/grub.html#index-search

Command: search [--file|--label|--fs-uuid] [--set [var]] [--no-floppy] name

Search devices by file (-f, --file), filesystem label (-l, --label),
or filesystem UUID (-u, --fs-uuid).

If the --set option is used, the first device found is set as the
value of environment variable var. The default variable is ‘root’.

The --no-floppy option prevents searching floppy devices, which can be slow.

The ‘search.file’, ‘search.fs_label’, and ‘search.fs_uuid’ commands are aliases
for ‘search --file’, ‘search --label’, and ‘search --fs-uuid’ respectively. …
Run Code Online (Sandbox Code Playgroud)

grub2

14
推荐指数
2
解决办法
1万
查看次数

GRUB2:启动到第二个(另一个)硬盘

我已经研究过这个问题,但一直无法找到明确的答案……甚至是一个明确的问题。所以我会用一个简单的例子。

我的电脑有**两个硬盘:**

  • 硬盘 1MBR上带有GRUB2 的Ubuntu Linux 。
  • 硬盘 2任何其他操作系统(是否打扰哪个操作系统?)以及其他一些 MBR 加载程序。

GRUB2 仅引导至 Ubuntu(在我的示例中,在第一个硬盘上)。
发行update-grub检测不到第二硬盘上的操作系统,但我知道有一个。
如果我在启动时进入BIOS并将启动顺序更改为 Hard Disk 2,则第二个操作系统启动 OK

如何向 GRUB2 添加引导至第二个硬盘的条目

(事实是:我认为这个问题可以指定哪个是第二个硬盘中的操作系统。还是不是?)

os-prober使用此配置添加示例机器的请求输出:

luis@threepwood:~$ sudo os-prober
/dev/sdb1:Windows 7 (loader):Windows:chain
/dev/sdb7:Ubuntu 14.04.3 LTS (14.04):Ubuntu:linux
Run Code Online (Sandbox Code Playgroud)

在这个特定示例中(我在 BIOS 中更改了引导顺序)案例:

  • sdb 是 HDD-1。
  • sda 是 HDD-2。

dual-boot grub2

14
推荐指数
2
解决办法
7万
查看次数

不同步:VFS:无法在未知块(0,0)上挂载根文件系统

我的笔记本电脑上装有 Windows 10 和 Manjaro,一切正常。昨天,我在另一个分区安装了 Kali Linux。它已正确安装并且工作正常。但问题是当我想启动我的 Manjaro 时。我在 grub 菜单上选择 Manjaro,但这是我看到的屏幕。

wn-block(0,0)
[    0.667378] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.9.47-1-MANJARO #1
[    0.667435] Hardware name: Acer Aspire E5-575G/Ironman_SK  , BIOS V1.04 04/26/2016
[    0.667493]  ffffc90000c8bde0 ffffffff813151d2 ffff880276a77000 ffffffff8190b950
[    0.667717]  ffffc90000c8be68 ffffffff8117ecd4 ffffffff00000010 ffffc90000c8be78
[    0.667940]  ffffc90000c8be10 327c3b64ed88e616 327c3b64ed88e616 ffffc90000c8be80
[    0.668162] Call Trace:
[    0.668213]  [<ffffffff813151d2>] dump_stack+0x63/0x81
[    0.668267]  [<ffffffff8117ecd4>] panic+0xe4/0x22d
[    0.668321]  [<ffffffff81v2a590>] mount_block_root+0x27c/0x2c7
[    0.668377]  [<ffffffff81b298be>] ? set_debug_rodata+0x12/0x12
[    0.668432]  [<ffffffff81b2a640>] mount_root+0x65/0x68
[ …
Run Code Online (Sandbox Code Playgroud)

linux kernel-panic grub2 kali-linux manjaro

14
推荐指数
4
解决办法
7万
查看次数