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

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 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:


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.
    -- renamed --> /etc/svc/repository.db_old_20170517_214328
    -- 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.


Leave a Reply

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