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

IOError: open failed #21

Closed
hackerDEpandas opened this issue Jan 7, 2018 · 5 comments
Closed

IOError: open failed #21

hackerDEpandas opened this issue Jan 7, 2018 · 5 comments

Comments

@hackerDEpandas
Copy link

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.

@p-t-u
Copy link

p-t-u commented Feb 7, 2018

I have the exact same error, except for I am trying to run it in Python 3.

I am on Ubuntu 16.04.3 LTS, 64-bit.

Also, I cannot install the ledgerblue module under Python 2, because ECPy (which is a dependency of ledgerblue) no longer supports Python 2.

ECPy requires Python '>=3' but the running Python is 2.7.12.

@AronVanAmmers
Copy link

AronVanAmmers commented 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 #29, however in my experience the results are the same.

I'm now stuck on #26 with Invalid sequence, so can't confirm that the above leads to a working end result.

@sleepdefic1t
Copy link

@hackerDEpandas

This issue is two years old, but to you or anyone else... make sure to set the udev rules.

Ledger Support: Troubleshooting - What if Ledger Wallet is not recognized on Linux?

My team also uses a script for setting udev in Ubuntu.

#!/usr/bin/env bash

cat <<EOF > /etc/udev/rules.d/20-hw1.rules
# HW.1 / Nano
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2581", ATTRS{idProduct}=="1b7c|2b7c|3b7c|4b7c", TAG+="uaccess", TAG+="udev-acl"
# Blue
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0000|0000|0001|0002|0003|0004|0005|0006|0007|0008|0009|000a|000b|000c|000d|000e|000f|0010|0011|0012|0013|0014|0015|0016|0017|0018|0019|001a|001b|001c|001d|001e|001f", TAG+="uaccess", TAG+="udev-acl", MODE="0660", GROUP="plugdev"
# Nano S
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0001|1000|1001|1002|1003|1004|1005|1006|1007|1008|1009|100a|100b|100c|100d|100e|100f|1010|1011|1012|1013|1014|1015|1016|1017|1018|1019|101a|101b|101c|101d|101e|101f", TAG+="uaccess", TAG+="udev-acl", MODE="0660", GROUP="plugdev"
# Aramis
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0002|2000|2001|2002|2003|2004|2005|2006|2007|2008|2009|200a|200b|200c|200d|200e|200f|2010|2011|2012|2013|2014|2015|2016|2017|2018|2019|201a|201b|201c|201d|201e|201f", TAG+="uaccess", TAG+="udev-acl", MODE="0660", GROUP="plugdev"
# HW2
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0003|3000|3001|3002|3003|3004|3005|3006|3007|3008|3009|300a|300b|300c|300d|300e|300f|3010|3011|3012|3013|3014|3015|3016|3017|3018|3019|301a|301b|301c|301d|301e|301f", TAG+="uaccess", TAG+="udev-acl", MODE="0660", GROUP="plugdev"
# Nano X
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0004|4000|4001|4002|4003|4004|4005|4006|4007|4008|4009|400a|400b|400c|400d|400e|400f|4010|4011|4012|4013|4014|4015|4016|4017|4018|4019|401a|401b|401c|401d|401e|401f", TAG+="uaccess", TAG+="udev-acl", MODE="0660", GROUP="plugdev"
EOF

udevadm trigger
udevadm control --reload-rules

https://github.com/ArkEcosystem/ledger/blob/develop/scripts/udev.sh

usage:
sudo bash ./udev.sh

@Sajjon
Copy link

Sajjon commented 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.

@menxit
Copy link

menxit commented Apr 25, 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.

Great, thank you :) !

@Saltari Saltari closed this as completed Nov 22, 2021
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

7 participants