Chia-Network / chia-blockchain

Chia blockchain python implementation (full node, farmer, harvester, timelord, and wallet)
Apache License 2.0
10.83k stars 2.03k forks source link

[BUG] Farmer crashes on FreeBSD 12.2 #1300

Closed vkz closed 3 years ago

vkz commented 3 years ago

Describe the bug Freshly built from source. 1.0rc7 on FreeBSD 12.2

$ chia start node farmer wallet
Daemon not started yet
Starting daemon
Please enter password for encrypted keyring: 
chia_full_node: started
chia_harvester: started
chia_farmer: started
chia_full_node: Already running, use `-r` to restart
chia_wallet: started
chia_wallet: Already running, use `-r` to restart
chia_full_node: Already running, use `-r` to restart
(venv) [fullmeta@farmer ~/chia]$ /usr/local/lib/python3.7/getpass.py:91: GetPassWarning: Can not control echo on the terminal.
  passwd = fallback_getpass(prompt, stream)
Warning: Password input may be echoed.
Please enter password for encrypted keyring: Traceback (most recent call last):
  File "/usr/local/lib/python3.7/getpass.py", line 76, in unix_getpass
    termios.tcsetattr(fd, tcsetattr_flags, new)
termios.error: (5, 'Input/output error')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/getpass.py", line 79, in unix_getpass
    termios.tcsetattr(fd, tcsetattr_flags, old)
termios.error: (5, 'Input/output error')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/home/fullmeta/chia/venv/bin/chia_farmer", line 33, in <module>
    sys.exit(load_entry_point('chia-blockchain', 'console_scripts', 'chia_farmer')())
  File "/usr/home/fullmeta/chia/chia-blockchain/src/server/start_farmer.py", line 63, in main
    kwargs = service_kwargs_for_farmer(DEFAULT_ROOT_PATH, config, config_pool, keychain, DEFAULT_CONSTANTS)
  File "/usr/home/fullmeta/chia/chia-blockchain/src/server/start_farmer.py", line 38, in service_kwargs_for_farmer
    farmer = Farmer(root_path, config, config_pool, keychain, consensus_constants=updated_constants)
  File "/usr/home/fullmeta/chia/chia-blockchain/src/farmer/farmer.py", line 66, in __init__
    all_sks = self.keychain.get_all_private_keys()
  File "/usr/home/fullmeta/chia/chia-blockchain/src/util/keychain.py", line 243, in get_all_private_keys
    pkent = self._get_pk_and_entropy(self._get_private_key_user(index))
  File "/usr/home/fullmeta/chia/chia-blockchain/src/util/keychain.py", line 142, in _get_pk_and_entropy
    read_str = keyring.get_password(self._get_service(), user)
  File "/usr/home/fullmeta/chia/venv/lib/python3.7/site-packages/keyring/core.py", line 55, in get_password
    return get_keyring().get_password(service_name, username)
  File "/usr/home/fullmeta/chia/venv/lib/python3.7/site-packages/keyring/backends/chainer.py", line 51, in get_password
    password = keyring.get_password(service, username)
  File "/usr/home/fullmeta/chia/venv/lib/python3.7/site-packages/keyrings/cryptfile/file_base.py", line 116, in get_password
    password = self.decrypt(password_encrypted, assoc).decode('utf-8')
  File "/usr/home/fullmeta/chia/venv/lib/python3.7/site-packages/keyrings/cryptfile/cryptfile.py", line 126, in decrypt
    cipher = self._create_cipher(self.keyring_key, data['salt'], data['nonce'])
  File "/usr/home/fullmeta/chia/venv/lib/python3.7/site-packages/keyring/util/properties.py", line 57, in __get__
    return self.fget(obj)
  File "/usr/home/fullmeta/chia/venv/lib/python3.7/site-packages/keyrings/cryptfile/file.py", line 95, in keyring_key
    self._unlock()
  File "/usr/home/fullmeta/chia/venv/lib/python3.7/site-packages/keyrings/cryptfile/file.py", line 185, in _unlock
    'Please enter password for encrypted keyring: ')
  File "/usr/local/lib/python3.7/getpass.py", line 91, in unix_getpass
    passwd = fallback_getpass(prompt, stream)
  File "/usr/local/lib/python3.7/getpass.py", line 126, in fallback_getpass
    return _raw_input(prompt, stream)
  File "/usr/local/lib/python3.7/getpass.py", line 146, in _raw_input
    line = input.readline()
OSError: [Errno 5] Input/output error
/usr/local/lib/python3.7/getpass.py:91: GetPassWarning: Can not control echo on the terminal.
  passwd = fallback_getpass(prompt, stream)
Warning: Password input may be echoed.
Please enter password for encrypted keyring: Traceback (most recent call last):
  File "/usr/local/lib/python3.7/getpass.py", line 76, in unix_getpass
    termios.tcsetattr(fd, tcsetattr_flags, new)
termios.error: (5, 'Input/output error')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/home/fullmeta/chia/venv/lib/python3.7/site-packages/aiosqlite/core.py", line 109, in run
    get_loop(future).call_soon_threadsafe(set_result, future, result)
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 736, in call_soon_threadsafe
    self._check_closed()
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 479, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/usr/home/fullmeta/chia/venv/lib/python3.7/site-packages/aiosqlite/core.py", line 117, in run
    get_loop(future).call_soon_threadsafe(set_exception, future, e)
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 736, in call_soon_threadsafe
    self._check_closed()
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 479, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
  File "/usr/local/lib/python3.7/getpass.py", line 79, in unix_getpass

    termios.tcsetattr(fd, tcsetattr_flags, old)
termios.error: (5, 'Input/output error')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/home/fullmeta/chia/venv/bin/chia_wallet", line 33, in <module>
    sys.exit(load_entry_point('chia-blockchain', 'console_scripts', 'chia_wallet')())
  File "/usr/home/fullmeta/chia/chia-blockchain/src/server/start_wallet.py", line 86, in main
    return run_service(**kwargs)
  File "/usr/home/fullmeta/chia/chia-blockchain/src/server/start_service.py", line 211, in run_service
    return asyncio.run(async_run_service(*args, **kwargs))
  File "/usr/local/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
    return future.result()
  File "/usr/home/fullmeta/chia/chia-blockchain/src/server/start_service.py", line 205, in async_run_service
    return await service.run()
  File "/usr/home/fullmeta/chia/chia-blockchain/src/server/start_service.py", line 150, in run
    await self.start()
  File "/usr/home/fullmeta/chia/chia-blockchain/src/server/start_service.py", line 121, in start
    await self._node._start(**kwargs)
  File "/usr/home/fullmeta/chia/chia-blockchain/src/wallet/wallet_node.py", line 222, in _start
    return await self.regular_start(fingerprint, new_wallet, backup_file, skip_backup_import)
  File "/usr/home/fullmeta/chia/chia-blockchain/src/wallet/wallet_node.py", line 141, in regular_start
    private_key = self.get_key_for_fingerprint(fingerprint)
  File "/usr/home/fullmeta/chia/chia-blockchain/src/wallet/wallet_node.py", line 119, in get_key_for_fingerprint
    private_keys = self.keychain.get_all_private_keys()
  File "/usr/home/fullmeta/chia/chia-blockchain/src/util/keychain.py", line 243, in get_all_private_keys
    pkent = self._get_pk_and_entropy(self._get_private_key_user(index))
  File "/usr/home/fullmeta/chia/chia-blockchain/src/util/keychain.py", line 142, in _get_pk_and_entropy
    read_str = keyring.get_password(self._get_service(), user)
  File "/usr/home/fullmeta/chia/venv/lib/python3.7/site-packages/keyring/core.py", line 55, in get_password
    return get_keyring().get_password(service_name, username)
  File "/usr/home/fullmeta/chia/venv/lib/python3.7/site-packages/keyring/backends/chainer.py", line 51, in get_password
    password = keyring.get_password(service, username)
  File "/usr/home/fullmeta/chia/venv/lib/python3.7/site-packages/keyrings/cryptfile/file_base.py", line 116, in get_password
    password = self.decrypt(password_encrypted, assoc).decode('utf-8')
  File "/usr/home/fullmeta/chia/venv/lib/python3.7/site-packages/keyrings/cryptfile/cryptfile.py", line 126, in decrypt
    cipher = self._create_cipher(self.keyring_key, data['salt'], data['nonce'])
  File "/usr/home/fullmeta/chia/venv/lib/python3.7/site-packages/keyring/util/properties.py", line 57, in __get__
    return self.fget(obj)
  File "/usr/home/fullmeta/chia/venv/lib/python3.7/site-packages/keyrings/cryptfile/file.py", line 95, in keyring_key
    self._unlock()
  File "/usr/home/fullmeta/chia/venv/lib/python3.7/site-packages/keyrings/cryptfile/file.py", line 185, in _unlock
    'Please enter password for encrypted keyring: ')
  File "/usr/local/lib/python3.7/getpass.py", line 91, in unix_getpass
    passwd = fallback_getpass(prompt, stream)
  File "/usr/local/lib/python3.7/getpass.py", line 126, in fallback_getpass
    return _raw_input(prompt, stream)
  File "/usr/local/lib/python3.7/getpass.py", line 146, in _raw_input
    line = input.readline()
OSError: [Errno 5] Input/output error

To Reproduce

chia start node farmer wallet requests password for keyring, reads it, reports that node started etc, then spits out the above exceptions

chia start -r farmer-only first reports that farmer has been restarted successfully but soon after crashes as per above

In both cases ps -ax | grep -i chia won't show farmer. Nothing relevant in the debug.log

Expected behavior Be able to start and run a farmer

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information): 12.2-RELEASE-p4 FreeBSD 12.2-RELEASE-p4 GENERIC amd64

Additional context for more FreeBSD struggles see #1289
I've struggled to install chia on any of my BSD machines for days now

vkz commented 3 years ago

same happens if you chia start node then chia start wallet-only. Get the same exception and wallet doesn't appear to be running: only daemon and full node. Reproduced on two different machines

vkz commented 3 years ago

Here're exact steps to reproduce:

  150  mkdir chia
  151  cd chia

  152  git clone https://github.com/Chia-Network/clvm_rs.git
  153  export chiadir=`pwd`
  154  echo $chiadir
  155  (cd ${chiadir}/clvm_rs && git checkout tags/0.1.4)

  156  git clone https://github.com/Chia-Network/chia-blockchain.git
  157  cd chia-blockchain/
  158  git checkout tags/1.0rc7
  159  git submodule update --init mozilla-ca
  160  vi setup.py 
  # change: "cryptography==2.9.2"

  162  export MAKE=${MAKE:-gmake}
  164  export BUILD_VDF_CLIENT=${BUILD_VDF_CLIENT:-N}

  166  python3.7 -m venv venv
  167  ln -s venv/bin/activate .
  168  . activate 

# hack to install `maturin` which doesn't play with LLD
  170  sudo mv /usr/bin/ld /usr/bin/ld.bak
  171  sudo ln -s /usr/local/bin/ld /usr/bin/ld
  172  ld -v
  173  pip install --upgrade pip
  174  pip install wheel
  175  pip install maturin
# put ld back
  176  sudo mv /usr/bin/ld.bak /usr/bin/ld
  177  ld -v

# install clvm_rs from local repo
  178  pip install ./clvm_rs

# install miniupnpc
  179  pip install --extra-index-url https://pypi.chia.net/simple/ miniupnpc==2.1

# install chia
  180  pip install -e ./chia-blockchain --extra-index-url https://pypi.chia.net/simple/

# init
  183  chia init

# configure
  187  chia configure -upnp f
  188  chia configure -debug-level INFO

# start
  191  chia start farmer

and observe the IO error crash as reported in a short while after

Install as shown above was performed with ~/.cache/pip completely purged and in a completely fresh virtual env.

Only common part: keyring created during the first install persisted with my keys installed. So every time it would require the same keyring passphrase. Otherwise, clean environments.

$ uname -v
FreeBSD 12.2-RELEASE-p3 GENERIC 
vkz commented 3 years ago

Confirmed the same exception with 1.0rc8 on yet another server. As before:

debug.log at the time reports this ERROR:

11:12:51.311 full_node src.full_node.full_node : INFO     peer disconnected {'host': '34.199.129.128', 'port': 58444}                                      
11:12:51.315 full_node full_node_server        : ERROR    Exception:  <class 'concurrent.futures._base.CancelledError'>, closing connection {'host': '34.19
9.129.128', 'port': 58444}. Traceback (most recent call last):                                                                                             
  File "/usr/home/fullmeta/rc8/chia-blockchain/src/server/server.py", line 514, in api_call                                                                
    response: Optional[Message] = await asyncio.wait_for(wrapped_coroutine(), timeout=600)                                                                 
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 435, in wait_for                                                                                  
    await waiter                                                                                                                                           
concurrent.futures._base.CancelledError 

At this point node and harvester show up running and I can see harvester attempting to connect to localhost:8447 and failing cause farmer dropped dead.

@hoffmang9 I get that I'm probably the only one with FreeBSD and you have priorities. But as of now I'm sitting on just shy of 100TB worth of plots I can't farm. And as far as I'm concerned this is a genuine bug. FreeBSD wasn't a gesture nor am I religious - it was the only OS I managed to install on my servers. Both Ubuntu and Fedora failed to talk to my drives. I would've switched to Linux but all my plots are on UFS filesystem and its a whole new can of worms that I'm unlikely to sort before mainnet. I don't know the first thing about Python else I would've attached a debugger and tried to debug this thing myself. Not to mention you now have C, C++ and Rust in there. If anyone wants to point me at how to debug this, I'll give it a go.

vkz commented 3 years ago

Exact same issue happens with py-cryptography upgraded to 3.3.2 from PORTs.

I also tried downgrading keyring to 22.3.0 then 21.5.0 simply following git blame on setup.py I've not tried downgrading keyrings.cryptfile which saw some back and forth 5 months ago.

Did farming ever work on FreeBSD at all? I somehow doubt it works on 11.3 either. Since we aren't running a build farm we can't really bisect. I mean I could try downgrading to <=beta26 just to see if farmer starts at all.

vkz commented 3 years ago

Same exception on 1.0beta26. Again, fresh everything: venv, removed ~/.chia, removed keyring config under ~/.local.

At this point I doubt farming ever worked on FreeBSD. Full node works. Not sure what if anything I can do now.

vkz commented 3 years ago

One potentially relevant observation: on Ubuntu when I go through chia init then chia keys add it never asks for my keyring password. Nor does it suggest to create one. Not so on FreeBSD! It does ask to create keyring password and it does ask it again when you start a farmer. And looking at that exception it doesn't appear like chia or some python lib knows how to handle that back and forth with the user gracefully. Might help you guys debug the issue.

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.

hoffmang9 commented 3 years ago

Keeping open to resolves ones our k8s cluster is online.

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.

sutra commented 3 years ago

Maybe this patch helps, but please note the input maybe not work properly as well, you may just replace the string your keyring password with your actual password and rebuild:

--- chia/util/keyring_wrapper.py        2021-08-28 00:13:09.000000000 +0000
+++ chia/util/keyring_wrapper.py        2021-09-08 16:45:22.201306000 +0000
@@ -69,12 +69,12 @@
             #     keyring = FileKeyring(keys_root_path=self.keys_root_path)  # type: ignore
             # else:
             #     keyring.set_keyring(keyring.backends.macOS.Keyring())
-        elif platform == "linux":
+        elif platform == "linux" or platform.startswith("freebsd"):
             if supports_keyring_passphrase():
                 keyring = FileKeyring(keys_root_path=self.keys_root_path)  # type: ignore
             else:
                 keyring = CryptFileKeyring()
-                keyring.keyring_key = "your keyring password"  # type: ignore
+                keyring.keyring_key = input("Enter your keyring password: ")  # type: ignore
         else:
             keyring = keyring_main

See: https://github.com/Chia-Network/chia-blockchain/wiki/FreeBSD-Install https://github.com/risner/chia-freebsd/blob/main/files/patch-keychain.py

paninaro commented 3 years ago

@sutra Thanks for the patch. We should be moving toward enabling FileKeyring support soon, and my hope is that this will simplify support for the BSDs.

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.

srd00 commented 2 years ago

Facing two issues on truenas jail,

ERROR 01: OSError: [Errno 5] Input/output error

steps to reproduce:

error trace

(venv) [root@chia-plugin ~/chia-blockchain]# chia start farmer Daemon not started yet Starting daemon Please enter password for encrypted keyring: chia_harvester: started chia_farmer: started chia_full_node: started chia_wallet: started (venv) [root@chia-plugin ~/chia-blockchain]# /usr/local/lib/python3.8/getpass.py :91: GetPassWarning: Can not control echo on the terminal. passwd = fallback_getpass(prompt, stream) Warning: Password input may be echoed. Please enter password for encrypted keyring: Traceback (most recent call last): File "/usr/local/lib/python3.8/getpass.py", line 76, in unix_getpass termios.tcsetattr(fd, tcsetattr_flags, new) termios.error: (5, 'Input/output error')

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.8/getpass.py", line 79, in unix_getpass termios.tcsetattr(fd, tcsetattr_flags, old) termios.error: (5, 'Input/output error')

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/root/chia-blockchain/venv/bin/chia_farmer", line 33, in sys.exit(load_entry_point('chia-blockchain', 'console_scripts', 'chia_farmer ')()) File "/root/chia-blockchain/chia/server/start_farmer.py", line 63, in main return run_service(kwargs) File "/root/chia-blockchain/chia/server/start_service.py", line 255, in run_se rvice return asyncio.run(async_run_service(args, kwargs)) File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until _complete return future.result() File "/root/chia-blockchain/chia/server/startservice.py", line 249, in async run_service return await service.run() File "/root/chia-blockchain/chia/server/start_service.py", line 171, in run await self.start() File "/root/chia-blockchain/chia/server/start_service.py", line 135, in start await self._node._start(kwargs) File "/root/chia-blockchain/chia/farmer/farmer.py", line 183, in _start await self.setup_keys() File "/root/chia-blockchain/chia/farmer/farmer.py", line 141, in setup_keys self.all_rootsks: List[PrivateKey] = [sk for sk, in await self.get_all_pr ivate_keys()] File "/root/chia-blockchain/chia/farmer/farmer.py", line 138, in get_all_priva te_keys return await keychain_proxy.get_all_private_keys() File "/root/chia-blockchain/chia/daemon/keychain_proxy.py", line 181, in get_a ll_private_keys keys = self.keychain.get_all_private_keys() File "/root/chia-blockchain/chia/util/keychain.py", line 333, in get_all_priva te_keys pkent = self._get_pk_and_entropy(self._get_private_key_user(index)) File "/root/chia-blockchain/chia/util/keychain.py", line 109, in wrapper return func(args, kwargs) File "/root/chia-blockchain/chia/util/keychain.py", line 231, in _get_pk_and_e ntropy read_str = self.keyring_wrapper.get_passphrase(self._get_service(), user) File "/root/chia-blockchain/chia/util/keyring_wrapper.py", line 338, in get_pa ssphrase return self.get_keyring().get_password(service, user) File "/root/chia-blockchain/venv/lib/python3.8/site-packages/keyring/core.py", line 55, in get_password return get_keyring().get_password(service_name, username) File "/root/chia-blockchain/venv/lib/python3.8/site-packages/keyring/backends/ chainer.py", line 51, in get_password password = keyring.get_password(service, username) File "/root/chia-blockchain/venv/lib/python3.8/site-packages/keyrings/cryptfil e/file_base.py", line 116, in get_password password = self.decrypt(password_encrypted, assoc).decode('utf-8') File "/root/chia-blockchain/venv/lib/python3.8/site-packages/keyrings/cryptfil e/cryptfile.py", line 126, in decrypt cipher = self._create_cipher(self.keyring_key, data['salt'], data['nonce']) File "/root/chia-blockchain/venv/lib/python3.8/site-packages/keyring/util/prop erties.py", line 57, in get return self.fget(obj) File "/root/chia-blockchain/venv/lib/python3.8/site-packages/keyrings/cryptfil e/file.py", line 95, in keyring_key self._unlock() File "/root/chia-blockchain/venv/lib/python3.8/site-packages/keyrings/cryptfil e/file.py", line 184, in _unlock self.keyring_key = getpass.getpass( File "/usr/local/lib/python3.8/getpass.py", line 91, in unix_getpass passwd = fallback_getpass(prompt, stream) File "/usr/local/lib/python3.8/getpass.py", line 126, in fallback_getpass return _raw_input(prompt, stream) File "/usr/local/lib/python3.8/getpass.py", line 146, in _raw_input line = input.readline() OSError: [Errno 5] Input/output error /usr/local/lib/python3.8/getpass.py:91: GetPassWarning: Can not control echo on the terminal. passwd = fallback_getpass(prompt, stream) Warning: Password input may be echoed. Please enter password for encrypted keyring: Traceback (most recent call last): File "/usr/local/lib/python3.8/getpass.py", line 76, in unix_getpass termios.tcsetattr(fd, tcsetattr_flags, new) termios.error: (5, 'Input/output error')

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.8/getpass.py", line 79, in unix_getpass termios.tcsetattr(fd, tcsetattr_flags, old) termios.error: (5, 'Input/output error')

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/root/chia-blockchain/venv/bin/chia_wallet", line 33, in sys.exit(load_entry_point('chia-blockchain', 'console_scripts', 'chia_wallet ')()) File "/root/chia-blockchain/chia/server/start_wallet.py", line 94, in main return run_service(kwargs) File "/root/chia-blockchain/chia/server/start_service.py", line 255, in run_se rvice return asyncio.run(async_run_service(args, kwargs)) File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until _complete return future.result() File "/root/chia-blockchain/chia/server/startservice.py", line 249, in async run_service return await service.run() File "/root/chia-blockchain/chia/server/start_service.py", line 171, in run await self.start() File "/root/chia-blockchain/chia/server/start_service.py", line 135, in start await self._node._start(kwargs) File "/root/chia-blockchain/chia/wallet/wallet_node.py", line 164, in _start private_key = await self.get_key_for_fingerprint(fingerprint) File "/root/chia-blockchain/chia/wallet/wallet_node.py", line 143, in getkey for_fingerprint key = await keychain_proxy.get_key_for_fingerprint(fingerprint) File "/root/chia-blockchain/chia/daemon/keychain_proxy.py", line 256, in get_k ey_for_fingerprint private_keys = self.keychain.get_all_private_keys() File "/root/chia-blockchain/chia/util/keychain.py", line 333, in get_all_priva te_keys pkent = self._get_pk_and_entropy(self._get_private_key_user(index)) File "/root/chia-blockchain/chia/util/keychain.py", line 109, in wrapper return func(args, kwargs) File "/root/chia-blockchain/chia/util/keychain.py", line 231, in _get_pk_and_e ntropy read_str = self.keyring_wrapper.get_passphrase(self._get_service(), user) File "/root/chia-blockchain/chia/util/keyring_wrapper.py", line 338, in get_pa ssphrase return self.get_keyring().get_password(service, user) File "/root/chia-blockchain/venv/lib/python3.8/site-packages/keyring/core.py", line 55, in get_password return get_keyring().get_password(service_name, username) File "/root/chia-blockchain/venv/lib/python3.8/site-packages/keyring/backends/ chainer.py", line 51, in get_password password = keyring.get_password(service, username) File "/root/chia-blockchain/venv/lib/python3.8/site-packages/keyrings/cryptfil e/file_base.py", line 116, in get_password password = self.decrypt(password_encrypted, assoc).decode('utf-8') File "/root/chia-blockchain/venv/lib/python3.8/site-packages/keyrings/cryptfil e/cryptfile.py", line 126, in decrypt cipher = self._create_cipher(self.keyring_key, data['salt'], data['nonce']) File "/root/chia-blockchain/venv/lib/python3.8/site-packages/keyring/util/prop erties.py", line 57, in get return self.fget(obj) File "/root/chia-blockchain/venv/lib/python3.8/site-packages/keyrings/cryptfil e/file.py", line 95, in keyring_key self._unlock() File "/root/chia-blockchain/venv/lib/python3.8/site-packages/keyrings/cryptfil e/file.py", line 184, in _unlock self.keyring_key = getpass.getpass( File "/usr/local/lib/python3.8/getpass.py", line 91, in unix_getpass passwd = fallback_getpass(prompt, stream) File "/usr/local/lib/python3.8/getpass.py", line 126, in fallback_getpass return _raw_input(prompt, stream) File "/usr/local/lib/python3.8/getpass.py", line 146, in _raw_input line = input.readline() OSError: [Errno 5] Input/output error

ERROR 02: Exception ignored in: <_io.TextIOWrapper name='' mode='w' encoding='utf-8'>

BrokenPipeError: [Errno 32] Broken pipe

After changing the chia/util/keyring_wrapper.py like https://github.com/Chia-Network/chia-blockchain/issues/1300#issuecomment-915408770

TRACE: (venv) [root@chia-plugin ~/chia-blockchain]# chia start farmer chia_harvester: started chia_farmer: started chia_full_node: started chia_wallet: started (venv) [root@chia-plugin ~/chia-blockchain]# Traceback (most recent call last): File "/root/chia-blockchain/venv/bin/chia_farmer", line 33, in sys.exit(load_entry_point('chia-blockchain', 'console_scripts', 'chia_farmer')()) File "/root/chia-blockchain/chia/server/start_farmer.py", line 63, in main return run_service(*kwargs) File "/root/chia-blockchain/chia/server/start_service.py", line 255, in run_service return asyncio.run(async_run_service(args, kwargs)) File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete return future.result() File "/root/chia-blockchain/chia/server/start_service.py", line 249, in async_run_service return await service.run() File "/root/chia-blockchain/chia/server/start_service.py", line 171, in run await self.start() File "/root/chia-blockchain/chia/server/start_service.py", line 135, in start await self._node._start(kwargs) File "/root/chia-blockchain/chia/farmer/farmer.py", line 183, in _start await self.setup_keys() File "/root/chia-blockchain/chia/farmer/farmer.py", line 141, in setup_keys self.all_rootsks: List[PrivateKey] = [sk for sk, in await self.get_all_private_keys()] File "/root/chia-blockchain/chia/farmer/farmer.py", line 137, in get_all_private_keys keychain_proxy = await self.ensure_keychain_proxy() File "/root/chia-blockchain/chia/farmer/farmer.py", line 133, in ensure_keychain_proxy raise KeychainProxyConnectionFailure("Failed to connect to keychain service") chia.daemon.keychain_proxy.KeychainProxyConnectionFailure: Failed to connect to keychain service Exception ignored in: <_io.TextIOWrapper name='' mode='w' encoding='utf-8'> BrokenPipeError: [Errno 32] Broken pipe

paninaro commented 2 years ago

@srd00 I was able to get chia running on a newly installed FreeBSD 13 VM (though it wasn't trivial). I'm not running into the KeychainProxyConnectionFailure issue you're seeing, but I'm not using a jail environment either. By any chance did make some other changes? Currently, the keychain proxying code should be using a local keychain (i.e. not connecting to the daemon).

srd00 commented 2 years ago

@srd00 I was able to get chia running on a newly installed FreeBSD 13 VM (though it wasn't trivial). I'm not running into the KeychainProxyConnectionFailure issue you're seeing, but I'm not using a jail environment either. By any chance did make some other changes? Currently, the keychain proxying code should be using a local keychain (i.e. not connecting to the daemon).

@paninaro May you refer me to the changes you made to get it running?

sutra commented 2 years ago

@srd00 https://github.com/sutra/chia-freebsd

paninaro commented 2 years ago

Thanks for replying with your changes, @sutra !

@srd00 The changes that sutra linked should work. I'll note that FileKeyring support will be turned on very soon, so it won't be necessary to use CryptFileKeyring (with a hardcoded passphrase) for much longer. When I was setting up my FreeBSD environment, the issues I was running into were related to setup.py building/installing various packages and compatibility issues therein. If sutra's changes fix that, then that's great.