系统管理指南:基本管理

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 #