Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error executing HWI (when hardware wallets are scanned) - macOS #972

Closed
GeorgeGalaxy opened this issue May 22, 2023 · 33 comments
Closed

Error executing HWI (when hardware wallets are scanned) - macOS #972

GeorgeGalaxy opened this issue May 22, 2023 · 33 comments

Comments

@GeorgeGalaxy
Copy link

I try to add my bitbox02 to Sparrow Wallet but when I start scanning for a hardware wallet I get this message in image below
Screenshot 2023-05-22 at 8 41 36 PM

I use Sparrow Wallet on macOS

@craigraw
Copy link
Collaborator

Was this issue already handled in the Telegram chat?

@GeorgeGalaxy
Copy link
Author

Was this issue already handled in the Telegram chat?

This issue was recently discussed by some man, but after 23 may this discussion ended without any resolution

@craigraw
Copy link
Collaborator

Ok - are you able to see the device using the BitboxApp?

@GeorgeGalaxy
Copy link
Author

Ok - are you able to see the device using the BitboxApp?

Yes, I am

@craigraw
Copy link
Collaborator

Ok, and this is the error you are seeing in the logs?

Error executing hwi-2.2.1
java.io.IOException: Traceback (most recent call last):
  File "hwi.py", line 7, in <module>
  File "hwilib/_cli.py", line 304, in main
  File "hwilib/_cli.py", line 270, in process_commands
  File "hwilib/_cli.py", line 63, in enumerate_handler
  File "hwilib/commands.py", line 117, in enumerate
  File "hwilib/devices/bitbox02.py", line 184, in enumerate
  File "hwilib/devices/bitbox02.py", line 273, in init
  File "hid.pyx", line 154, in hid.device.open_path

@GeorgeGalaxy
Copy link
Author

Ok, and this is the error you are seeing in the logs?

Error executing hwi-2.2.1
java.io.IOException: Traceback (most recent call last):
  File "hwi.py", line 7, in <module>
  File "hwilib/_cli.py", line 304, in main
  File "hwilib/_cli.py", line 270, in process_commands
  File "hwilib/_cli.py", line 63, in enumerate_handler
  File "hwilib/commands.py", line 117, in enumerate
  File "hwilib/devices/bitbox02.py", line 184, in enumerate
  File "hwilib/devices/bitbox02.py", line 273, in init
  File "hid.pyx", line 154, in hid.device.open_path

Yes, It looks similar in my situation:

ERROR [Thread-46] c.s.s.i.Hwi [null:-1] Error executing hwi-2.2.1
java.io.IOException: Traceback (most recent call last):
File "hwi.py", line 7, in
File "hwilib/_cli.py", line 304, in main
File "hwilib/_cli.py", line 270, in process_commands
File "hwilib/_cli.py", line 63, in enumerate_handler
File "hwilib/commands.py", line 117, in enumerate
File "hwilib/devices/bitbox02.py", line 190, in enumerate
File "bitbox02/communication/bitbox_api_protocol.py", line 681, in get_info
File "bitbox02/communication/communication.py", line 38, in query
File "bitbox02/communication/u2fhid/u2fhid.py", line 145, in read
File "bitbox02/communication/u2fhid/u2fhid.py", line 59, in _throw_error
Exception: Received error: invalid command
[13199] Failed to execute script 'hwi' due to unhandled exception!

@craigraw
Copy link
Collaborator

Are there any other USB devices plugged in?

Pinging @benma

@GeorgeGalaxy
Copy link
Author

GeorgeGalaxy commented May 25, 2023

No, there are not any USB devices when I try to connect bitbox02 to Sparrow Wallet

Are there any other USB devices plugged in?

Pinging @benma

@craigraw craigraw reopened this May 25, 2023
@benma
Copy link

benma commented May 25, 2023

Are you on macOS 13.3+?

The root of the problem is very likely this issue - libusb/hidapi#531 - a fix was already merged into hidapi.

I am not sure if HWI bundles hidapi or if it calls the one installed on the system. I'd try brew update; brew install hidapi to see if that helps.

@GeorgeGalaxy
Copy link
Author

brew update; brew install hidapi

@GeorgeGalaxy
Copy link
Author

GeorgeGalaxy commented May 25, 2023

Yes, I am on macOS 13.3.1.
The execution of this command did not solve the problem

brew update; brew install hidapi

@benma
Copy link

benma commented May 27, 2023

Does Sparrow list two choices for BitBox02 when enumerating devices? If so, one will work and the other will not, as a result of the above bug in hidapi.

The fix should be to get hidapi updated somehow.

@achow101 would you happen to know if HWI bundles the hidapi lib?

@achow101
Copy link

@achow101 would you happen to know if HWI bundles the hidapi lib?

I believe it does. IIRC the standalone binaries bundle all necessary libraries.

@benma
Copy link

benma commented May 27, 2023

@achow101 would you happen to know if HWI bundles the hidapi lib?

I believe it does. IIRC the standalone binaries bundle all necessary libraries.

Thanks. I grepped hidapi and it does not come up except for the Python hidapi dep. Maybe it's not bundled after all but part of the Python hidapi dep. Relevant issue there is trezor/cython-hidapi#151

benma added a commit to benma/HWI that referenced this issue May 30, 2023
6.2.0 was released to put a minimum requirement on hidapi 0.14.0,
which includes the fix for this issue:

libusb/hidapi#531

That bug caused hidapi on macOS 13.3 to report 0 as the interface
number for all hid devices, which led to the bitbox02 being listed
twice instead of once. This breaks some downstream integrations like
Sparrow: sparrowwallet/sparrow#972
@benma
Copy link

benma commented May 30, 2023

The above cython-hidapi issue was fixed and hidapi 0.14.0 was released. We published bitbox02-6.2.0 that requires hidapi 0.14.0. Here is the PR in HWI that bumps that dep:

bitcoin-core/HWI#677

Next step is to wait for HWI to merge this, wait for the next HWI release, and Sparrow to update HWI.

@craigraw
Copy link
Collaborator

Thanks @benma. Will look to update as soon as the next HWI release is ready.

@amosgroth
Copy link

I have the same issue with Sparrow on Manjaro Linux . BitBox application works without problems with the device.

  • Sparrow 1.7.6
  • hidapi 0.13.1-2

2023-06-08 07:02:08,568 ERROR [Thread-222] c.s.s.i.Hwi [null:-1] Error executing hwi-2.2.1 java.io.IOException: Traceback (most recent call last): File "hwi.py", line 7, in <module> File "hwilib/_cli.py", line 304, in main File "hwilib/_cli.py", line 270, in process_commands File "hwilib/_cli.py", line 63, in enumerate_handler File "hwilib/commands.py", line 117, in enumerate File "hwilib/devices/bitbox02.py", line 184, in enumerate File "hwilib/devices/bitbox02.py", line 273, in __init__ File "hid.pyx", line 154, in hid.device.open_path OSError: open failed [48685] Failed to execute script 'hwi' due to unhandled exception! at com.sparrowwallet.sparrow@1.7.6/com.sparrowwallet.sparrow.io.Hwi.getProcessOutput(Unknown Source) at com.sparrowwallet.sparrow@1.7.6/com.sparrowwallet.sparrow.io.Hwi.execute(Unknown Source) at com.sparrowwallet.sparrow@1.7.6/com.sparrowwallet.sparrow.io.Hwi.enumerateUsb(Unknown Source) at com.sparrowwallet.sparrow@1.7.6/com.sparrowwallet.sparrow.io.Hwi.enumerate(Unknown Source) at com.sparrowwallet.sparrow@1.7.6/com.sparrowwallet.sparrow.io.Hwi$EnumerateService$1.call(Unknown Source) at com.sparrowwallet.sparrow@1.7.6/com.sparrowwallet.sparrow.io.Hwi$EnumerateService$1.call(Unknown Source) at javafx.graphics@18/javafx.concurrent.Task$TaskCallable.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$6(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$7(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)

@amosgroth
Copy link

Interestingly after connecting and testing with the Bitbox application and leaving Sparrow open while doing that, it works now! So what I did is:

  • Open Sparrow
  • Add new wallet
  • Scan for connected devices (produces error above)
  • Open Bitbox application (leave Sparrow open)
  • Unlock Bitbox device
  • Quit Bitbox application
  • Add new wallet in Sparrow
  • Scan for connected devices
  • Add now listed Bitbox as new wallet (Bitbox is now shown, no error)
  • Unlock Bitbox device etc...

@GeorgeGalaxy
Copy link
Author

Interestingly after connecting and testing with the Bitbox application and leaving Sparrow open while doing that, it works now! So what I did is:

  • Open Sparrow
  • Add new wallet
  • Scan for connected devices (produces error above)
  • Open Bitbox application (leave Sparrow open)
  • Unlock Bitbox device
  • Quit Bitbox application
  • Add new wallet in Sparrow
  • Scan for connected devices
  • Add now listed Bitbox as new wallet (Bitbox is now shown, no error)
  • Unlock Bitbox device etc...

In my case, such approach doesn't work, but thank you for such detailed description (maybe it'll help someone)

@craigraw
Copy link
Collaborator

I've tested on MacOS Ventura 13.4 and could not reproduce - everything works fine. @GeorgeGalaxy can you test again? It's possible Apple fixed their regression.

@GeorgeGalaxy
Copy link
Author

GeorgeGalaxy commented Jun 22, 2023

I've tested on MacOS Ventura 13.4 and could not reproduce - everything works fine. @GeorgeGalaxy can you test again? It's possible Apple fixed their regression.

I already updated my macOS to 13.4 and also updated Sparrow Wallet to 1.7.7, but I have the same issue as well

@GeorgeGalaxy
Copy link
Author

GeorgeGalaxy commented Jun 23, 2023

I've tested on MacOS Ventura 13.4 and could not reproduce - everything works fine. @GeorgeGalaxy can you test again? It's possible Apple fixed their regression.

But, I've just tried to connect my Bitbox02 to sparrow wallet on another macOS device, and it's work correctly. I honestly don't even know why it doesn't work on my 1st mac..
So, I suppose that this trouble was resolved :) Thank you for your help

@Ugalila
Copy link

Ugalila commented Jun 25, 2023

Hi all, I was the one reporting this issue on Telegram.
For me the problem still exists. Still receiving the "Error executing HWI" on MacBook Air M1 with macOS 13.4.1.
What can I do to help solving the problem?

@benma
Copy link

benma commented Jun 25, 2023

I've tested on MacOS Ventura 13.4 and could not reproduce - everything works fine. @GeorgeGalaxy can you test again? It's possible Apple fixed their regression.

Did you test using a Bitbox02 Bitcoin-only or Multi? The problem with the outdated hidapi lib is only a problem for the Multi edition.

@Ugalila are you using a Multi? In that case it's the same - HWI needs to merge bitcoin-core/HWI#677 (cc @achow101) and make a new release and Sparrow then needs to update to that new release.

@benma
Copy link

benma commented Jun 25, 2023

@GeorgeGalaxy

But, I've just tried to connect my Bitbox02 to sparrow wallet on another macOS device, and it's work correctly. I honestly don't even know why it doesn't work on my 1st mac..

Maybe one of your mac's is on 13.3+ while the other one is <13.3? The hidapi issue appears only on 13.3+ afaik.

@Ugalila
Copy link

Ugalila commented Jun 25, 2023

@Ugalila are you using a Multi? In that case it's the same - HWI needs to merge bitcoin-core/HWI#677 (cc @achow101) and make a new release and Sparrow then needs to update to that new release.

Yes, I got the Multi.
So there is nothing more I could contribute I suppose. Just have to wait...

@benma
Copy link

benma commented Jul 7, 2023

@craigraw
Copy link
Collaborator

HWI 2.3.1 has been merged in 407dde2 which should resolve this problem.

@Rizzo92
Copy link

Rizzo92 commented Dec 3, 2023

When trying to scan for Ledger Nano S shows "Error executing HWI". What should i do?

[2473] Failed to execute script 'hwi' due to unhandled exception!

at com.sparrowwallet.sparrow@1.8.1/com.sparrowwallet.sparrow.io.Hwi.getProcessOutput(Unknown Source)
at com.sparrowwallet.sparrow@1.8.1/com.sparrowwallet.sparrow.io.Hwi.execute(Unknown Source)
at com.sparrowwallet.sparrow@1.8.1/com.sparrowwallet.sparrow.io.Hwi.enumerateUsb(Unknown Source)
at com.sparrowwallet.sparrow@1.8.1/com.sparrowwallet.sparrow.io.Hwi.enumerate(Unknown Source)
at com.sparrowwallet.sparrow@1.8.1/com.sparrowwallet.sparrow.io.Hwi$EnumerateService$1.call(Unknown Source)
at com.sparrowwallet.sparrow@1.8.1/com.sparrowwallet.sparrow.io.Hwi$EnumerateService$1.call(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Task$TaskCallable.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$6(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$7(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)

2023-12-03 10:48:55,444 ERROR [Thread-51] c.s.s.i.Hwi [null:-1] Error executing hwi-2.3.1
java.io.IOException: Traceback (most recent call last):
File "PyInstaller/loader/pyimod03_ctypes.py", line 53, in init
File "ctypes/init.py", line 374, in init
OSError: dlopen(libusb-1.0.dylib, 0x0006): tried: '/libusb-1.0.dylib' (no such file), '/Applications/Sparrow.app/Contents/app/libusb-1.0.dylib' (no such file), '/usr/local/lib/libusb-1.0.dylib' (no such file), 'libusb-1.0.dylib' (no such file), '/usr/lib/libusb-1.0.dylib' (no such file), '/libusb-1.0.dylib' (no such file), '/Applications/Sparrow.app/Contents/app/libusb-1.0.dylib' (no such file), '//libusb-1.0.dylib' (no such file)

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

Traceback (most recent call last):
File "hwi.py", line 7, in
File "hwilib/_cli.py", line 304, in main
File "hwilib/_cli.py", line 270, in process_commands
File "hwilib/_cli.py", line 63, in enumerate_handler
File "hwilib/commands.py", line 117, in enumerate
File "hwilib/devices/trezor.py", line 855, in enumerate
File "hwilib/devices/trezorlib/transport/webusb.py", line 115, in enumerate
File "usb1/init.py", line 2174, in open
File "usb1/_libusb1.py", line 210, in loadLibrary
File "usb1/_libusb1.py", line 219, in __loadLibrary
File "usb1/_libusb1.py", line 158, in __getLibrary
File "PyInstaller/loader/pyimod03_ctypes.py", line 55, in init
pyimod03_ctypes.install..PyInstallerImportError: Failed to load dynlib/dll 'libusb-1.0.dylib'. Most likely this dynlib/dll was not found when the application was frozen.

@craigraw
Copy link
Collaborator

craigraw commented Dec 4, 2023

@Rizzo92 a couple of things to try:

  1. Close Sparrow, and delete the folder ~/.sparrow/hwi/hwi-2.3.1/. Sparrow will recreate it. It should contain the libusb-1.0.dylib file.
  2. If you use Homebrew, run brew install libusb. This shoudn't be necessary, but it may help anyway.

@kingmehodl
Copy link

I am also getting "Error executing HWI" when attempting to connect a TrezorOne
Sparrow wallet logs show the following:
2024-01-02 03:24:36,671 ERROR [Thread-117] c.s.s.i.Hwi [null:-1] Error executing hwi-2.3.1
java.io.IOException: [10621] Error loading Python lib '/tmp/_MEIlbitNa/libpython3.9.so.1.0': dlopen: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /tmp/_MEIlbitNa/libpython3.9.so.1.0)

at com.sparrowwallet.sparrow@1.8.1/com.sparrowwallet.sparrow.io.Hwi.getProcessOutput(Unknown Source)
at com.sparrowwallet.sparrow@1.8.1/com.sparrowwallet.sparrow.io.Hwi.execute(Unknown Source)
at com.sparrowwallet.sparrow@1.8.1/com.sparrowwallet.sparrow.io.Hwi.enumerateUsb(Unknown Source)
at com.sparrowwallet.sparrow@1.8.1/com.sparrowwallet.sparrow.io.Hwi.enumerate(Unknown Source)
at com.sparrowwallet.sparrow@1.8.1/com.sparrowwallet.sparrow.io.Hwi$ScheduledEnumerateService$1.call(Unknown Source)
at com.sparrowwallet.sparrow@1.8.1/com.sparrowwallet.sparrow.io.Hwi$ScheduledEnumerateService$1.call(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Task$TaskCallable.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$6(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$7(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)

@craigraw
Copy link
Collaborator

craigraw commented Jan 3, 2024

@kingmehodl You may need to update glibc. You can see the current version with ldd --version.

@kingmehodl
Copy link

thanks @craigraw ....updated ubuntu and everything works now. cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants