Corrupt services repository (SMF)
===============================================================================
Symptoms
—————————————
Comands ‘svcs -a’, ‘svcs -x’ or ‘pkg’ show errors like these:
– UnknownSysrepoConfiguration
– repository server unavailable
Examples:
root@host:/root# svcs -a
svcs: Could not bind to repository server: repository server unavailable. Exiting.
root@host:/root# pkg publisher
Traceback (most recent call last):
File “/usr/bin/pkg”, line 6291, in handle_errors
__ret = func(*args, **kwargs)
File “/usr/bin/pkg”, line 6173, in main_func
api_inst = __api_alloc(mydir, provided_image_dir, pkg_image_used)
File “/usr/bin/pkg”, line 1458, in __api_alloc
exact_match=exact_match)
File “/usr/lib/python2.7/vendor-packages/pkg/client/api.py”, line 369, in __init__
cmdpath=self.cmdpath)
File “/usr/lib/python2.7/vendor-packages/pkg/client/image.py”, line 232, in __init__
progtrack)
File “/usr/lib/python2.7/vendor-packages/pkg/client/image.py”, line 527, in find_root
startd=startd, progtrack=progtrack)
File “/usr/lib/python2.7/vendor-packages/pkg/client/image.py”, line 980, in __set_dirs
self.cfg.get_policy(“use-system-repo”))
File “/usr/lib/python2.7/vendor-packages/pkg/client/imageconfig.py”, line 1116, in __init__
raise apx.UnknownSysrepoConfiguration()
UnknownSysrepoConfiguration: pkg is configured to use the system repository (via the use-system-repo
property) but it could not get the host and port from
svc:/application/pkg/zones-proxy-client nor svc:/application/pkg/system-repository, and
the PKG_SYSREPO_URL environment variable was not set. Please try enabling one
of those services or setting the PKG_SYSREPO_URL environment variable.
pkg: This is an internal error in pkg(5) version 79ccaf5f5ee2. Please log a
Service Request about this issue including the information above and this
message.
Verify the database is corrupt
—————————————
Check error log files
root@host:/root# ls -ltr /var/svc/log -rw-r--r-- 1 root root 26374 May 24 03:10 system-system-log:default.log -rw-r--r-- 1 root root 480930 May 24 16:44 application-management-common-agent-container-1:oem-ec.log -rw-r--r-- 1 root root 28043386 May 24 16:44 svc.startd.log.0 -rw-r--r-- 1 root root 28735172 May 24 16:44 application-scn-uce-scheduler:default.log.0 -rw-r--r-- 1 root root 58958043 May 24 16:44 application-scn-db:remote.log.0 -rw-r--r-- 1 root root 46441665 May 24 16:44 application-scn-db:default.log.0 -rw-r--r-- 1 root root 7410 May 24 16:44 system-fm-smtp-notify:default.log -rw-r--r-- 1 root root 0 May 25 03:10 svc.startd.log -rw-r--r-- 1 root root 0 May 25 03:10 application-scn-db:default.log -rw-r--r-- 1 root root 0 May 25 03:10 application-scn-uce-scheduler:default.log -rw-r--r-- 1 root root 0 May 25 03:10 application-scn-db:remote.log # cat svc.startd.log.0 [...] May 24 16:44:27/54118989: svc:/application/scn/uce-scheduler:default: couldn't note log location: Software caused connection abort May 24 16:44:27/54118989 ERROR: svc:/application/scn/uce-scheduler:default: get_method decode instance FMRI failed: connection to repository broken May 24 16:44:27/54118989 ERROR: svc:/application/scn/uce-scheduler:default: instance libscf_get_method failed May 24 16:44:27/54118989: application/scn/uce-scheduler:default failed: transitioned to maintenance (see 'svcs -xv' for details) May 24 16:44:27/2: svc.configd exited with exit status 26624. Reason: database corrupt. Repair ---------------------------------------
Follow the official note form Oracle:
How to Repair a Corrupt Repository
Basically it consists in launching the following script and point the last database backup saved in the previous boot (please note it will reboot the system AUTOMATICALLY !!!):
root@host:/root# /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-20150113_121523 manifest_import-20150113_121550 manifest_import-20161019_143213 manifest_import-20161021_115205 boot-20170419_160655 boot-20170419_163444 boot-20170420_144921 boot-20170420_152337 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]: 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_20170613_114250 /etc/svc/repository-boot -- copied --> /etc/svc/repository.db and the system will be rebooted with reboot(1M). Proceed [yes/no]? yes Quiescing svc.startd(1M) and svc.configd(1M): done. /etc/svc/repository.db -- renamed --> /etc/svc/repository.db_old_20170613_114250 /etc/svc/repository-boot -- copied --> /etc/svc/repository.db The backup repository has been successfully restored. Rebooting in 5 seconds. error: invalid argument Could not get audit remote server configuration. Connection to b0d0p4d3 closed by remote host. Connection to b0d0p4d3 closed. Checking --------------------------------------- root@host:/root# svcs -a STATE STIME FMRI legacy_run 12:01:20 lrc:/etc/rc2_d/S89PRESERVE legacy_run 12:02:37 lrc:/etc/rc2_d/S99ITMAgnts1 legacy_run 12:03:25 lrc:/etc/rc3_d/S90sisidsagent legacy_run 12:03:25 lrc:/etc/rc3_d/S97itmd legacy_run 12:03:25 lrc:/etc/rc3_d/S97scriptd_start_stop disabled 12:01:04 svc:/network/install:default disabled 12:01:05 svc:/network/ipsec/ike:default [...]