Unable to create actions client because the Encrypted Saved Objects plugin is missing encryption key

This is my first time to launch elastic security . There is a pop up showed

Unable to create actions client because the Encrypted Saved Objects plugin is missing encryption key. Please set xpack.encryptedSavedObjects.encryptionKey in the kibana.yml or use the bin/kibana-encryption-keys command. (500)

{
"name": "Error",
"body": {
"message": "Unable to create actions client because the Encrypted Saved Objects plugin is missing encryption key. Please set xpack.encryptedSavedObjects.encryptionKey in the kibana.yml or use the bin/kibana-encryption-keys command.",
"status_code": 500
},
"message": "Internal Server Error",
"stack": "Error: Internal Server Error\n at Fetch.fetchResponse (http://elasearch01.ln.edu.hk:5601/0df588b1a307/bundles/core/core.entry.js:1:226935)\n at async http://elasearch01.ln.edu.hk:5601/0df588b1a307/bundles/core/core.entry.js:1:224968\n at async http://elasearch01.ln.edu.hk:5601/0df588b1a307/bundles/core/core.entry.js:1:224925"
}

I tried to fix it to run kibana-encryption-keys. IT gave me error
[dcadmin@elasearch01 bin]$ ./kibana-encryption-keys
Error: ENOENT: no such file or directory, open '/usr/share/kibana/config/kibana.yml'
at Object.openSync (node:fs:573:18)
at readFileSync (node:fs:452:35)
at new EncryptionConfig (/usr/share/kibana/src/cli_encryption_keys/encryption_config.js:30:86)
at Object. (/usr/share/kibana/src/cli_encryption_keys/cli_encryption_keys.js:20:26)
at Module._compile (node:internal/modules/cjs/loader:1469:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
at Module.load (node:internal/modules/cjs/loader:1288:32)
at Function.Module._load (node:internal/modules/cjs/loader:1104:12)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at Module.patchedRequire (/usr/share/kibana/node_modules/require-in-the-middle/index.js:256:27)
[dcadmin@elasearch01 bin]$

Does anyone experience it ? Thanks

Is kibana running on this same host, i.e. elasearch01 ?

Is the error accurate, i.e. does the file /usr/share/kibana/config/kibana.yml exist on that system? How did you install kibana? (and elasticsearch)?

usual "fix" is to just add a line like

xpack.encryptedSavedObjects.encryptionKey: <min-32-byte-long-strong-encryption-key?

to kibana.yml, once you've located that file and restart kibana.

Replace "<min-32-byte-long-strong-encryption-key>" with say a random 32-char hex string.

Yes , elasticsearcha and kibana are running in same host . kibana.yml is located in /etc/kibana. The command searched wrong location . I have restarted kibana . It seems kibana-encryption-keys look for wrong file location . Would you shed some light ? Thanks

maybe, but did you try what I suggested?

And how did you install elasticsearch/kibana - from .rpm file, from .deb file, apt , yum, ...

Thanks . I got it fix . I executed the command with root user .