> For the complete documentation index, see [llms.txt](https://docs.openiam.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.openiam.com/troubleshooting/databases/pad-block-corrupted.md).

# PAD block corrupted

Recovering from PAD block corruption, which means rebuilding the secret store — so every secret it holds has to be captured first.

| Symptom                                                   | Likely cause                                                                  | Resolution                      |
| --------------------------------------------------------- | ----------------------------------------------------------------------------- | ------------------------------- |
| Users cannot sign in with credentials known to be correct | The master key is null or corrupted, so no stored credential can be decrypted | Rebuild the secret store, below |
| `Invalid credentials` with a valid username and password  | The same                                                                      | The same                        |

{% hint style="danger" %}
**This procedure destroys and rebuilds the secret store.** Everything in it is regenerated: database credentials for every schema, the message broker, the cache, the search tier and the mail server. User passwords are reset to one shared value, and managed system and synchronization passwords are cleared. Plan a maintenance window, and back up the Vault and ETCD data first if you can.

**Capture every secret before you start.** Once ETCD is wiped they cannot be recovered, and the bootstrap will ask for them.
{% endhint %}

{% hint style="info" %}
Written for an RPM deployment. The same sequence applies elsewhere — substitute the equivalent service management commands.
{% endhint %}

## Capture the secrets first

Run this from `/usr/local/openiam/utils/vault/`. It prints every secret the store holds, so you have them to re-enter during bootstrap:

{% code overflow="wrap" expandable="true" %}

```bash
cd /usr/local/openiam/utils/vault/

for P in \
  vault.secret.jdbc.username vault.secret.jdbc.password \
  vault.secret.activiti.jdbc.username vault.secret.activiti.jdbc.password \
  vault.secret.auditlog.jdbc.username vault.secret.auditlog.jdbc.password \
  vault.secret.batchtasks.jdbc.username vault.secret.batchtasks.jdbc.password \
  vault.secret.certification.jdbc.username vault.secret.certification.jdbc.password \
  vault.secret.groovy.jdbc.username vault.secret.groovy.jdbc.password \
  vault.secret.pbac.jdbc.username vault.secret.pbac.jdbc.password \
  vault.secret.privacy.jdbc.username vault.secret.privacy.jdbc.password \
  vault.secret.db.root.password \
  vault.secret.rabbitmq.username vault.secret.rabbitmq.password \
  vault.secret.redis.password \
  vault.secret.opensearch.username vault.secret.opensearch.password \
  vault.secret.mail.username vault.secret.mail.password ; do
    printf '%s = %s\n' "$P" "$(./vault.fetch.property.sh "$P")"
done
```

{% endcode %}

{% hint style="warning" %}
**The list grows with the platform.** Each new subsystem that owns a database adds a credential pair — `pbac`, `privacy` and `certification` all arrived after the 4.2.1.x line. An older copy of this procedure captured only the core and Activiti pairs, which leaves six schemas without credentials after the rebuild. Compare the list above against your own release before relying on it.
{% endhint %}

## Rebuild the store

{% stepper %}
{% step %}
**Stop the OpenIAM services**, before touching Vault or ETCD.

```bash
openiam-cli stop
```

{% endstep %}

{% step %}
**Stop the Vault server.**

```bash
pkill -9 vault
```

{% endstep %}

{% step %}
**Clear the ETCD storage.** Stop it, remove its data, and start it again.

```bash
systemctl stop etcd
rm -rf /var/lib/etcd/default.etcd/member/
systemctl start etcd
```

{% endstep %}

{% step %}
**Start Vault.**

```bash
/usr/local/openiam/utils/vault/start.sh
```

{% endstep %}

{% step %}
**Bootstrap it**, re-entering the values you captured when prompted.

```bash
/usr/local/openiam/utils/vault/bootstrap.sh
```

{% endstep %}

{% step %}
**Reset the stored credentials in the database.** They were encrypted with the key that is now gone, so none of them can be read.

{% code overflow="wrap" %}

```sql
UPDATE LOGIN SET PASSWORD='passwd00';
DELETE FROM USER_KEY;
UPDATE MANAGED_SYS SET PSWD = NULL;
DELETE FROM PWD_HISTORY;
DELETE FROM USER_IDENTITY_ANS;
UPDATE SYNCH_CONFIG SET SRC_PASSWORD = NULL;
DELETE FROM OAUTH_TOKEN;
DELETE FROM AUTH_STATE_AUTH_PARAM_XREF;
DELETE FROM USER_AUTH_PARAM;
```

{% endcode %}

[Resetting passwords](/troubleshooting/signing-in/resetting_passwords.md) covers what each statement clears and what is left to put back.
{% endstep %}

{% step %}
**Start OpenIAM.**

```bash
openiam-cli start
```

{% endstep %}

{% step %}
**Sign in as `sysadmin`** with `passwd00` to confirm the recovery worked — then change it, and put back every managed system and synchronization password, which are now empty.
{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.openiam.com/troubleshooting/databases/pad-block-corrupted.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
