Chia-Network / chia-docker

Apache License 2.0
215 stars 345 forks source link

No keys are present in the keychain. Generate them with 'chia keys generate' #16

Closed chechuironman closed 3 years ago

chechuironman commented 3 years ago

hey guys,

im running this on kubernetes, and mounting the key file as a secret...when I do "cat $keys" I can see my 24 words...but log still saying are not present...as the title says any idea?

kimklai commented 3 years ago

You need to export the key file path to container. By using keys="/blabla/key_file" as docker parameters or env variables. But personally, I don't like this method since the 24 words key file is so important that I don't want to deploy it on drive the plant text...

You can import the key manually inside the container by command "chia keys add". And assign the docker parameter "keys"="" (empty) to skip generating new keys.

chechuironman commented 3 years ago

still getting the error...and when I do "echo $keys" the 24 words appear

kimklai commented 3 years ago

you need to post all info/workflow. or just dig into the entrypoint.sh; it's just a simple script that would add the "keys" file when start up, otherwise it would generate a new key even if you already have a key inside container.

chechuironman commented 3 years ago

what is the key file format...do you have an example?

kimklai commented 3 years ago

the key file contains 24 words.

mengland17 commented 3 years ago

Hi @chechuironman ! Just making sure you were able to resolve this issue?

SalimiHabib commented 3 years ago

same problem

first try with - keys="/run/secrets" then - keys="/run/secrets/se.txt"

finally work time was ended with no chance

below is log from container

Chia directory /root/.chia/mainnet No keys are present in the keychain. Generate them with 'chia keys generate' /root/.chia/mainnet already exists, no migration action taken Traceback (most recent call last): File "/chia-blockchain/venv/bin/chia", line 33, in sys.exit(load_entry_point('chia-blockchain', 'console_scripts', 'chia')()) File "/chia-blockchain/chia/cmds/chia.py", line 77, in main cli() # pylint: disable=no-value-for-parameter File "/chia-blockchain/venv/lib/python3.8/site-packages/click/core.py", line 829, in call return self.main(args, kwargs) File "/chia-blockchain/venv/lib/python3.8/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/chia-blockchain/venv/lib/python3.8/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/chia-blockchain/venv/lib/python3.8/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/chia-blockchain/venv/lib/python3.8/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, ctx.params) File "/chia-blockchain/venv/lib/python3.8/site-packages/click/core.py", line 610, in invoke return callback(args, *kwargs) File "/chia-blockchain/venv/lib/python3.8/site-packages/click/decorators.py", line 21, in new_func return f(get_current_context(), args, **kwargs) File "/chia-blockchain/chia/cmds/keys.py", line 52, in add_cmd mnemonic = Path(filename).read_text().rstrip() File "/usr/lib/python3.8/pathlib.py", line 1232, in read_text with self.open(mode='r', encoding=encoding, errors=errors) as f: File "/usr/lib/python3.8/pathlib.py", line 1218, in open return io.open(self, mode, buffering, encoding, errors, newline, File "/usr/lib/python3.8/pathlib.py", line 1074, in _opener return self._accessor.open(self, flags, mode) FileNotFoundError: [Errno 2] No such file or directory: '"/run/secrets/se.txt"' Plots directory '/plots' appears to be empty, try mounting a plot directory with the docker -v command Added plot directory "/plots". Daemon not started yet Starting daemon chia_harvester: started chia_farmer: started chia_full_node: started chia_wallet: started Traceback (most recent call last): File "/chia-blockchain/venv/bin/chia_farmer", line 33, in sys.exit(load_entry_point('chia-blockchain', 'console_scripts', 'chia_farmer')()) File "/chia-blockchain/chia/server/start_farmer.py", line 63, in main kwargs = service_kwargs_for_farmer(DEFAULT_ROOT_PATH, config, config_pool, keychain, DEFAULT_CONSTANTS) File "/chia-blockchain/chia/server/start_farmer.py", line 38, in service_kwargs_for_farmer farmer = Farmer(root_path, config, config_pool, keychain, consensus_constants=updated_constants) File "/chia-blockchain/chia/farmer/farmer.py", line 73, in init raise RuntimeError(error_str) RuntimeError: No keys exist. Please run 'chia keys generate' or open the UI.

github-actions[bot] commented 3 years ago

'This issue has been flagged as stale as there has been no activity on it in 14 days. If this issue is still affecting you and in need of review, please update it to keep it open.'

github-actions[bot] commented 3 years ago

'This issue was automatically closed because it has been flagged as stale and subsequently passed 7 days with no further activity.'

mkubicek commented 1 year ago

Hey guys, same issue here

Container log gives me: "No keys are present in the keychain. Generate them with 'chia keys generate'"

Although I have passed my key file to the docker container as described in the readme they keys are not imported on startup.

When I "cat $keys" from inside the container, my 24 mnemonic words are displayed. So docker-entrypoint.sh should be able to import the keys but for some reason doesn't. Thanks for any hints!

mkubicek commented 1 year ago

So i ran the command chia keys add -f "${keys}" from docker-entrypoint.sh to add the keys manually and noticed that there is an sdtin: Enter the label you want to assign to this key (Press Enter to skip):

I suspect this might be the issue?

cmmarslender commented 1 year ago

Yeah this is due to the new key labeling. I'll get a PR in for this.

cmmarslender commented 1 year ago

Once https://github.com/Chia-Network/chia-docker/pull/176 is approved, it will auto merge and build, and it gets around the new label prompt