slimcoin-project / pacli

Simple CLI PeerAssets client (extended version).
GNU General Public License v3.0
0 stars 0 forks source link

New pacli installation #95

Closed buhtignew closed 3 months ago

buhtignew commented 4 months ago

As mentioned here I've tried to install pacli on the server following our guide.

However I was not able to use it. If I run whatever pacli command I'm getting the following error:

Traceback (most recent call last):
  File "/usr/local/bin/pacli", line 11, in <module>
    load_entry_point('pacli==0.4.7.2+slm', 'console_scripts', 'pacli')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 480, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2693, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2324, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2330, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.6/dist-packages/pacli/__main__.py", line 36, in <module>
    import pacli.extended_commands as ec
  File "/usr/local/lib/python3.6/dist-packages/pacli/extended_commands.py", line 7, in <module>
    import pacli.blockexp as bx
  File "/usr/local/lib/python3.6/dist-packages/pacli/blockexp.py", line 8, in <module>
    import pacli.at_utils as au
  File "/usr/local/lib/python3.6/dist-packages/pacli/at_utils.py", line 15, in <module>
    import pacli.extended_commands as ec
AttributeError: module 'pacli' has no attribute 'extended_commands'

I've also been asked to set up a password for the keyring when I first launched pacli and after that each time I launch pacli I'm being asked for it.

Another thing I've noticed is that the ~/.config/pacli/pacli.conf file had the following line change = default after the installation, while in my local pacli.conf file the line is different: change = mx5MdsenFDZufFuwT9ND7BKQBzS4Hy9YUP. Should we edit our guide asking people to modify that parameter in default_conf.py as well before installing pacli?

Thinking the above issue were due to the fact both pypeerassets as pacli were installed on my server by root I've removed pypeerassets and pacli, created another user and tried to install everything again from that user. However I've got no luck as well. While installing pacli I've got the following error: protobuf requires Python '>=3.7' but the running Python is 3.6.9. Thus I've run pip3 install . protobuf==3.19.6 and got:

Collecting cryptography>=2.0 (from SecretStorage>=3.2; sys_platform == "linux"->keyring->pacli==0.4.7.2+slm)
  Using cached https://files.pythonhosted.org/packages/f7/80/04cc7637238b78f8e7354900817135c5a23cf66dfb3f3a216c6d630d6833/cryptography-40.0.2.tar.gz
    Complete output from command python setup.py egg_info:

            =============================DEBUG ASSISTANCE==========================
            If you are seeing an error here please try the following to
            successfully install cryptography:

            Upgrade to the latest pip and try again. This will fix errors for most
            users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
            =============================DEBUG ASSISTANCE==========================

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-93wiwbtj/cryptography/setup.py", line 18, in <module>
        from setuptools_rust import RustExtension
    ModuleNotFoundError: No module named 'setuptools_rust'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-93wiwbtj/cryptography/

The OS is Ubuntu 18.04.6 LTS, which is the most recent version on which I was able to run slimcoind.

d5000 commented 4 months ago

I'll later try to install a pacli myself to see if I can reproduce your AttributeError and the issue with the keyring password.

Should we edit our guide asking people to modify that parameter in default_conf.py as well before installing pacli?

change = default should normally be ok, at least I don't remember a problem with that setting.

Looks like dependency hell on Ubuntu 18 ... I can't help unfortunately with such an old version. I'm on Debian 11 but it was a pain to compile Slimcoin there I remember (had to download a specific boost version).

buhtignew commented 4 months ago

Looks like dependency hell on Ubuntu 18

The strange thing is that when I've been installing pypeerassets and pacli as root there was no such issue. I think it's possible the issue has to do with the permissions my non-root user have. Maybe it doesn't pick up the right version of pypeerassets's protobuf for some reason. Because pypeerassets has picked up the right version protobuf if I've got it right.

I can't help unfortunately with such an old version.

To use Ubuntu18 locally I've set up a docker with it, don't know whether you are familiar with, there are ready snapshots to download on dockerhub.

I'm on Debian 11 but it was a pain to compile Slimcoin there I remember (had to download a specific boost version).

Yes I think we should statically compile slimcoind and slimcoin-qt with the old boost version to keep it available for the users until the core code development doesn't restart.

d5000 commented 4 months ago

I have now installed pacli again to see if I could reproduce the above error. Unfortunately that wasn't the case, but I think I identified the problem: there was a circular import in the block explorer part. It was fortunately easy to fix (commit 146612e).

Regarding the other problem with secretstorage: I think above all for windows users a package without the secretstorage requirement would be useful, this should also fix your problem with the "cryptography" dependency. In this package some of the keyring options would not be available (which are also not needed if running pacli with a local node). I'm now looking into the code if there is some refactoring needed and if it's easy to implement I'lll proceed with this option. (outdated, secretstorage isn't required but will be installed due to the keyring dependency on Linux/GNOME systems)

Edit: Disregard the last paragraph. If you can't solve the secretstorage problem, a workaround may be to install the keyrings.alt package with pip, which works without it and also can provide the very basic keyring functions for pacli (the main difference will be that some keyring commands including address list -k and address show -l -k will not work). I can confirm it works on my computer. It is not recommended by the python keyring authors due to possible security issues but as we currently only need it for testing it may work for now.

I have improved the exception handling (you see more meaningful errors) for keyring-related errors in commit 39fb0de.

buhtignew commented 4 months ago

I've upgraded pacli on my server and now the situation is as following: It still asks for the keyring password, which is not a big deal at the moment.

When I try to run any pacli command I'm getting the following error:

Please enter password for encrypted keyring: 
Traceback (most recent call last):
  File "/usr/local/bin/pacli", line 11, in <module>
    load_entry_point('pacli==0.4.7.2+slm', 'console_scripts', 'pacli')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 480, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2693, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2324, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2330, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.6/dist-packages/pacli/__main__.py", line 19, in <module>
    from pacli.provider import provider
  File "/usr/local/lib/python3.6/dist-packages/pacli/provider.py", line 52, in <module>
    provider = configured_provider(Settings)
  File "/usr/local/lib/python3.6/dist-packages/pacli/provider.py", line 47, in configured_provider
    set_up(provider) # set_up() does not work
  File "/usr/local/lib/python3.6/dist-packages/pacli/provider.py", line 16, in set_up
    if not provider.listtransactions("PAPROD"):
  File "/usr/local/lib/python3.6/dist-packages/pypeerassets/provider/slm_rpcnode.py", line 32, in listtransactions
    return self.req("listtransactions", [account, fBurnTx, many, since])
  File "/usr/local/lib/python3.6/dist-packages/peercoin_rpc/peercoin_rpc.py", line 90, in req
    data=json.dumps({"method": method, "params": params, "jsonrpc": "1.1"}),
  File "/usr/lib/python3/dist-packages/requests/models.py", line 892, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I'm operating as root. As ordinary user the installation requires Python 3.7. It can be that the issue has to do with not enough permissions my ordinary user has. I'll try to reinstall pacli on docker locally to see whether I'm experiencing the same issue.

d5000 commented 4 months ago

Mmh, the JSONDecodeError looks familiar, but I don't remember when I saw it, and unfortunately in my records of earlier bugs it doesn't appear.

So I can only speculate: Is the Slimcoin daemon running correctly? The error seems to have triggered by the slimcoind listtransactions command. Have you tried that command "manually" (from the bash/ssh shell with the ordinary user you mentioned) and is the output as expected (if not, then you can post it here)?

buhtignew commented 4 months ago

The slimcoind listtransactions outputs as following:

[
    {
        "account" : "",
        "category" : "immature",
        "amount" : 11.13000000,
        "confirmations" : 12,
        "blockhash" : "000000055500582cca65d17f85d6b462fa774efad3f3a52767acf30b53e9eb91",
        "blockindex" : 0,
        "txid" : "79af7580f2560723ce07a1f2b0861a14b062d2b900d6267bbd74f495bea3288f",
        "time" : 1715847734
    },
    {
        "account" : "",
        "category" : "immature",
        "amount" : 11.12000000,
        "confirmations" : 11,
        "blockhash" : "0000007b1b8c48c6dc5a641b0f902905adb9d55a9e018921c186471b81c9e111",
        "blockindex" : 0,
        "txid" : "d2f6e3d2dd0acb023a792565e6758288b995a1535a31f121ee93dbb8f0023b31",
        "time" : 1715847749
    },
    {
        "account" : "",
        "category" : "immature",
        "amount" : 11.10000000,
        "confirmations" : 10,
        "blockhash" : "0000006cad9a0bce2804b84f2ffc570da37d72e47ae19fe245aad8121a925229",
        "blockindex" : 0,
        "txid" : "965ecf731bc440db7c1ffddc407d2379adbbf25416b3b6bee3afd4a0b6355a4e",
        "time" : 1715847954
    },
    {
        "account" : "",
        "category" : "immature",
        "amount" : 11.13000000,
        "confirmations" : 9,
        "blockhash" : "00000076f758b508195746ae449da1c8972a4fc2456e0ab567bee27c49d4443b",
        "blockindex" : 0,
        "txid" : "8eb3f18c4de43fe09496e08da38d6e73478f2cdbe0cd48dedbb1cac9cf4c91e2",
        "time" : 1715848007
    },
    {
        "account" : "",
        "category" : "immature",
        "amount" : 11.10000000,
        "confirmations" : 7,
        "blockhash" : "000000348fc256ae79ed8e5ecd3865f90eb6142bf704a6a06cdfca4ce4ecc704",
        "blockindex" : 0,
        "txid" : "c4ca4dbee4cf8c687a91ee778c72c3814690c82a0e31fe726185ab77609d1e47",
        "time" : 1715848324
    },
    {
        "account" : "",
        "category" : "immature",
        "amount" : 11.13000000,
        "confirmations" : 5,
        "blockhash" : "0000001a0acb8b4bd19c05d5e5f77e38a37bf76e8c52a2821dca38101d0140ec",
        "blockindex" : 0,
        "txid" : "1c490af4466cbc6464a87a6c0903d935757cc36e6d2f948880e44884ead472c2",
        "time" : 1715848504
    },
    {
        "account" : "",
        "category" : "immature",
        "amount" : 11.15000000,
        "confirmations" : 4,
        "blockhash" : "0000008916e707c70d00001462fd4184c71deae4aa142edc270e6547efaf7c3d",
        "blockindex" : 0,
        "txid" : "3efef72aeb1125b0d077f82fd69c1b0d4e9f90451503dbd038a485d4994bc32e",
        "time" : 1715848621
    },
    {
        "account" : "",
        "category" : "immature",
        "amount" : 11.16000000,
        "confirmations" : 3,
        "blockhash" : "0000006578f533d0ee090ec5c7eeb9125798d82e6a987ccea694fd7e9b25a46b",
        "blockindex" : 0,
        "txid" : "5a8fb07be4cc01e2e7c5a143bd904d226392db8d9cbb46f4d25597a1c196db49",
        "time" : 1715848834
    },
    {
        "account" : "",
        "category" : "immature",
        "amount" : 11.19000000,
        "confirmations" : 2,
        "blockhash" : "0000000c91081178cc1613593c24bf3a171dabea32f9cb9cfbb75fc257f299ba",
        "blockindex" : 0,
        "txid" : "e88a972b4dea78c8845d6691fd462193cbcca323a53eab6ebe05e4c97c2995d9",
        "time" : 1715848921
    },
    {
        "account" : "",
        "category" : "immature",
        "amount" : 11.19000000,
        "confirmations" : 1,
        "blockhash" : "0000008da6640c5085a65cf52b7308bb82438566404a045c928fdb0f7cca7733",
        "blockindex" : 0,
        "txid" : "861090e3dd814f4c251bb38ccb0ac7ead29b66fac79d91c54c045ea504ffacbe",
        "time" : 1715849277
    }
]

Which looks regular to me.

By the way I'm operating as root user, the regular user has the Python version incompatibility issue.

Update: I've installed pacli on docker container (it uses the root user as well). Everything went smoothly, JSONDecodeError doesn't show up.

The only issue are the passwords requests on each pacli command launch, which is quite annoying. I've tried pip3 install keyrings.alt, but got Requirement already satisfied: keyrings.alt in /usr/lib/python3/dist-packages.

d5000 commented 4 months ago

Just for the records: I stumbled upon the JSONDecodeError by casuality when testing something related to other bug/improvement. In this case it meant that the RPC user or password is incorrect. So either in the pacli.conf there's still no RPC node configured, or it doesn't coincide with the entries in slimcoin.conf/slimcoin-testnet.conf.

You can't just use two different users (one for pacli and the other slimcoind), regardless if one of both is root. The reason is that both will search slimcoind in different folders.

With the password problem until now I can't help you, I never had that problem or at least don't remember it. I don't know even where to search.

keyrings.alt would probably not help with this issue, this was meant to provide a basic keyring without using secretstorage, as before you wrote that you had problems installing it (before you switched to docker).

A site I used to investigate is https://pypi.org/project/keyring/ , perhaps it's helpful for you.

buhtignew commented 3 months ago

In this case it meant that the RPC user or password is incorrect.

Indeed there was a typo in my username. So the issue is gone on the server as well.

Unfortunate I haven't found so far any way to disable the password prompt I'm getting each time the pacli is being run. Seems like in Ubuntu the keyring installed by default and every attempt to disable it doesn't work anymore. I was able to make pacli work without the annoying keyring requests on each run. I'm testing the algorithm right now. Once I've understood the exact procedure to follow I'll publish it here.

buhtignew commented 3 months ago

As promised I'm publishing here the procedure to get rid of keyring password requests while using pacli with Ubuntu18:

apt remove -y python3-keyring
apt -y autoremove
apt install -y python-keyrings.alt rustc cargo
pip3 install setuptools_rust
pip3 install cryptography==36.0.2
pip3 install --upgrade keyrings.alt
cd /to/pacli/directory
pip3 install .

Notes:

IDK whether it would make sense adding the above procedure info to our documentation somewhere in order to remember how it should be done?

UPDATE: I've made a test to see whether the regular (non-root) user has any issue with installing pypeerassets and pacli in Ubuntu18 and it turned out that there is almost no issue:

I'd say we can close this issue, the only question that remains, for me, is whether we can store the procedure I've listed above in order to avoid making all the tests I've done to create it again in case we need it. I don't know whether we should somehow remember as well that sometimes pacli needs sudo during the installation process.

d5000 commented 3 months ago

Maybe we could issue a more human friendly warning in this case?

Yes, of course. The problem was that in my tests an ImportError or ModuleNotFoundError was thrown, so I catched these two errors; a message that the function is not supported is then printed. I've added the SecretServiceNotAvailableException to the next update.

Glad that you were able to solve the other issues. I also think that the contents of this issue could be added to the wiki in the case somebody needing it. Perhaps we can add a "Troubleshooting" section to the Pacli wiki and then simply paste or link the issues content under a descriptive title ("Pacli requires a keyring password with each usage" or so).

buhtignew commented 3 months ago

Perhaps we can add a "Troubleshooting" section to the Pacli wiki and then simply paste or link the issues content under a descriptive title ("Pacli requires a keyring password with each usage" or so).

Do you want me to do this addition?

d5000 commented 3 months ago

You can, of course, otherwise I can do it when I start to ensamble the manual.

buhtignew commented 3 months ago

I think it would be better that you do this addition into appropriate place, because I don't have a clear idea about how our documentation will be arranged, so basically I'm risking to work into the wrong direction.

I've discovered that there are heavy usage issues both with the keyring package and the keyrings.alt package in Ubuntu18. My assumption is that we've tested pacli with more advanced versions of packages thus there is no backward compatibility. I'll go on inquiring on this and then will post here something more specific on regard.

buhtignew commented 3 months ago

I'm testing two new pacli installation with the native Ubuntu18 keyring and with keyrings.alt.

Both are reporting error while I'm trying to run address list -k, for instance. On the server that has keyrings.alt installed I've got initially the following error:

  File "/usr/local/lib/python3.6/dist-packages/secretstorage/__init__.py", line 73, in dbus_init
    connection = open_dbus_connection()
  File "/usr/local/lib/python3.6/dist-packages/jeepney/io/blocking.py", line 332, in open_dbus_connection
    bus_addr = get_bus(bus)
  File "/usr/local/lib/python3.6/dist-packages/jeepney/bus.py", line 53, in get_bus
    return find_session_bus()
  File "/usr/local/lib/python3.6/dist-packages/jeepney/bus.py", line 42, in find_session_bus
    addr = os.environ['DBUS_SESSION_BUS_ADDRESS']
  File "/usr/lib/python3.6/os.py", line 669, in __getitem__
    raise KeyError(key) from None
KeyError: 'DBUS_SESSION_BUS_ADDRESS'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/pacli", line 33, in <module>
    sys.exit(load_entry_point('pacli==0.4.7.2+slm', 'console_scripts', 'pacli')())
  File "/usr/local/lib/python3.6/dist-packages/pacli/__main__.py", line 493, in main
    'checkpoint' : Checkpoint()
  File "/usr/local/lib/python3.6/dist-packages/fire/core.py", line 143, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/usr/local/lib/python3.6/dist-packages/fire/core.py", line 482, in _Fire
    target=component.__name__)
  File "/usr/local/lib/python3.6/dist-packages/fire/core.py", line 693, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pacli/extended_classes.py", line 567, in list
    return ei.run_command(self.__list, advanced=advanced, keyring=keyring, coinbalances=coinbalances, labels=labels, full_labels=full_labels, no_labels=without_labels, only_labels=only_labels, named=named, quiet=quiet, p2th=p2th, network=blockchain, include_all=include_all, debug=debug)
  File "/usr/local/lib/python3.6/dist-packages/pacli/extended_interface.py", line 33, in run_command
    result = c(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pacli/extended_classes.py", line 651, in __list
    debug=debug)
  File "/usr/local/lib/python3.6/dist-packages/pacli/token_commands.py", line 36, in all_balances
    labeldict = ec.get_labels_and_addresses(keyring=keyring, named=named, empty=empty, exclude=exclude, include_only=include_only)
  File "/usr/local/lib/python3.6/dist-packages/pacli/extended_commands.py", line 228, in get_labels_and_addresses
    keyring_labels = ke.get_labels_from_keyring(prefix)
  File "/usr/local/lib/python3.6/dist-packages/pacli/keystore_extended.py", line 104, in get_labels_from_keyring
    bus = secretstorage.dbus_init()
  File "/usr/local/lib/python3.6/dist-packages/secretstorage/__init__.py", line 79, in dbus_init
    raise SecretServiceNotAvailableException(reason) from ex
secretstorage.exceptions.SecretServiceNotAvailableException: Environment variable DBUS_SESSION_BUS_ADDRESS is unset

Then I've installed dbus-x11 package (with apt-get install dbus-x11) and run "eval `dbus-launch --auto-syntax`". After that the message has changed into:

  File "/usr/local/lib/python3.6/dist-packages/secretstorage/util.py", line 48, in send_and_get_reply
    raise DBusErrorResponse(resp_msg)
jeepney.wrappers.DBusErrorResponse: [org.freedesktop.DBus.Error.UnknownMethod] ("No such interface 'org.freedesktop.DBus.Properties' on object at path /org/freedesktop/secrets/collection/login",)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/secretstorage/collection.py", line 177, in get_default_collection
    return Collection(connection)
  File "/usr/local/lib/python3.6/dist-packages/secretstorage/collection.py", line 45, in __init__
    self._collection.get_property('Label')
  File "/usr/local/lib/python3.6/dist-packages/secretstorage/util.py", line 67, in get_property
    (signature, value), = self.send_and_get_reply(msg)
  File "/usr/local/lib/python3.6/dist-packages/secretstorage/util.py", line 52, in send_and_get_reply
    raise ItemNotFoundException('Item does not exist!') from resp
secretstorage.exceptions.ItemNotFoundException: Item does not exist!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/keyring/backends/SecretService.py", line 61, in get_preferred_collection
    collection = secretstorage.get_default_collection(bus)
  File "/usr/local/lib/python3.6/dist-packages/secretstorage/collection.py", line 179, in get_default_collection
    return create_collection(connection, 'Default', 'default', session)
  File "/usr/local/lib/python3.6/dist-packages/secretstorage/collection.py", line 159, in create_collection
    raise PromptDismissedException('Prompt dismissed.')
secretstorage.exceptions.PromptDismissedException: Prompt dismissed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/pacli", line 33, in <module>
    sys.exit(load_entry_point('pacli==0.4.7.2+slm', 'console_scripts', 'pacli')())
  File "/usr/local/bin/pacli", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/local/lib/python3.6/dist-packages/importlib_metadata/__init__.py", line 194, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/local/lib/python3.6/dist-packages/pacli/__main__.py", line 19, in <module>
    from pacli.provider import provider
  File "/usr/local/lib/python3.6/dist-packages/pacli/provider.py", line 3, in <module>
    from pacli.config import Settings
  File "/usr/local/lib/python3.6/dist-packages/pacli/config.py", line 97, in <module>
    Settings = load_conf()
  File "/usr/local/lib/python3.6/dist-packages/pacli/config.py", line 75, in load_conf
    privkey=bytearray.fromhex(load_key())
  File "/usr/local/lib/python3.6/dist-packages/pacli/keystore.py", line 26, in load_key
    init_keystore()
  File "/usr/local/lib/python3.6/dist-packages/pacli/keystore.py", line 19, in init_keystore
    if not keyring.get_password('pacli', 'key'):
  File "/usr/local/lib/python3.6/dist-packages/keyring/core.py", line 55, in get_password
    return get_keyring().get_password(service_name, username)
  File "/usr/local/lib/python3.6/dist-packages/keyring/backends/chainer.py", line 51, in get_password
    password = keyring.get_password(service, username)
  File "/usr/local/lib/python3.6/dist-packages/keyring/backends/SecretService.py", line 78, in get_password
    collection = self.get_preferred_collection()
  File "/usr/local/lib/python3.6/dist-packages/keyring/backends/SecretService.py", line 63, in get_preferred_collection
    raise InitError("Failed to create the collection: %s." % e)
keyring.errors.InitError: Failed to create the collection: Prompt dismissed..

On the docker container that has the Ubuntu18 native keyring package installed I've initially got:

   File "/usr/local/lib/python3.6/dist-packages/secretstorage/util.py", line 48, in send_and_get_reply
    raise DBusErrorResponse(resp_msg)
jeepney.wrappers.DBusErrorResponse: [org.freedesktop.DBus.Error.Spawn.ExecFailed] ('Failed to execute program org.freedesktop.secrets: Operation not permitted',)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

 File "/usr/local/bin/pacli", line 33, in <module>
    sys.exit(load_entry_point('pacli==0.4.7.2+slm', 'console_scripts', 'pacli')())
  File "/usr/local/lib/python3.6/dist-packages/pacli/__main__.py", line 493, in main
    'checkpoint' : Checkpoint()
  File "/usr/local/lib/python3.6/dist-packages/fire/core.py", line 143, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/usr/local/lib/python3.6/dist-packages/fire/core.py", line 482, in _Fire
    target=component.__name__)
  File "/usr/local/lib/python3.6/dist-packages/fire/core.py", line 693, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pacli/extended_classes.py", line 567, in list
    return ei.run_command(self.__list, advanced=advanced, keyring=keyring, coinbalances=coinbalances, labels=labels, full_labels=full_labels, no_labels=without_labels, only_labels=only_labels, named=named, quiet=quiet, p2th=p2th, network=blockchain, include_all=include_all, debug=debug)
  File "/usr/local/lib/python3.6/dist-packages/pacli/extended_interface.py", line 33, in run_command
    result = c(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pacli/extended_classes.py", line 651, in __list
    debug=debug)
  File "/usr/local/lib/python3.6/dist-packages/pacli/token_commands.py", line 36, in all_balances
    labeldict = ec.get_labels_and_addresses(keyring=keyring, named=named, empty=empty, exclude=exclude, include_only=include_only)
  File "/usr/local/lib/python3.6/dist-packages/pacli/extended_commands.py", line 228, in get_labels_and_addresses
    keyring_labels = ke.get_labels_from_keyring(prefix)
  File "/usr/local/lib/python3.6/dist-packages/pacli/keystore_extended.py", line 105, in get_labels_from_keyring
    collection = secretstorage.get_default_collection(bus)
  File "/usr/local/lib/python3.6/dist-packages/secretstorage/collection.py", line 177, in get_default_collection
    return Collection(connection)
  File "/usr/local/lib/python3.6/dist-packages/secretstorage/collection.py", line 45, in __init__
    self._collection.get_property('Label')
  File "/usr/local/lib/python3.6/dist-packages/secretstorage/util.py", line 67, in get_property
    (signature, value), = self.send_and_get_reply(msg)
  File "/usr/local/lib/python3.6/dist-packages/secretstorage/util.py", line 58, in send_and_get_reply
    raise SecretServiceNotAvailableException(data) from resp
secretstorage.exceptions.SecretServiceNotAvailableException: Failed to execute program org.freedesktop.secrets: Operation not permitted
sys:1: ResourceWarning: unclosed <socket.socket fd=5, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0, raddr=b'\x00/tmp/dbus-1gBdDSKzms'>

Then I've also run "eval `dbus-launch --auto-syntax`" (apt-get install dbus-x11 was already performed earlier) and got the same error. I've tried to uninstall dbus-x11 but the error message was still the same.

I assume the above messages are a kind of related to the message I'm getting on my main pacli installation, we've discussed in the past:

/usr/lib/python3.12/functools.py:58: ResourceWarning: unclosed <socket.socket fd=8, family=1, type=1, proto=0, raddr=/run/user/1000/bus>
  getattr(wrapper, attr).update(getattr(wrapped, attr, {}))
ResourceWarning: Enable tracemalloc to get the object allocation traceback

But the difference of course is that I'm not able able to use the -k flag in the former cases (both if I run with the keyring or keyrings.alt package) while in the later I am.

The issue with the docker may be that it can't use dbus in the way our code requires it, but the server should be able to, I guess.

UPDATE: I've found the message I was getting on docker container's Ubuntu18 with the keyring package that I was receiving before I've installed dbus-x11 and run "eval `dbus-launch --auto-syntax`":


  File "/usr/lib/python3/dist-packages/secretstorage/__init__.py", line 47, in dbus_init
    return dbus.SessionBus()
  File "/usr/lib/python3/dist-packages/dbus/_dbus.py", line 211, in __new__
    mainloop=mainloop)
  File "/usr/lib/python3/dist-packages/dbus/_dbus.py", line 100, in __new__
    bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 122, in __new__
    bus = cls._new_for_bus(address_or_type, mainloop=mainloop)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/pacli", line 11, in <module>
    load_entry_point('pacli==0.4.7.2+slm', 'console_scripts', 'pacli')()
  File "/usr/local/lib/python3.6/dist-packages/pacli/__main__.py", line 493, in main
    'checkpoint' : Checkpoint()
  File "/usr/local/lib/python3.6/dist-packages/fire/core.py", line 143, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/usr/local/lib/python3.6/dist-packages/fire/core.py", line 482, in _Fire
    target=component.__name__)
  File "/usr/local/lib/python3.6/dist-packages/fire/core.py", line 693, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pacli/extended_classes.py", line 567, in list
    return ei.run_command(self.__list, advanced=advanced, keyring=keyring, coinbalances=coinbalances, labels=labels, full_labels=full_labels, no_labels=without_labels, only_labels=only_labels, named=named, quiet=quiet, p2th=p2th, network=blockchain, include_all=include_all, debug=debug)
  File "/usr/local/lib/python3.6/dist-packages/pacli/extended_interface.py", line 33, in run_command
    result = c(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pacli/extended_classes.py", line 651, in __list
    debug=debug)
  File "/usr/local/lib/python3.6/dist-packages/pacli/token_commands.py", line 36, in all_balances
    labeldict = ec.get_labels_and_addresses(keyring=keyring, named=named, empty=empty, exclude=exclude, include_only=include_only)
  File "/usr/local/lib/python3.6/dist-packages/pacli/extended_commands.py", line 228, in get_labels_and_addresses
    keyring_labels = ke.get_labels_from_keyring(prefix)
  File "/usr/local/lib/python3.6/dist-packages/pacli/keystore_extended.py", line 104, in get_labels_from_keyring
    bus = secretstorage.dbus_init()
  File "/usr/lib/python3/dist-packages/secretstorage/__init__.py", line 52, in dbus_init
    e.get_dbus_message())
secretstorage.exceptions.SecretServiceNotAvailableException: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

Running service dbus start hasn't changed the situation in any way.

buhtignew commented 3 months ago

As decided in #102 I'll drop any inquiry on the issues pacli may have with the obsolete OSs (like Ubuntu18, Debian10 or Debian11). So we probably should close this issue as well. We may open another one in the future if we need to test pacli on other up to date OSs that are different from ours.

d5000 commented 3 months ago

Good. I'm closing.