Solaris のシステム管理 (基本編)

Procedure破壊されたリポジトリを修復する方法

この手順は、破壊されたリポジトリをデフォルトのリポジトリと交換する方法を示しています。リポジトリデーモン svc.configd が起動すると、設定リポジトリの整合性チェックが行われます。このリポジトリは、/etc/svc/repository.db に格納されています。このリポジトリは、次のいずれかが原因で破壊されることがあります。

整合性チェックに失敗すると、svc.configd デーモンは次のようなメッセージをコンソールに書き出します。


svc.configd: smf(5) database integrity check of:

    /etc/svc/repository.db

  failed.  The database might be damaged or a media error might have
  prevented it from being verified.  Additional information useful to
  your service provider is in:

    /etc/svc/volatile/db_errors

  The system will not be able to boot until you have restored a working
  database.  svc.startd(1M) will provide a sulogin(1M) prompt for recovery
  purposes.  The command:

    /lib/svc/bin/restore_repository

  can be run to restore a backup version of your repository. See
  http://sun.com/msg/SMF-8000-MY for more information.

その後 svc.startd デーモンが終了し、sulogin が起動して保守作業を行えるようになります。

  1. sulogin プロンプトで root パスワードを入力します。sulogin では、root ユーザーはシステム保守モードに入ってシステムを修復できます。

  2. 次のコマンドを実行します。


    # /lib/svc/bin/restore_repository
    

    このコマンドを実行すると、破壊されていないバックアップの復元に必要な手順が示されます。SMF では、システムの重要な局面でリポジトリのバックアップが自動的に作成されます。詳細は、「SMF リポジトリのバックアップ」を参照してください。

    /lib/svc/bin/restore_repository コマンドが起動すると、次のようなメッセージが表示されます。


    Repository Restore utility
    See http://sun.com/msg/SMF-8000-MY for more information on the use of
    this script to restore backup copies of the smf(5) repository.
    
    If there are any problems which need human intervention, this script
    will give instructions and then exit back to your shell.
    
    Note that upon full completion of this script, the system will be
    rebooted using reboot(1M), which will interrupt any active services.

    復元するシステムがローカルゾーンでない場合は、読み取り権と書き込み権を付けて / ファイルシステムおよび /usr ファイルシステムをマウントし直しデータベースを復元する方法が表示されます。これらの説明を表示したあと、スクリプトは終了します。エラーの発生に特に注意しながら、これらの説明に従います。

    書き込み権を付けてルート (/) ファイルシステムをマウントしたあと、またはシステムがローカルゾーンである場合は、復元するリポジトリのバックアップを選択するよう求められます。


    The following backups of /etc/svc/repository.db exists, from
    oldest to newest:
    
    ... list of backups ...

    バックアップには、バックアップのタイプとバックアップが作成された時間に基づいて名前が付けられています。boot で始まっているのは、システムのブート後、リポジトリに対して最初の変更が行われる前に作成されたバックアップです。manifest_import で始まっているのは、svc:/system/manifest-import:default のプロセス終了後に作成されたバックアップです。バックアップ時間は、YYYYMMDD_HHMMSS 形式で記録されます。

  3. 適切な応答を入力します。

    通常は、最新のバックアップオプションを選択します。

    Please enter one of:
            1) boot, for the most recent post-boot backup
            2) manifest_import, for the most recent manifest_import backup.
            3) a specific backup repository from the above list
            4) -seed-, the initial starting repository. (All customizations
               will be lost.)
            5) -quit-, to cancel.
    
    Enter response [boot]:

    復元するバックアップを指定しないで Enter キーを押した場合は、[] で囲まれたデフォルトの応答が選択されます。-quit- を選択すると、restore_repository スクリプトが終了して、シェルスクリプトに戻ります。


    注 –

    -seed- を選択すると、seed リポジトリが復元されます。このリポジトリは、初期インストールとアップグレード時に使用する目的で作成されたものです。seed リポジトリを回復の目的で使用するのは、最後の手段にしてください。


    復元するバックアップを選択すると、妥当性検査が行われ、その整合性がチェックされます。なんらかの問題があると、restore_repository コマンドによってエラーメッセージが表示され、別のバックアップを選択するよう促されます。有効なバックアップを選択すると、次の情報が表示され、最終確認を入力するよう促されます。

    After confirmation, the following steps will be taken:
    
    svc.startd(1M) and svc.configd(1M) will be quiesced, if running.
    /etc/svc/repository.db
        -- renamed --> /etc/svc/repository.db_old_YYYYMMDD_HHMMSS
    /etc/svc/volatile/db_errors
        -- copied --> /etc/svc/repository.db_old_YYYYMMDD_HHMMSS_errors
    repository_to_restore
        -- copied --> /etc/svc/repository.db
    and the system will be rebooted with reboot(1M).
    
    Proceed [yes/no]?
  4. yes と入力して障害を修復します。

    restore_repository コマンドが表示されたアクションをすべて実行すると、システムがリブートします。