Skip to content

Failed to establish context: Service not available. (0x8010001D) #5

@Sjors

Description

@Sjors

I got a Bolt Card at last years Bitcoin Amsterdam conference. I'm trying read from it (and then hopefully write to it) with a ACR122U-A9 NFC reader connected to my Ubuntu 23.10 machine.

Python version 3.12.1, libpcsclite-dev 2.0.0 and swig 4.1.0 are installed.

I then installed v0.2.0 via pip install boltlib.

When I put the card on the reader it beeps and the light goes from red to green.

But boltcard read fails with a cryptic error:

Traceback (most recent call last):
  File "/home/sjors/.pyenv/versions/3.12.1/bin/boltcard", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/sjors/.pyenv/versions/3.12.1/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sjors/.pyenv/versions/3.12.1/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/sjors/.pyenv/versions/3.12.1/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sjors/.pyenv/versions/3.12.1/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sjors/.pyenv/versions/3.12.1/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sjors/.pyenv/versions/3.12.1/lib/python3.12/site-packages/boltlib/cli.py", line 29, in read
    cs = boltlib.wait_for_card()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sjors/.pyenv/versions/3.12.1/lib/python3.12/site-packages/boltlib/core.py", line 73, in wait_for_card
    cardrequest = CardRequest(cardType=cardtype, timeout=timeout)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sjors/.pyenv/versions/3.12.1/lib/python3.12/site-packages/smartcard/CardRequest.py", line 58, in __init__
    self.pcsccardrequest = PCSCCardRequest(newcardonly, readers,
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sjors/.pyenv/versions/3.12.1/lib/python3.12/site-packages/smartcard/pcsc/PCSCCardRequest.py", line 81, in __init__
    self.hcontext = PCSCContext().getContext()
                    ^^^^^^^^^^^^^
  File "/home/sjors/.pyenv/versions/3.12.1/lib/python3.12/site-packages/smartcard/pcsc/PCSCContext.py", line 56, in __init__
    self.renewContext()
  File "/home/sjors/.pyenv/versions/3.12.1/lib/python3.12/site-packages/smartcard/pcsc/PCSCContext.py", line 70, in renewContext
    PCSCContext.instance = PCSCContext.__PCSCContextSingleton()
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sjors/.pyenv/versions/3.12.1/lib/python3.12/site-packages/smartcard/pcsc/PCSCContext.py", line 40, in __init__
    raise EstablishContextException(hresult)
smartcard.pcsc.PCSCExceptions.EstablishContextException: Failed to establish context: Service not available. (0x8010001D)

I also tried cloning the repo and running it from inside a poetry shell. This results in the same 0x8010001D error.

Happy to test potential fixes...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions