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

Avalanche CLI fails to interact with Ledger Device after App update to v0.8.4 #326

Open
saan099 opened this issue Sep 19, 2024 · 4 comments · Fixed by #330
Open

Avalanche CLI fails to interact with Ledger Device after App update to v0.8.4 #326

saan099 opened this issue Sep 19, 2024 · 4 comments · Fixed by #330

Comments

@saan099
Copy link

saan099 commented Sep 19, 2024

Specifications:
Ledger Device:- Ledger nano S+
OS:- Ubuntu 22.04
Avalanche Ledger App Version:- 0.8.4
Avalanche CLI version:- v1.7.1(also tested with older v1.3.5)

Description
We are using 4 Ledger nano S+ devices onto for our purposes on the Ubuntu machines and this issue seems has been encountered with the three of the devices that we've tried on so far. Accessing the ledger wallet using Avalanche CLI fails with the following error:-

$ avalanche key list --ledger 0 --mainnet
Error: LedgerHID device (idx 0) not found. Ledger LOCKED OR Other Program/Web Browser may have control of device.

The device is unlocked and the avalanche app is in ready state during this command's execution. This issue has only started coming since the firmware of the device has been updated 1.1.2 and avalanche app has been updated from version 0.7.3 to 0.8.4. The same 3 devices which function with these updated softwares seem to have all developed the issue, while the one device that's still running the older firmware and avalanche ledger app continues to work fine for the command above. We also made sure that the device is not connected to ledger live app(which was closed at the time) and also any browser window(wallet).

Hints & Observations:

  • We've tested two CLI versions, latest - 1.7.1 and 1.3.5, the issue exists with both of them for the 3 updated devices and both versions work fine with the non-updated device.
  • We've seen that the ledger device after the upgraded firmware & avalanche ledger app, continues to connect perfectly fine with the core wallet extension, as well as with the ledger live app.
  • We've been able to produce the above issue on two separate Ubuntu 22.04 machines ensuring the device is not connected anywhere else, also rebooting the machines and trying to access with avalanche CLI as the first thing when it reboots again.
  • We do observe that the ledger-go library in the codebase of both avalanche CLI and ledger-avalanche code base have a version of v0.14.3 while there is a later version available is v0.15.
  • We can also confirm that if the avalanche app is intentionally kept closed(not in 'Avalanche ready' state), the error thrown by the CLI is Error: [APDU_CODE_APP_NOT_OPEN] Ledger Connected but Chain Specific App Not Open which means that avalanche CLI does recognise the device and also the fact that it is unlocked.
@saan099
Copy link
Author

saan099 commented Sep 20, 2024

Also, building avalanche CLI manually from source as the link suggests here doesn't work as suggested here. We've tried to build it as it is from main branch, then updating with the latest release of ledger-avalanche package(v0.8.4), and also taking the main branch of ledger-avalanche package and using that within build of avalanche CLI. We get the same problem.

@sourajyoti-gupta
Copy link

Hi @saan099 , Ledger firmware updates to Nano S+ devices recently to 1.1.2 is highly susceptible to have caused this error as we've observed this in the past as well. A few things I would like to suggest:

  1. We recently merged few dependencies with the hw-app-lib (libraries) and it might work now for you. Have you tried very recently again?
  2. The app has a new release v0.8.5, please update your device and try again.
  3. Also you to erase your device cache of old Firmware upgrade from the browser you're connecting. An installation of fresh Ledger Nano S+ with updated firmware will do the trick.
  4. Make sure your device is not connected to any other wallet, app, swap/bridge websites, etc. while you're connecting it to Ledger Live.

@saan099
Copy link
Author

saan099 commented Sep 25, 2024

Hi @sourajyoti-gupta , Thanks for the information.

I've built the avalanche-cli again with the new updated version of ledger-avalanche. But that doesn't help. It gives the same issue. Following mechanism was used to do so,
$ go get github.com/ava-labs/ledger-avalanche/go@latest
$ go mod tidy
$ go build -o avalanche-cli

I also cleaned my browser(chrome) cache, fully for all sites before trying to connect.

For using updated ledger-avalanche app within the device. I see that the ledger live app still shows the latest available release to be 0.8.4. I see that the repo however has the new marked release of 0.8.5. Will it be some time before we see it on the ledger live app for updatting the app? I see the disclaimer in readme of course which discourages using the release directly on the ledger device.

@ainhoa-a
Copy link
Collaborator

ainhoa-a commented Oct 9, 2024

We’ve identified the root cause and implemented a solution. As initially suspected, the issue originated from the firmware upgrade to Ledger version 1.1.2, which impacted the ledger-go package responsible for device connection. The fix involved adjusting the HID product ID. We also upgraded other dependencies. Notably, the issue only affected Linux, not macOS or Windows.

A new release will be published shortly. Apps that use this library (https://github.com/ava-labs/ledger-avalanche/tree/main/go) as a dependency will need to update it.

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

Successfully merging a pull request may close this issue.

3 participants