question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IOError: open failed

See original GitHub issue

Hi there. I have the ledger nano s and I’m trying to verify the Secure Element by following the steps given on Ledgers web site.

I made sure to install dependencies first with sudo apt install libudev-dev libusb-1.0-0-dev virtualenv Then per their instruction installed ledgerblue package with sudo pip install --no-cache-dir ledgerblue

Now when I run python2 -m ledgerblue.checkGenuine --targetId 0x31100002

I get the following error Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/usr/local/lib/python2.7/dist-packages/ledgerblue/checkGenuine.py", line 127, in <module> dongle = getDongle(args.apdu) File "/usr/local/lib/python2.7/dist-packages/ledgerblue/comm.py", line 188, in getDongle dev.open_path(hidDevicePath) File "hid.pyx", line 72, in hid.device.open_path IOError: open failed Note I’m using Ubuntu 16.04.2 LTS. Hopefully this is just some simple fix, like maybe I’m not using the correct version of everything.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

5reactions
Sajjoncommented, Apr 1, 2020

TL;DR: Quit macOS desktop app Ledger Live if it is running

Running macOS (host), not using Docker/Python virtualenv, I wanted to delete a Ledger App I previously had installed with python -m ledgerblue.App. In my Terminal I tried running:

python -m ledgerblue.deleteApp --targetId 0x31100004 --appName NAME_OF_APP_TO_DELETE

(where 0x31100004 is the id of a Ledger Nano S, with firmware 1.6.0)

That resulted in an error:

Generated random root public key : b'0481ba79845ad171de2c0f0e38badfbaeede3ec022e7dd8cf5edc406af06d3f6ee10100649bfbcfeb76ac062d41f327afe6532dd45f430fe0febcbd734a549151f'
Traceback (most recent call last):
  File "~/.pyenv/versions/anaconda3-5.3.0/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "~/.pyenv/versions/anaconda3-5.3.0/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "~/.pyenv/versions/anaconda3-5.3.0/lib/python3.6/site-packages/ledgerblue/deleteApp.py", line 75, in <module>
    dongle = getDongle(args.apdu)
  File "~/.pyenv/versions/anaconda3-5.3.0/lib/python3.6/site-packages/ledgerblue/comm.py", line 216, in getDongle
    dev.open_path(hidDevicePath)
  File "hid.pyx", line 72, in hid.device.open_path
OSError: open failed

I tried using sudo python -m ..... but did not help. Then I realized that I had the Desktop app Ledger Live running, after I quit that and rerun the command, it succeded! And I was able to uninstall the app.

1reaction
AronVanAmmerscommented, Mar 20, 2018

For me running the command with sudo is a workaround for this issue.

For ECPy / Python 2.7 there is a workaround here https://github.com/LedgerHQ/blue-loader-python/issues/29, however in my experience the results are the same.

I’m now stuck on https://github.com/LedgerHQ/blue-loader-python/issues/26 with Invalid sequence, so can’t confirm that the above leads to a working end result.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python HIDAPI troubleshooting: open() failures - Stack Overflow
The python statement that attempts to open the HID device: ... line 66, in hid.device.open IOError: open failed.
Read more >
IOError: open failed - Google Groups
I noticed last week that my weather station seemed to have dropped down to only updating Weather Underground and WOW hourly and had...
Read more >
How IOError work in Python with Programming Examples
Commonly, the IOError is raised when an input output operation like open() file, or a method or a simple print statement is failed...
Read more >
Dash is not enumerated when connected via USB on Linux ...
I did some investigation by opening Terminal ( Ctrl + Alt + T ) and, first, running the lsusb command. Sure enough, the...
Read more >
IDC3351I ** VSAM {OPEN|CLOSE|I/O} RETURN CODE ... - IBM
An uncorrectable I/O error occurred while VSAM was reading or writing a catalog record. 145: An uncorrectable error occurred in the VSAM volume...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found