pgsql initdb: directory “/var/opt/psb/db/pgsql” exists but is not empty

pgsql won’t start claiming that the directory is not empty

root@hp-ux:~ # /sbin/init.d/psbdb start
Initializing database. . .
The files belonging to this database system will be owned by user “sfmdb”.
This user must also own the server process.

The database cluster will be initialized with locale C.
The default database encoding has accordingly been set to SQL_ASCII.
The default text search configuration will be set to “english”.

initdb: directory “/var/opt/psb/db/pgsql” exists but is not empty
If you want to create a new database system, either remove or empty
the directory “/var/opt/psb/db/pgsql” or run initdb
with an argument other than “/var/opt/psb/db/pgsql”.

Move the directory then start the database again

root@hp-ux: # mv /var/opt/psb/db/pgsql /var/opt/psb/db/pgsql.bak

root@hp-ux:~ # /sbin/init.d/psbdb start
Initializing database. . .
The files belonging to this database system will be owned by user “sfmdb”.
This user must also own the server process.

The database cluster will be initialized with locale C.
The default database encoding has accordingly been set to SQL_ASCII.
The default text search configuration will be set to “english”.

fixing permissions on existing directory /var/opt/psb/db/pgsql … ok
creating subdirectories … ok
selecting default max_connections … 100
selecting default shared_buffers … 32MB
creating configuration files … ok
creating template1 database in /var/opt/psb/db/pgsql/base/1 … ok
initializing pg_authid … ok
initializing dependencies … ok
creating system views … ok
loading system objects’ descriptions … ok
creating conversions … ok
creating dictionaries … ok
setting privileges on built-in objects … ok
creating information schema … ok
vacuuming database template1 … ok
copying template1 to template0 … ok
copying template1 to postgres … ok

WARNING: enabling “trust” authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

/opt/psb/db/pgsql/bin/postgres -D /var/opt/psb/db/pgsql
or
/opt/psb/db/pgsql/bin/pg_ctl -D /var/opt/psb/db/pgsql -l logfile start

Verify if it is running

root@hp-ux:~ # ps -eaf | grep sfmdb
sfmdb 4585 4579 0 16:53:24 ? 0:00 postgres: stats collector process
sfmdb 4582 4579 0 16:53:24 ? 0:00 postgres: writer process
sfmdb 4583 4579 0 16:53:24 ? 0:00 postgres: wal writer process
sfmdb 4579 1 0 16:53:24 pts/4 0:00 /opt/psb/db/pgsql/bin/postmaster -D /var/opt/psb/db/pgsql
sfmdb 4584 4579 0 16:53:24 ? 0:00 postgres: autovacuum launcher process
root 4703 23017 0 16:53:54 pts/4 0:00 grep sfmdb

This database is used by HP System Fault Management. To repopulate the database, first check how many providers are there

root@hp-ux:~ # cimprovider -ls > /tmp/cimprovider_orig

User sfmdb must have a valid shell. In my system didn’t have so I changed the user’s shell.

root@hp-ux:~ # grep sfmdb /etc/passwd
sfmdb:*:103:20:System User Locked:/usr/users/sfmdb:/usr/bin/false
root@hp-ux:~ # usermod -s /sbin/sh sfmdb

Stopped the database and removed the directory

root@hp-ux:~ # /sbin/init.d/psbdb stop
root@hp-ux:~ # rm -r /var/opt/psb/db/pgsql

Reconfigured ProviderSvcsBase

root@hp-ux:~ # swconfig -x reconfigure=true -x autoselect_dependencies=false ProviderSvcsBase

======= 10/03/13 11:34:23 SAT BEGIN swconfig SESSION
(non-interactive) (jobid=hp-ux-0094)

* Session started for user “root@hp-ux”.

* Beginning Selection
* Target connection succeeded for “hp-ux:/”.
* Software selections:
ProviderSvcsBase,r=C.07.00.07.01,a=HP-UX_B.11.31_IA,v=HP
ProviderSvcsCore.CDM-SDK-CORE-IA,l=/,r=C.07.00.07,a=HP-UX_B.11.31_IA,v=HP,fr=C.07.00.07,fa=HP-UX_B.11.31_IA
ProviderSvcsCore.HTUI-CLI-IA,l=/,r=C.07.00.07,a=HP-UX_B.11.31_IA,v=HP,fr=C.07.00.07,fa=HP-UX_B.11.31_IA
ProviderSvcsCore.HTUI-COMM-IA,l=/,r=C.07.00.07,a=HP-UX_B.11.31_IA,v=HP,fr=C.07.00.07,fa=HP-UX_B.11.31_IA
ProviderSvcsCore.HTUI-HT-IA,l=/,r=C.07.00.07,a=HP-UX_B.11.31_IA,v=HP,fr=C.07.00.07,fa=HP-UX_B.11.31_IA
ProviderSvcsCore.HTUI-HWMAP-IA,l=/,r=C.07.00.07,a=HP-UX_B.11.31_IA,v=HP,fr=C.07.00.07,fa=HP-UX_B.11.31_IA
ProviderSvcsCore.PSB_CER,l=/,r=C.07.00.07,a=HP-UX_B.11.31_IA,v=HP,fr=C.07.00.07,fa=HP-UX_B.11.31_IA
ProviderSvcsCore.PSB_COMMON_LIB,l=/,r=C.07.00.07,a=HP-UX_B.11.31_IA,v=HP,fr=C.07.00.07,fa=HP-UX_B.11.31_IA
ProviderSvcsCore.PSB_COMMON_MOF,l=/,r=C.07.00.07,a=HP-UX_B.11.31_IA,v=HP,fr=C.07.00.07,fa=HP-UX_B.11.31_IA
ProviderSvcsCore.PSB_LOGSERV_IA,l=/,r=C.07.00.07,a=HP-UX_B.11.31_IA,v=HP,fr=C.07.00.07,fa=HP-UX_B.11.31_IA
ProviderSvcsCore.PSB_LOGSERV_LIB,l=/,r=C.07.00.07,a=HP-UX_B.11.31_IA,v=HP,fr=C.07.00.07,fa=HP-UX_B.11.31_IA
ProviderSvcsCore.PSB_MISC,l=/,r=C.07.00.07,a=HP-UX_B.11.31_IA,v=HP,fr=C.07.00.07,fa=HP-UX_B.11.31_IA
ProviderSvcsCore.SMPGSQL-DOC,l=/,r=C.07.00.07,a=HP-UX_B.11.31_IA,v=HP,fr=C.07.00.07,fa=HP-UX_B.11.31_IA
ProviderSvcsCore.SMPGSQL-LIB,l=/,r=C.07.00.07,a=HP-UX_B.11.31_IA,v=HP,fr=C.07.00.07,fa=HP-UX_B.11.31_IA
ProviderSvcsCore.SMPGSQL-RUN,l=/,r=C.07.00.07,a=HP-UX_B.11.31_IA,v=HP,fr=C.07.00.07,fa=HP-UX_B.11.31_IA
ProviderSvcsCore.SMPGSQL-SHA,l=/,r=C.07.00.07,a=HP-UX_B.11.31_IA,v=HP,fr=C.07.00.07,fa=HP-UX_B.11.31_IA
ProviderSvcsCore.SMPGSQL-SRC,l=/,r=C.07.00.07,a=HP-UX_B.11.31_IA,v=HP,fr=C.07.00.07,fa=
* Selection succeeded.

* Beginning Analysis
* Session selections have been saved in the file
“/root/.sw/sessions/swconfig.last”.
* “hp-ux:/”: 16 filesets have already been configured.
* Analysis succeeded.

* Beginning Execution
* The execution phase succeeded for “hp-ux:/”.
* Execution succeeded.

NOTE: More information may be found in the agent logfile using the
command “swjob -a log hp-ux-0094 @ hp-ux:/”.

======= 10/03/13 11:36:14 SAT END swconfig SESSION (non-interactive)
(jobid=hp-ux-0094)

Reconfigured SysFaultMgmt and all other providers that has its own database

root@hp-ux:~ # swconfig -x reconfigure=true -x autoselect_dependencies=false SysFaultMgmt WBEMP-FCP SAS-PROVIDER RAIDSA-PROVIDER WBEMP-Storage

======= 10/03/13 11:36:37 SAT BEGIN swconfig SESSION
(non-interactive) (jobid=hp-ux-0095)

* Session started for user “root@hp-ux”.

* Beginning Selection
* Target connection succeeded for “hp-ux:/”.
* Software selections:
SysFaultMgmt,r=C.07.05.08.01,a=HP-UX_B.11.31_IA/PA,v=HP
RAIDSA-PROVIDER.RAIDSA-PROV-RUN,l=/,r=B.11.31.1203.05.01,a=HP-UX_B.11.31_IA/PA,v=HP,fr=B.11.31.1203.05.01,fa=HP-UX_B.11.31_IA
SAS-PROVIDER.SAS-PROVIDER-RUN,l=/,r=B.11.31.1203.04.01,a=HP-UX_B.11.31_IA,v=HP,fr=B.11.31.1203.04.01,fa=HP-UX_B.11.31_IA
SFM-CORE.CPU-TEST-IA,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA
SFM-CORE.CTR_PRO_COMM,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA/PA
SFM-CORE.CTR_PRO_COREIA,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA
SFM-CORE.EMT_COREIA,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA
SFM-CORE.EMT_DOC,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA/PA
SFM-CORE.EMT_MAN,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA/PA
SFM-CORE.EVM_PRO_COMM,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA/PA
SFM-CORE.EVM_PRO_COREIA,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA
SFM-CORE.EVWEB_COMM,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA/PA
SFM-CORE.EVWEB_COREIA,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA
SFM-CORE.EVWEB_DOC,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA/PA
SFM-CORE.EVWEB_GUI_COMM,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA/PA
SFM-CORE.EVWEB_GUI_IA,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA
SFM-CORE.EVWEB_MAN,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA/PA
SFM-CORE.FMD_PRO_COMM,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA/PA
SFM-CORE.FMD_PRO_COREIA,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA
SFM-CORE.GS_COMM,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA/PA
SFM-CORE.GS_COREIA,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA
SFM-CORE.HAS-IA,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA
SFM-CORE.HS_PRO_COMM,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA/PA
SFM-CORE.HS_PRO_COREIA,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA
SFM-CORE.MEM-TEST-IA,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA
SFM-CORE.MISC_COMM,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA/PA
SFM-CORE.MISC_COREIA,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA
SFM-CORE.MISC_TOOLS,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA
SFM-CORE.SFMUI-PROPPAGE,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA/PA
SFM-CORE.SFMUI-PROPPAGE-IA,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA
SFM-CORE.SFM_MAN,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA/PA
SFM-CORE.SFM_PRO_COMM,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA/PA
SFM-CORE.SFM_PRO_IA,l=/,r=C.07.05.08,a=HP-UX_B.11.31_IA/PA,v=HP,fr=C.07.05.08,fa=HP-UX_B.11.31_IA
WBEMP-FCP.CSP-LIB,l=/,r=B.11.31.1203.05.01,a=HP-UX_B.11.31_IA/PA,v=HP,fr=B.11.31.1203.05.01,fa=HP-UX_B.11.31_IA
WBEMP-FCP.CSP-RUN,l=/,r=B.11.31.1203.05.01,a=HP-UX_B.11.31_IA/PA,v=HP,fr=B.11.31.1203.05.01,fa=HP-UX_B.11.31_IA/PA
WBEMP-FCP.FCP-IP-LIB,l=/,r=B.11.31.1203.05.01,a=HP-UX_B.11.31_IA/PA,v=HP,fr=B.11.31.1203.05.01,fa=HP-UX_B.11.31_IA
WBEMP-FCP.FCP-IP-RUN,l=/,r=B.11.31.1203.05.01,a=HP-UX_B.11.31_IA/PA,v=HP,fr=B.11.31.1203.05.01,fa=HP-UX_B.11.31_IA
WBEMP-FCP.FCP-LIB,l=/,r=B.11.31.1203.05.01,a=HP-UX_B.11.31_IA/PA,v=HP,fr=B.11.31.1203.05.01,fa=HP-UX_B.11.31_IA
WBEMP-FCP.FCP-NIP-LIB,l=/,r=B.11.31.1203.05.01,a=HP-UX_B.11.31_IA/PA,v=HP,fr=B.11.31.1203.05.01,fa=HP-UX_B.11.31_IA
WBEMP-FCP.FCP-NIP-RUN,l=/,r=B.11.31.1203.05.01,a=HP-UX_B.11.31_IA/PA,v=HP,fr=B.11.31.1203.05.01,fa=HP-UX_B.11.31_IA
WBEMP-FCP.FCP-RUN,l=/,r=B.11.31.1203.05.01,a=HP-UX_B.11.31_IA/PA,v=HP,fr=B.11.31.1203.05.01,fa=HP-UX_B.11.31_IA/PA
WBEMP-Storage.STORAGE-IP-LIB,l=/,r=B.11.31.1203.06.02,a=HP-UX_B.11.31_IA/PA,v=HP,fr=B.11.31.1203.06.02,fa=HP-UX_B.11.31_IA
WBEMP-Storage.STORAGE-IP-RUN,l=/,r=B.11.31.1203.06.02,a=HP-UX_B.11.31_IA/PA,v=HP,fr=B.11.31.1203.06.02,fa=HP-UX_B.11.31_IA
WBEMP-Storage.STORAGE-LWE-RUN,l=/,r=B.11.31.1203.06.02,a=HP-UX_B.11.31_IA/PA,v=HP,fr=B.11.31.1203.06.02,fa=HP-UX_B.11.31_IA
WBEMP-Storage.STORAGE-PROV-LIB,l=/,r=B.11.31.1203.06.02,a=HP-UX_B.11.31_IA/PA,v=HP,fr=B.11.31.1203.06.02,fa=HP-UX_B.11.31_IA
WBEMP-Storage.STORAGE-PROV-RUN,l=/,r=B.11.31.1203.06.02,a=HP-UX_B.11.31_IA/PA,v=HP,fr=B.11.31.1203.06.02,fa=HP-UX_B.11.31_IA
* Selection succeeded.

* Beginning Analysis
* Session selections have been saved in the file
“/root/.sw/sessions/swconfig.last”.
* “hp-ux:/”: 45 filesets have already been configured.
* Analysis succeeded.

* Beginning Execution

* The execution phase succeeded for “hp-ux:/”.
* Execution succeeded.

NOTE: More information may be found in the agent logfile using the
command “swjob -a log hp-ux-0095 @ hp-ux:/”.

======= 10/03/13 11:43:45 SAT END swconfig SESSION (non-interactive)
(jobid=hp-ux-0095)

Verify if there is the same number of providers comparing the old and new file

root@hp-ux:~ # cimprovider -ls > /tmp/cimprovider_new

Send a test to the monitors

root@hp-ux:~ # sfmconfig -t -a
Sending test event for fpl_em monitor.
Sending test event for ia64_corehw monitor.
Sending test event for memory monitor.
Sending test event for processor monitor.
Sending test event for backbone monitor.

Verify the event archive

root@hp-ux:~ # evweb eventviewer -L

EvArchNo Severity Event # Event Category Archive Time Summary
========= =========== ============== ============== =================== ==============================
5 Information 103 Processor 2013-10-03 11:44:31 Test event
4 Information 103 System Hard… 2013-10-03 11:44:30 Test event
3 Information 103 System Hard… 2013-10-03 11:44:30 Test event
2 Information 103 Memory 2013-10-03 11:44:22 Test event
1 Information 103 System Hard… 2013-10-03 11:44:18 Test event

Advertisement