7.22. x86、AMD64 和 Intel® 64 系统的引导装载程序(Boot Loader)的配置
如果不使用引导介质来引导你的系统,你通常需要安装一个引导装载程序。引导装载程序是计算机启动时所运行的第一个软件,它的责任是载入操作系统内核软件并把控制权转交给它。然后,内核再初始化操作系统的其他部分。
Installing in text mode
If you install Fedora in text mode, the installer configures the bootloader automatically and you cannot customize bootloader settings during the installation process.
GRUB(GRand Unified Bootloader)是一个默认安装的功能强大的引导装载程序。GRUB 能够通过连锁载入(chain-loading)来装载多种免费和专有操作系统(连锁载入是通过载入另一个引导装载程序来载入 DOS 或 Windows 之类不被支持的操作系统的机制)。
The GRUB boot menu
The GRUB menu defaults to being hidden, except on dual-boot systems. To show the GRUB menu during system boot, press and hold the Shift key before the kernel is loaded. (Any other key works as well but the Shift key is the safest to use.)
If there are no other operating systems on your computer, or you are completely removing any other operating systems the installation program will install
GRUB as your boot loader without any intervention. In that case you may continue on to
第 7.23 节 “Package Group Selection”.
您的系统可能已经安装了一个引导加载程序。一个操作系统会安装自己首选的引导加载程序,或者您安装了第三方的引导加载程序。如果您的引导加载程序无法识别 Linux 分区,可能就无法引导 Fedora。使用 GRUB 作为您的引导加载程序,可以引导 Linux 和大多数其他操作系统。按照这章的描述来安装 GRUB。
Installing GRUB
如果您安装 GRUB,它将覆盖已有的引导加载程序。
By default, the installation program installs GRUB in the master boot record or
MBR, of the device for the root file system. To decline installation of a new boot loader, unselect
Install boot loader on /dev/sda.
Warning
如果由于某种原因你选择不安装 GRUB,你将无法直接引导系统,你必须得使用另一种引导方法(如商用引导装载程序)。只有当你确定另有引导系统的方法时才使用该选项!
如果您已经安装了其他操作系统,Fedora 尝试自动检测并配置 GRUB 来引导它们。如果 GRUB 没有检测到它们的话,您可以手动配置任何其他的操作系统。
要添加,删除或改变探测到的操作系统设置,使用该选项。
- Add
选择 增加 按钮来在 GRUB 中包括其他的操作系统。
在下拉菜单中,选择包含可启动的操作系统的分区,然后为这个项目命名。GRUB 将在启动菜单中显示这个名称。
- Edit
要修改 GRUB 启动管理器的一个项目,选择它然后按下 编辑 按钮。
- Delete
要从 GRUB 启动菜单中删除一个项目,选择它然后按下界面中的 删除 按钮。
在你想要的引导分区旁边选择「默认」来选择你默认的可引导操作系统。你选定了默认引导映像后,安装才会继续。
Note
「标签」列中列出的信息是你在引导所需操作系统时必须在非图形化引导装载程序的引导提示下输入的信息。
一旦你已载入 GRUB 引导屏幕,使用箭头键来选择引导标签,键入 e 来编辑。你将会看到所选引导标签配置文件中的项目列表。
在别人可以亲身访问你的服务器的情况下,引导装载程序密码为你提供了一种安全机制。
如果你打算安装引导装载程序,你应该创建一个密码来保护你的系统。若没有引导装载程序密码,能够进入你的系统的用户将可以向内核传递选项,从而减弱你的系统安全性;若使用了引导装载程序密码,用户必须先输入密码才能选择非标准的引导选项。然而,能够从物理角度使用你的机器的用户仍可以从软盘、光盘、或 USB 介质(若 BIOS 支持)引导。包括引导装载程序密码的保安计划还应该解决其它引导方法带来的安全问题。
不使用 GRUB 密码
如果您的系统只有一个可被信任的操作员,或控制台的访问在物理上很安全,您可能不需要 GRUB 密码。然而,如果一个不可信的人能物理访问您的电脑键盘和显示器。 他将能够重新引导系统然后访问 GRUB。这时密码将很有用。
如果你选择要使用引导装载程序密码来增进你的系统安全性,请确定选择标为「使用引导装载程序密码」的复选框。
一旦选毕,输入密码并确认。
GRUB 将密码以加密形式存储,因此不会 被读取或非法取得。如果您忘记了引导密码,就按照通常的方式启动,然后修改 /boot/grub/grub.conf
中的密码一项。如果您无法启动,那么可以用第一张 Fedora 安装光盘以 "rescue" 模式来进入系统,重置 GRUB 密码。
如果您一定要修改 GRUB 密码,使用 grub-md5-crypt
实用工具。关于如何使用这个工具,可以在终端下用命令 man grub-md5-crypt
来查看手册。
要配置更高级的引导装载程序选项,如改变磁盘顺序或往内核传入参数,在点击「下一步」之前,你要确保已经选中了「配置高级引导装载程序选项」。
7.22.1. 高级引导装载程序配置
现在,你已选定了要安装的引导装载程序,你还可以决定要在哪里安装引导装载程序。你可以在下面两个位置之一安装引导装载程序:
The master boot record (MBR) — This is the recommended place to install a boot loader, unless the MBR already starts another operating system loader, such as System Commander. The MBR is a special area on your hard drive that is automatically loaded by your computer's BIOS, and is the earliest point at which the boot loader can take control of the boot process. If you install it in the MBR, when your machine boots, GRUB presents a boot prompt. You can then boot Fedora or any other operating system that you have configured the boot loader to boot.
The first sector of your boot partition — This is recommended if you are already using another boot loader on your system. In this case, your other boot loader takes control first. You can then configure that boot loader to start GRUB, which then boots Fedora.
GRUB 作为二级引导程序
如果安装 GRUB 为二级引导加载程序,当从新内核引导或安装时您必须重新配置主引导加载程序。像 Microsoft Windows 这样的一个操作系统的内核引导的风格是不同的。因此许多用户在双系统中让 GRUB 成为主引导加载程序。
Note
如果你有一个 RAID 卡,请留意某些 BIOS 不支持从 RAID 卡引导。在这类情况下,引导装载程序不应该被安装在 RAID 阵列的 MBR 上。引导装载程序应该被安装在创建 /boot
分区所在的同一驱动器上的 MBR。
If your system only uses Fedora, you should choose the MBR.
如果你想重新排列驱动器顺序,或者你的 BIOS 所返回的驱动器顺序不正确,点击「改变驱动器顺序」按钮。如果你有多个 SCSI 适配器或者兼有 SCSI 和 IDE 适配器,并想从 SCSI 设备中引导,改变驱动器顺序可能会发挥作用。
Note
在为你的硬盘驱动器分区时,请注意某些较老的系统 BIOS 无法进入硬盘里前 1024 柱面以外的区域。如果情况如此,在你的硬盘的前 1024 柱面上为 /boot
Linux 保留足够空间以便引导 Linux。其它 Linux 分区可以位于柱面 1024 之后。
在 parted
中,1024 柱面相当于 528MB。详情请参阅:
http://www.pcguide.com/ref/hdd/bios/sizeMB504-c.html