Restoring svc repository

Solaris users are used to SMF taking care of a bunch of different services and configurations of their system. It keeps track of the state of a process or can be used to automate e.g. zfs snapshots. But what if SMF itself fails and gives you the following output:

svcs: Could not bind to repository server: repository server unavailable. Exiting.

What this means is that your SMF repo might be currupt and broken. Luckily backups are kept and you can go on restoring the repository by running the following command:

# /lib/svc/bin/restore_repository

Update:
As Ali correctly pointed out I was missing the part of the reboot that is needed to successfully restore a svc repository.
Here is the shell output of the whole thing.

root@ap1s000:~# /lib/svc/bin/restore_repository

See http://support.oracle.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.
/lib/svc/bin/restore_repository[71]: [: /: arithmetic syntax error
The following backups of /etc/svc/repository.db exist, from
oldest to newest:

manifest_import-20170109_210809
manifest_import-20170112_225021
boot-20170209_220311
manifest_import-20170209_220315
boot-20170309_101805
manifest_import-20170309_101809
boot-20170414_224728
boot-20170429_184237

The backups are named based on their type and the time what they were taken.
Backups beginning with "boot" are made before the first change is made to
the repository after system boot.  Backups beginning with "manifest_import"
are made after svc:/system/manifest-import:default finishes its processing.
The time of backup is given in YYYYMMDD_HHMMSS format.

Please enter either a specific backup repository from the above list to
restore it, or one of the following choices:

        CHOICE            ACTION
        ----------------  ----------------------------------------------
        boot              restore the most recent post-boot backup
        manifest_import   restore the most recent manifest_import backup
        -seed-            restore the initial starting repository  (All
                            customizations will be lost, including those
                            made by the install/upgrade process.)
        -quit-            cancel script and quit

Enter response [boot]:

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_20170517_214328
/etc/svc/repository-boot
    -- copied --> /etc/svc/repository.db
and the system will be rebooted with reboot(1M).

Proceed [yes/no]?

2 Replies to “Restoring svc repository”

    1. muehle Post author

      That is correct. Thanks for pointing this out.
      It will inform you of doing so though before actually rebooting.
      The post is quiet old and I just rushed through it back then.
      Will update the post and add shell output.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *