系统管理指南:基本管理

使用 GRUB 引导基于 x86 的系统(任务图)

任务 

说明 

参考 

将基于 x86 的系统引导至运行级别 3(多用户级别)。 

关闭系统或执行系统硬件维护任务之后,使用此引导方法使系统恢复至多用户级别。 

x86: 如何将系统引导至运行级别 3(多用户)

在单用户模式下引导基于 x86 的系统。 

使用此引导方法可执行系统维护任务(例如,备份文件系统)。 

x86: 如何将系统引导至运行级别 S(单用户级别)

以交互方式引导基于 x86 的系统。 

为测试目的而对系统文件或内核进行临时更改后使用此引导方法。 

x86: 如何交互式地引导系统

显示基于 x86 的系统上可引导的 ZFS 数据集列表。 

使用以下方法之一可显示具有 ZFS 根文件系统的基于 x86 的系统上的可用 BE:

  • lustatus

  • bootadm list-menu

x86: 如何显示可用的 ZFS 引导环境列表

从 ZFS 根文件系统引导基于 x86 的系统。 

如果您安装支持 ZFS 引导装载器的 Oracle Solaris 发行版或将您的系统升级至该发行版,则在缺省情况下,缺省 ZFS BE 的 GRUB 菜单项包含 -B $ZFS-BOOTFS 引导参数。系统将自动从 ZFS 引导。


注 –

只有包含 ZFS 池的引导设备支持此选项。


x86: 如何从指定的 ZFS 根文件系统引导

在故障安全模式下引导基于 x86 的系统。 

使用此过程可在基于 x86 的系统上引导故障安全归档文件。然后,运行 bootadm 命令更新引导归档文件。

如何在故障安全模式下引导基于 x86 的系统

在故障安全模式下引导基于 x86 的系统以强制更新损坏的引导归档文件。 

在以下情况下使用此过程:引导归档文件已损坏;系统拒绝正常引导;或者系统未提示您更新不一致的引导归档文件。 

x86: 如何在故障安全模式下引导以强制更新损坏的引导归档文件

使用 GRUB 从网络引导基于 x86 的系统。 

使用此方法从采用缺省网络配置策略的网络引导 PXE 或非 PXE 设备。此方法还可用于引导无盘客户机。 

x86: 如何从网络执行基于 GRUB 的引导

Procedurex86: 如何将系统引导至运行级别 3(多用户)

使用此过程将当前处于运行级别 0 的系统引导至运行级别 3。

  1. 重新引导系统。


    # reboot
    

    如果系统显示 Press any key to reboot 提示,请按任意键以重新引导系统。

    在出现此提示时,您还可以使用“重置”按钮。如果系统已关闭,请使用电源开关打开系统。

    引导序列开始时,将显示 GRUB 菜单。

  2. 显示 GRUB 菜单时,按 Enter 键引导缺省 OS 实例。

    如果在 10 秒内未选择项,系统会自动引导至运行级别 3。

    引导过程成功完成后,将显示登录提示。

  3. 登录到系统。


    hostname console login:
  4. 确认系统已引导至运行级别 3。


    # who -r
    system% who -r
       .       run-level 3  Mar  2 09:44     3      0  S

示例 12–9 x86: 将系统引导至运行级别 3(多用户级别)


# reboot

Jul 24 11:29:52 bearskin reboot: rebooted by root
syncing file systems... done
rebooting...

Adaptec AIC-7899 SCSI BIOS v2.57S4
(c) 2000 Adaptec, Inc. All Rights Reserved.

 Press <Ctrl><A> for SCSISelect(TM) Utility! 

Ch B,  SCSI ID: 0 SEAGATE  ST336607LSUN36G   160

GNU GRUB  version 0.95  (637K lower / 2096064K upper memory)
==============================================================
Solaris 10 10/08 s10x_u6wos_03 X86
Solaris failsafe

==============================================================
		Use the  and  keys to select which entry is highlighted.
		Press enter to boot the selected OS, 'e' to edit the
		commands before booting, or 'c' for a command-line.


SunOS Release 5.10 Version Generic_137138-04 32-bit
Copyright 1983-2008 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.
Hostname: pups
NIS domain name is ....sfbay.sun.com
Reading ZFS config: done.
Mounting ZFS filesystems: (5/5)

pups console login:

# who -r
   .       run-level 3  Jul 24 11:31     3      0  S

Procedurex86: 如何将系统引导至运行级别 S(单用户级别)

使用此过程可将位于运行级别 0 的系统引导至运行级别 S。单用户级别用于执行系统维护。


注 –

此过程可用于所有 GRUB 实现。但是,GRUB 主菜单中的引导项随您所运行的 Oracle Solaris 发行版而异。


有关您在引导时可指定的所有内核选项的说明,请参见 x86: 通过在引导时编辑 GRUB 菜单修改引导行为

  1. 重新引导系统。


    # reboot
    

    如果系统显示 Press any key to reboot 提示,请按任意键以重新引导系统。

    在出现此提示时,您还可以使用“重置”按钮。如果系统已关闭,请使用电源开关打开系统。

    引导序列开始时,将显示 GRUB 菜单。

  2. 显示 GRUB 主菜单时,键入 e 以编辑 GRUB 菜单。

  3. 根据要运行的版本,使用方向键选择 kernelkernel$ 行。

    如果不能使用方向键,请使用插入记号键 (^) 向上滚动,并使用字母 v 键向下滚动。

  4. 再次键入 e 以编辑引导项。

    在这里,您可以向 kernelkernel$ 行添加选项和参数。

  5. 要在单用户模式下引导系统,请在引导条目行的结尾键入 -s,然后按回车键返回至上一屏幕。

    • 要指定其他引导行为,请将 -s 选项替换为适当的引导选项。

      可以使用此方式指定以下备用引导行为:

      • 执行重新配置引导

      • 在 32 位模式下引导具备 64 位计算能力的系统

      • 使用内核调试器引导系统

      • 重定向控制台

      有关更多信息,请参见 boot(1M) 手册页。

  6. 要在单用户模式下引导系统,请键入 b

  7. 出现提示时,键入超级用户口令。

  8. 确认系统处于运行级别 S。


    # who -r
    .       run-level S  Jun 13 11:07     S      0  0
  9. 执行将运行级别更改为 S 所需的系统维护任务。

  10. 完成系统维护任务后,重新引导系统。


示例 12–10 x86: 在单用户模式下引导系统


# reboot
Jul  2 14:30:01 pups reboot: initiated by root on /dev/console
syncing files...

Press <Ctrl><A> forPSCSISelect(TM) Utility!


GNU GRUB  version 0.95  (637K lower / 2096064K upper memory)

===================================================
Solaris 10 10/08 s10x_u6wos_03 X86 
Solaris failsafe

=====================================================
		Use the  and  keys to select which entry is highlighted.
		Press enter to boot the selected OS, 'e' to edit the
		commands before booting, or 'c' for a command-line.
=====================================================

GNU GRUB  version 0.95  (637K lower / 2096064K upper memory)

=====================================================
findroot (pool_rpool,0,a)
kernel$ /platform/i86pc/multiboot -B $ZFS-BOOTFS 
module /platform/i86pc/boot_archive
================================================
		Use the  and  keys to select which entry is highlighted.
		Press 'b' to boot, 'e' to edit the selected command in the
		boot sequence, 'c' for a command-line, 'o' to open a new line
		after ('O' for before) the selected line, 'd' to remove the
		selected line, or escape to go back to the main menu.

[ Minimal BASH-like line editing is supported.  For the first word, TAB
lists possible command completions.  Anywhere else TAB lists the possible
completions of a device/filename.  ESC at any time exits. ]

grub edit> kernel$ /platform/i86pc/multiboot -B $ZFS-BOOTFS -s

 GNU GRUB  version 0.95  (637K lower / 2096064K upper memory)

=======================================================
findroot (pool_rpool,0,a)
kernel$ /platform/i86pc/multiboot -B $ZFS-BOOTFS -s 
module /platform/i86pc/boot_archive
======================================
		Use the  and  keys to select which entry is highlighted.
		Press 'b' to boot, 'e' to edit the selected command in the
 	boot sequence, 'c' for a command-line, 'o' to open a new line
		after ('O' for before) the selected line, 'd' to remove the
   selected line, or escape to go back to the main menu.
.
.
.
SunOS Release 5.10
Copyright 1983-2008 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.
Booting to milestone "milestone/single-user:default".
Hostname: pups Requesting System Maintenance Mode SINGLE USER MODE
Root password for system maintenance (control-d to bypass):
single-user privilege assigned to /dev/console.
Entering System Maintenance Mode
Jul  2 14:41:48 su: 'su root' succeeded for root on /dev/console Sun Microsystems Inc.
# who -r
who -r    .       run-level S  Jul  2 14:39     S      0  0 # 

Procedurex86: 如何交互式地引导系统

在需要指定备用内核或备用 /etc/system 文件时,请使用此过程引导系统。

开始之前

在使用 boot a 命令交互式引导基于 x86 的系统时,如要指定备用的 -/etc/system 文件,请执行以下步骤:

  1. 重新引导系统。


    # reboot
    

    如果系统显示 Press any key to reboot 提示,请按任意键以重新引导系统。

    在出现此提示时,您还可以使用“重置”按钮。如果系统已关闭,请使用电源开关打开系统。

    引导序列开始时,将显示 GRUB 主菜单。

  2. 要访问 GRUB 编辑菜单,请键入 e

  3. 使用方向键选择 kernelkernel$ 行。

  4. 键入 e 以编辑引导项行。

  5. 键入 -a 交互式引导系统,然后按回车键返回至上一菜单。

  6. 要交互式地引导系统,请键入 b

  7. 键入模块的缺省目录,或按 Enter 键接受缺省目录。


    Enter default directory for modules [/platform/i86pc/kernel /kernel /usr/kernel]:
  8. 键入备用的系统文件名 alternate-file


    Name of system file [etc/system]: /etc/system.bak
    

    在不提供备用文件的情况下按 Enter 键可接受缺省名称。

    修复损坏的 /etc/system 文件。

  9. 将系统重新引导至运行级别 3。


示例 12–11 x86: 交互式地引导系统


# reboot
syncing file systems... done
rebooting...

 
GNU GRUB  version 0.95  (637K lower / 2096064K upper memory)
===================================================
Solaris 10 10/08 s10x_u6wos_03 X86 
Solaris failsafe
=====================================================
		Use the  and  keys to select which entry is highlighted.
		Press enter to boot the selected OS, 'e' to edit the
		commands before booting, or 'c' for a command-line.
=====================================================


GNU GRUB  version 0.95  (637K lower / 2096064K upper memory)
=====================================================
findroot (pool_rpool,0,a)
kernel$ /platform/i86pc/multiboot -B $ZFS-BOOTFS 
module /platform/i86pc/boot_archive
======================================================
		Use the  and  keys to select which entry is highlighted.
		Press 'b' to boot, 'e' to edit the selected command in the
		boot sequence, 'c' for a command-line, 'o' to open a new line
		after ('O' for before) the selected line, 'd' to remove the
		selected line, or escape to go back to the main menu.

[ Minimal BASH-like line editing is supported.  For the first word, TAB
lists possible command completions.  Anywhere else TAB lists the possible
completions of a device/filename.  ESC at any time exits. ]

grub edit> kernel$ /platform/i86pc/multiboot -B $ZFS-BOOTFS -a
GNU GRUB  version 0.95  (637K lower / 2096064K upper memory)

===================================================
findroot (pool_rpool,0,a)
kernel$ /platform/i86pc/multiboot -B $ZFS-BOOTFS -a 
module /platform/i86pc/boot_archive
====================================================
.
.
.
Enter default directory for modules [/platform/i86pc/kernel /kernel /usr/kernel]:
Name of system file [/etc/system]:  /etc/system.bak
SunOS Release 5.10 Version Generic_137138-04 32-bit
Copyright 1983-2008 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.
Hostname: pups
NIS domain name is ....sfbay.sun.com
Reading ZFS config: done.
Mounting ZFS filesystems: (5/5)
pups console login: