| 跳过导航链接 | |
| 退出打印视图 | |
|
引导和关闭 Oracle Solaris 11.1 系统 Oracle Solaris 11.1 Information Library (简体中文) |
2. x86: 管理 GRand Unified Bootloader(任务)
SPARC: 使用 OpenBoot PROM 显示和设置引导属性
SPARC: 如何使用 eeprom 实用程序设置缺省引导设备
以下过程介绍了如何将系统引导至不同状态,也称为运行级别引导
本节提供了以下过程:
系统的运行级别(也称为 init 状态)定义用户可以使用哪些服务和资源。系统一次只能在一个运行级别下运行。
Oracle Solaris 具有八个运行级别,下表对其进行了说明。在 /etc/inittab 文件中,缺省的运行级别指定为运行级别 3。
表 4-1 Oracle Solaris 运行级别
|
另外,svcadm 命令可用于更改系统的运行级别,方法是选择系统要在其下运行的里程碑。下表显示了与每个里程碑相对应的运行级别。
表 4-2 运行级别和 SMF 里程碑
|
init 进程将启动,并读取 svc:/system/environment:init SMF 服务中定义的属性,以设置任何环境变量。缺省情况下,仅设置 TIMEZONE 变量。
然后,init 读取 inittab 文件并执行下列操作:
执行 action 字段中包含 sysinit 的所有进程项,以便在用户登录系统之前执行所有特殊的初始化。
将启动活动传递到 svc.startd。
有关 init 进程如何使用 inittab 文件的详细描述,请参见 init(1M) 手册页。
一般来说,很少需要更改里程碑或运行级别。如有必要,使用 init 命令更改到某个运行级别也将更改里程碑,该命令是适用的命令。init 命令还适用于关闭系统。
但是,使用 none 里程碑引导系统可能对调试启动问题非常有用。none 里程碑没有等效的运行级别。有关更多信息,请参见《在 Oracle Solaris 11.1 中管理服务和故障》中的第 1 章 "管理服务(概述)"。
示例 4-3 确定系统的运行级别
who -r 命令的输出显示有关系统当前运行级别以及之前运行级别的信息。
$ who -r . run-level 3 Dec 13 10:10 3 0 S $
|
使用此过程将当前处于运行级别 0 的系统引导至运行级别 3。将相应地注释此过程中适用于 SPARC 或 x86 平台的任何信息。
# init 0
ok boot
# reboot
引导过程会显示一系列启动消息,并使系统进入运行级别 3。有关更多信息,请参见 boot(1M) 和 reboot(1M) 手册页。
引导过程成功完成后,将显示登录提示。
hostname console login:
示例 4-4 SPARC: 将系统引导至多用户状态(运行级别 3)
以下示例显示了在引导过程开始后将基于 SPARC 的系统引导至运行级别 3 时出现的消息。
ok boot Probing system devices Probing memory ChassisSerialNumber FN62030249 Probing I/O buses . . . . OpenBoot 4.30.4.a, 8192 MB memory installed, Serial #51944031. Ethernet address 0:3:ba:18:9a:5f, Host ID: 83189a5f. Rebooting with command: boot Boot device: /pci@1c,600000/scsi@2/disk@0,0:a File and args: SunOS Release 5.11 Version 11.1 64-bit Copyright (c) 1983, 2011, Oracle and/or its affiliates. All rights reserved. misc/forthdebug (455673 bytes) loaded Hardware watchdog enabled Hostname: portia-123 NIS domain name is solaris.example.com portia-123 console login: NIS domain name is solaris.example.com
示例 4-5 x86: 将系统引导至多用户状态(运行级别 3)
以下示例显示了在引导过程开始后将基于 x86 的系统引导至运行级别 3 时出现的消息。由于快速重新引导功能是此发行版(在 x86 平台上)的缺省设置,因此使用 reboot 命令引导系统将对系统启动快速重新引导,这意味着将绕过 BIOS 或 UEFI 固件。另外,系统引导期间不显示 GRUB 菜单。如果需要在引导时访问系统固件或编辑 GRUB 菜单,请使用带有 -p 选项的 reboot 命令。请参见对启用了快速重新引导的系统启动标准重新引导。
~# reboot
Apr 23 13:30:29 system-04 reboot: initiated by ... on /dev/console
Terminated
system-04% updating /platform/i86pc/boot_archive
updating /platform/i86pc/amd64/boot_archive
system-04 console login: syncing file systems... done
SunOS Release 5.11 Version 11.1 64-bit
Copyright (c) 1983, 2012, Oracle and/or its affiliates. All rights reserved.
Hostname: system-04
system-04 console login: <username>
Password: xxxxxx
Last login: Mon Apr 23 11:06:05 on console
Oracle Corporation SunOS 5.11 11.1 April 2012
# who -r
run-level 3 Apr 23 13:31 3 0 S
将系统引导至单用户状态以执行系统维护,如备份文件系统或对其他系统问题进行故障排除。
# init 0
ok boot -s
SINGLE USER MODE Root password for system maintenance (control-d to bypass): xxxxxx
# reboot -p
由于快速重新引导功能在缺省情况下处于启用状态,因此必须在重新引导系统时指定 -p 选项,从而在引导时显示 GRUB 菜单。要禁用快速重新引导功能以便无需指定 -p 选项,请参见更改缺省快速重新引导行为。
有关在引导时编辑 GRUB 菜单的更多信息,请参见x86: 通过在引导时编辑 GRUB 菜单添加内核参数。
# who -r
示例 4-6 SPARC: 将系统引导至单用户状态(运行级别 S)
以下示例显示了在引导过程开始后将基于 SPARC 的系统引导至运行级别 S 时出现的消息。
# init 0
# svc.startd: The system is coming down. Please wait.
svc.startd: 122 system services are now being stopped.
Mar 5 10:30:33 system1 syslogd: going down on signal 15
svc.startd: Killing user processes.
umount: /ws busy
umount: /home busy
Mar 5 17:30:50 The system is down. Shutdown took 70 seconds.
syncing file systems... done
Program terminated
{1c} ok boot -s
SC Alert: Host System has Reset
NOV 17 21:46:59 ERROR: System memory downgraded to 2-channel mode from 4-channel mode
NOV 17 21:47:00 ERROR: Available system memory is less than physically installed memory
NOV 17 21:47:00 ERROR: System DRAM Available: 008192 MB Physical: 016384 MB
Sun Fire T200, No Keyboard
.
.
.
Ethernet address 0:14:4f:1d:e8:da, Host ID: 841de8da.
ERROR: The following devices are disabled:
MB/CMP0/CH2/R0/D0
Boot device: /pci@7c0/pci@0/pci@1/pci@0,2/LSILogic,sas@2/disk@0,0:a
File and args: -s
SunOS Release 5.11 Version 11.1 64-bit
Copyright (c) 1983, 2012, Oracle and/or its affiliates. All rights reserved.
NOTICE: Hypervisor does not support CPU power management
Booting to milestone "milestone/single-user:default".
Hostname: system1
Requesting System Maintenance Mode
SINGLE USER MODE
Enter root password (control-d to bypass): xxxxxx
single-user privilege assigned to root on /dev/console.
Entering System Maintenance Mode
Mar 5 10:36:14 su: 'su root' succeeded for root on /dev/console
Oracle Corporation SunOS 5.11 11.1 January 2012
root@system1:~# who -r
run-level S Mar 5 10:35 S 0 0
root@tsystem1:~#示例 4-7 x86: 将系统引导至单用户状态(运行级别 S)
以下示例显示了在引导过程开始后将基于 x86 的系统引导至运行级别 S 时出现的消息。
root@system-04:~# init 0
root@system-04:~# svc.startd: The system is coming down. Please wait.
svc.startd: 129 system services are now being stopped.
Apr 23 13:51:28 system-04 syslogd: going down on signal 15
svc.startd: Killing user processes.
umount: /home busy
Apr 23 13:51:36 The system is down. Shutdown took 26 seconds.
syncing file systems... done
Press any key to reboot.
.
.
.LSI Corporation MPT SAS BIOS
MPTBIOS-6.26.00.00 (2008.10.14)
Copyright 2000-2008 LSI Corporation.
Initializing..|Press F2 to runS POPUP (CTRL+P on Remote Keyboard)
Press F12 to boot from the network (CTRL+N on Remote Keyboard)
System Memory : 8.0 GB , Inc.
Auto-Detecting Pri Master..ATAPI CDROM 0078
Ultra DMA Mode-2
.
.
.
GNU GRUB version 1.99,5.11.0.175.1.0.0.14.0
****************************************************************************
*Oracle Solaris 11.1 *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
****************************************************************************
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 1.99,5.11.0.175.1.0.0.14.0
****************************************************************************
* setparams 'Oracle Solaris 11.1' *
* *
* insmod part_msdos *
* insmod part_sunpc *
* insmod part_gpt *
* insmod zfs *
* search --no-floppy --fs-uuid --set=root cd03199c4187a7d7 *
* zfs-bootfs /ROOT/s11u1/@/ zfs_bootfs *
* set kern=/platform/i86pc/kernel/amd64/unix *
* echo -n "Loading ${root}/ROOT/s11u1 /@$kern: " *
* $multiboot /ROOT/s11u1/@/$kern $kern -B $zfs_bootfs -s
* set gfxpayload="1024x768x32;1024x768x16;800x600x16;640x480x16;640x480x1\ *
* 5;640x480x32" **
****************************************************************************
Minimum Emacs-like screen editing is supported. TAB lists
completions. Press Ctrl-x or F10 to boot, Ctrl-c or F2 for
a command-line or ESC to discard edits and return to the GRUB menu.
Booting a command list
Loading hd0,msdos1,sunpc1/ROOT/s11u1/@/platform/i86pc/kernel/amd64/unix: 0
%...done.
Loading hd0,msdos1,sunpc1/ROOT/s11u1/@/platform/i86pc/amd64/boot_archive:
0%...
.
.
.
SunOS Release 5.11 Version 11.1 64-bit
Copyright (c) 1983, 2012, Oracle and/or its affiliates. All rights reserved.
NOTICE: kmem_io_2G arena created
Booting to milestone "milestone/single-user:default".
Hostname: system-04
Requesting System Maintenance Mode
SINGLE USER MODE
Enter user name for system maintenance (control-d to bypass): root
Enter root password (control-d to bypass): xxxxxxx
single-user privilege assigned to root on /dev/console.
Entering System Maintenance Mode
May 8 11:13:44 su: 'su root' succeeded for root on /dev/console
Oracle Corporation SunOS 5.11 11.1 April 2012
You have new mail.
root@system-04:~# who -r
. run-level S Apr 23 14:49 S 0 0
如果由于原始文件损坏或系统未引导而需要在引导过程中指定备用内核或 /etc/system 文件,则以交互方式引导系统非常有用。使用以下过程以交互方式引导系统。
以下过程介绍了在仅有一个引导环境的系统的交互式引导过程中,如何指定备用 /etc/system 文件。或者,可以引导备用引导环境。
# cp /etc/system /etc/system.bak # cp /boot/solaris/filelist.ramdisk /boot/solaris/filelist.ramdisk.orig # echo "etc/system.bak" >> /boot/solaris/filelist.ramdisk
Name of system file [etc/system]: /etc/system.bak
在不提供任何信息的情况下按回车键将接受系统缺省设置。
注 - /etc/devices/retire_store 文件是故障管理体系结构 (Fault Management Architecture, FMA) 弃用的设备的后备存储。系统不再使用这些设备。如有必要,可以为 /etc/devices/retire_store 提供备用文件。但是,出于恢复的目的,指定 /dev/null 是引导系统(不考虑 /etc/devices/retire_store 文件的内容)的最佳选择。
# reboot
示例 4-8 SPARC: 以交互方式引导系统
在以下示例中,接受了系统缺省值(显示在方括号 [] 中)。
# init 0
# svc.startd: The system is coming down. Please wait.
svc.startd: 121 system services are now being stopped.
Apr 22 00:34:25 system-28 syslogd: going down on signal 15
svc.startd: Killing user processes.
umount: /home busy
Apr 22 06:34:37 The system is down. Shutdown took 18 seconds.
syncing file systems... done
Program terminated
{11} ok boot -a
SC Alert: Host System has Reset
Sun Fire T200, No Keyboard
Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
OpenBoot 4.30.4.d, 16256 MB memory available, Serial #74139288.
Ethernet address 0:14:4f:6b:46:98, Host ID: 846b4698.
Boot device: /pci@780/pci@0/pci@9/scsi@0/disk@0,0:a File and args: -a
Name of system file [/etc/system]: /etc/system.bak
SunOS Release 5.11 Version 11.1 64-bit
Copyright (c) 1983, 2012, Oracle and/or its affiliates. All rights reserved.
Retire store [/etc/devices/retire_store] (/dev/null to bypass): Press Return
system-28 console login:示例 4-9 x86: 以交互方式引导系统
在下面的示例中,以交互方式引导基于 x86 的系统。
root@system-04:~# reboot -p
Apr 23 15:37:04 system-04 reboot: initiated by user1 on /dev/consoleTerminated
system-04% syncing file systems... done
rebooting...
.
.
.LSI Corporation MPT SAS BIOS
MPTBIOS-6.26.00.00 (2008.10.14)
Copyright 2000-2008 LSI Corporation.
Initializing..|Press F2 to runS POPUP (CTRL+P on Remote Keyboard)
Press F12 to boot from the network (CTRL+N on Remote Keyboard)
System Memory : 8.0 GB , Inc.
Auto-Detecting Pri Master..ATAPI CDROM 0078
Ultra DMA Mode-2
GNU GRUB version 1.99,5.11.0.175.1.0.0.14.0
****************************************************************************
*Oracle Solaris 11.1 *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
****************************************************************************
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 1.99,5.11.0.175.1.0.0.15.1
+--------------------------------------------------------------------------+
| setparams 'Oracle Solaris 11.1' |
| |
| insmod part_msdos |
| insmod part_sunpc |
| insmod part_gpt |
| insmod zfs |
| search --no-floppy --fs-uuid --set=root cd03199c4187a7d7 |
| zfs-bootfs /ROOT/s11u1/@/ zfs_bootfs |
| set kern=/platform/i86pc/kernel/amd64/unix |
| echo -n "Loading ${root}/ROOT/s11u1/@$kern: " |
| $multiboot /ROOT/s11u1/@/$kern $kern -B $zfs_bootfs -a |
| set gfxpayload="1024x768x32;1024x768x16;800x600x16;640x480x16;640x480x1\ |
+--------------------------------------------------------------------------+
Minimum Emacs-like screen editing is supported. TAB lists
completions. Press Ctrl-x or F10 to boot, Ctrl-c or F2 for
a command-line or ESC to discard edits and return to the GRUB menu.
Booting a command list
Loading hd0,msdos1,sunpc1/ROOT/s11u1/@/platform/i86pc/kernel/amd64/unix: 0
%...done.
Loading hd0,msdos1,sunpc1/ROOT/s11u1/@/platform/i86pc/amd64/boot_archive:
0%...
.
.
.
Name of system file [/etc/system]: /etc/system.bak
SunOS Release 5.11 Version 11.1 64-bit
Copyright (c) 1983, 2012, Oracle and/or its affiliates. All rights reserved.: 0
Retire store [/etc/devices/retire_store] (/dev/null to bypass): Press Return
NOTICE: kmem_io_2G arena created
Hostname: system-04
system-04 console login: