系统管理指南:基本管理

Procedure系统引导期间当 system/filesystem/local:default 服务失败时,如何强制出现 sulogin 提示符

引导 Solaris OS 时不需要的本地文件系统由 svc:/system/filesystem/local:default 服务挂载。当其中的任何文件系统无法挂载时,该服务将进入维护状态。系统将继续启动,并将启动不依赖 filesystem/local 的任何服务,而要求 filesystem/local 联机才能通过相关性启动的服务将不会启动。

要更改系统的配置,以在该服务失败后立即出现 sulogin 提示符(而不是允许系统继续启动),请按照下面的过程操作。

  1. 修改 system/console-login 服务。


    # svccfg -s svc:/system/console-login
    svc:/system/console-login> addpg site,filesystem-local dependency
    svc:/system/console-login> setprop site,filesystem-local/entities = fmri: svc:/system/filesystem/local
    
    svc:/system/console-login> setprop site,filesystem-local/grouping = astring: require_all
    
    svc:/system/console-login> setprop site,filesystem-local/restart_on = astring: none
    
    svc:/system/console-login> setprop site,filesystem-local/type = astring: service
    
    svc:/system/console-login> end
    
  2. 刷新该服务。


    # svcadm refresh console-login
    

示例 19–18 使用 Oracle Solaris JumpStart 强制出现 sulogin 提示符

将下面的命令保存到一个脚本中并将该脚本另存为 /etc/rcS.d/S01site-customfs


#!/bin/sh
#
# This script adds a dependency from console-login -> filesystem/local
# This forces the system to stop the boot process and drop to an sulogin prompt
# if any file system in filesystem/local fails to mount.

PATH=/usr/sbin:/usr/bin
export PATH

	svccfg -s svc:/system/console-login << EOF
addpg site,filesystem-local dependency
setprop site,filesystem-local/entities = fmri: svc:/system/filesystem/local
setprop site,filesystem-local/grouping = astring: require_all
setprop site,filesystem-local/restart_on = astring: none
setprop site,filesystem-local/type = astring: service
EOF

svcadm refresh svc:/system/console-login

[ -f /etc/rcS.d/S01site-customfs ] &&
    rm -f /etc/rcS.d/S01site-customfs

故障排除

system/filesystem/local:default 服务失败时,应当使用 svcs -vx 命令来标识该失败。在错误得以修复之后,可以使用下面的命令来清除错误状态并允许系统继续引导: svcadm clear filesystem/local