spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.33k stars 3.05k forks source link

Ledger device stopped working #8568

Open rvalle opened 1 year ago

rvalle commented 1 year ago

My electrum / ledger setup stopped working.

The Appimage won't find the device at startup: "No hardware device detected".

I can see these errors when launching the AppImage from console:

/usr/lib/x86_64-linux-gnu/gio/modules/libgvfsdbus.so: undefined symbol: g_date_time_format_iso8601
Failed to load module: /usr/lib/x86_64-linux-gnu/gio/modules/libgvfsdbus.so
 17.82 | W | jade | No module named 'electrum.plugins.jade.jadepy.jade_ble'
 17.82 | W | jade | BLE scanning/connectivity will not be available

Ledger device is working fine with other software. I have also updated to latest version.

any idea ? what could be wrong?

SomberNight commented 1 year ago

I have also updated to latest version.

So is this with using Electrum 4.4.5? What is the version of the "bitcoin app" installed on the Ledger device?

I can see these errors when launching the AppImage from console

What about debug logs?

rvalle commented 1 year ago

@SomberNight I just tried from the Python version, also fails to detect the device but gives some more information:


Debug message
  bitbox02: (error getting device infos)
    Missing libraries for bitbox02.
        ImportError()
    Make sure you install it with python3
  coldcard: (error getting device infos)
    Missing libraries for coldcard.
        ModuleNotFoundError("No module named 'ckcc'")
    Make sure you install it with python3
  jade: (error getting device infos)
    Missing libraries for jade.
        ModuleNotFoundError("No module named 'cbor'")
    Make sure you install it with python3
  keepkey: (error getting device infos)
    Missing libraries for keepkey.
    Make sure you install it with python3
  ledger: (error getting device infos)
    Missing libraries for ledger.
        ModuleNotFoundError("No module named 'ledger_bitcoin'")
    Make sure you install it with python3
  safe_t: (error getting device infos)
    Missing libraries for safe_t.
        ModuleNotFoundError("No module named 'safetlib'")
    Make sure you install it with python3
  trezor: (error getting device infos)
    Missing libraries for trezor.
        ModuleNotFoundError("No module named 'trezorlib'")
    Make sure you install it with python3
SomberNight commented 1 year ago

That's because you have install hw device related dependencies yourself in that case. See https://github.com/spesmilo/electrum-docs/blob/master/hardware-linux.rst

rvalle commented 1 year ago

thanks @SomberNight , I installed them now, and get:

Debug message
  bitbox02: (error getting device infos)
    Missing libraries for bitbox02.
        ImportError()
    Make sure you install it with python3
  coldcard: (error getting device infos)
    Missing libraries for coldcard.
        ModuleNotFoundError("No module named 'ckcc'")
    Make sure you install it with python3
  jade: (error getting device infos)
    Missing libraries for jade.
        ModuleNotFoundError("No module named 'cbor'")
    Make sure you install it with python3
  keepkey: (error getting device infos)
    Missing libraries for keepkey.
    Make sure you install it with python3
  safe_t: (error getting device infos)
    Missing libraries for safe_t.
        ModuleNotFoundError("No module named 'safetlib'")
    Make sure you install it with python3
  trezor: (error getting device infos)
    Missing libraries for trezor.
        ModuleNotFoundError("No module named 'trezorlib'")
    Make sure you install it with python3

Looks like now, I am not getting any missing component for Ledger, yet, it wont find the device.

rvalle commented 1 year ago

@SomberNight here are the logs from the AppImage:

rafael@tuxraf:~/Applications$ ./electrum-4.4.5-x86_64_b9fcbc24bbf8a356c77a8738f90270e3.AppImage -v
qt5ct: using qt5ct plugin
  1.20 | I | i18n | gettext setting initial language to None
  2.02 | I | simple_config.SimpleConfig | electrum directory /home/rafael/.electrum
  2.11 | I | __main__ | get_default_language: detected default as lang='en_UK'
  2.11 | I | i18n | setting language to 'en_UK'
  2.11 | I | logging | Electrum version: 4.4.5 - https://electrum.org - https://github.com/spesmilo/electrum
  2.12 | I | logging | Python version: 3.9.15 (main, Jun 28 2018, 19:01:02) 
[GCC 8.3.0]. On platform: Linux-5.15.0-10075-tuxedo-x86_64-with-glibc2.31
  2.12 | I | logging | Logging to file: None
  2.12 | I | logging | Log filters: verbosity '*', verbosity_shortcuts ''
  2.12 | I | p/plugin.Plugins | registering hardware bitbox02: ('hardware', 'bitbox02', 'BitBox02')
  2.12 | I | p/plugin.Plugins | registering hardware coldcard: ('hardware', 'coldcard', 'Coldcard Wallet')
  2.13 | I | p/plugin.Plugins | registering hardware digitalbitbox: ('hardware', 'digitalbitbox', 'Digital Bitbox wallet')
  2.13 | I | p/plugin.Plugins | registering hardware jade: ('hardware', 'jade', 'Jade wallet')
  2.13 | I | p/plugin.Plugins | registering hardware keepkey: ('hardware', 'keepkey', 'KeepKey wallet')
  2.13 | I | p/plugin.Plugins | registering hardware ledger: ('hardware', 'ledger', 'Ledger wallet')
  2.14 | I | p/plugin.Plugins | registering hardware safe_t: ('hardware', 'safe_t', 'Safe-T mini wallet')
  2.14 | I | p/plugin.Plugins | registering hardware trezor: ('hardware', 'trezor', 'Trezor wallet')
  2.14 | I | p/plugin.Plugins | registering wallet type ('2fa', 'trustedcoin')
  2.14 | D | util.profiler | Plugins.__init__ 0.0245 sec
  2.14 | I | n/network | blockchains [0]
  2.15 | I | n/network | setting proxy None
  2.15 | I | exchange_rate.FxThread | using exchange CoinGecko
  2.15 | D | util.profiler | Daemon.__init__ 0.0092 sec
  2.15 | I | daemon.Daemon | launching GUI: qt
  2.15 | I | daemon.Daemon | starting taskgroup.
  2.15 | I | daemon.CommandsServer | now running and listening. socktype=unix, addr=/home/rafael/.electrum/daemon_rpc_socket
  2.48 | I | gui.qt.ElectrumGui | Qt GUI starting up... Qt=5.15.2, PyQt=5.15.9
/usr/lib/x86_64-linux-gnu/gio/modules/libgvfsdbus.so: undefined symbol: g_date_time_format_iso8601
Failed to load module: /usr/lib/x86_64-linux-gnu/gio/modules/libgvfsdbus.so
  2.80 | D | util.profiler | ElectrumGui.__init__ 0.3249 sec
  2.80 | I | daemon.Daemon | starting network.
  2.80 | I | n/network | starting network
  2.81 | I | n/network | setting proxy None
  2.81 | I | storage.WalletStorage | wallet path /home/rafael/.electrum/wallets/ld_stash
  2.81 | I | n/network | connecting to blkhub.net:50002:s as new interface
  2.81 | I | n/network | starting taskgroup (0x7fe0dbf0c640).
  2.81 | I | exchange_rate.CoinGecko | getting fx quotes for USD
  2.81 | D | util.profiler | Daemon._load_wallet 0.0061 sec
  2.92 | I | storage.WalletStorage | wallet path /home/rafael/.electrum/wallets/ld_stash
  3.12 | I | exchange_rate.CoinGecko | received fx quotes
  3.14 | I | i/interface.[blkhub.net:50002] | succeeded in getting cert
  3.15 | I | i/interface.[electrum.exan.tech:443] | disconnecting due to: CancelledError()
  3.15 | I | n/network | couldn't launch iface electrum.exan.tech:443:s -- CancelledError()
  3.22 | I | i/interface.[fortress.qtornado.com:443] | connection established. version: ['ElectrumX 1.16.0', '1.4']
  3.26 | I | i/interface.[blkhub.net:50002] | connection established. version: ['ElectrumX 1.16.0', '1.4']
  3.26 | I | i/interface.[fortress.qtornado.com:443] | set blockchain with height 802251
  3.26 | I | i/interface.[fortress.qtornado.com:443] | skipping header 802251
  3.26 | I | n/network | no height for main interface
  3.26 | I | i/interface.[electrum.hodlister.co:50002] | connection established. version: ['ElectrumX 1.10.0', '1.4']
  3.27 | I | n/network | fee_estimates {25: 23146, 10: 24567, 5: 27015, 2: 31304}
  3.29 | I | i/interface.[blkhub.net:50002] | set blockchain with height 802251
  3.29 | I | i/interface.[blkhub.net:50002] | skipping header 802251
  3.29 | I | n/network | no height for main interface
  3.29 | I | n/network | switching to fortress.qtornado.com:443:s
  3.30 | I | i/interface.[electrum.hodlister.co:50002] | set blockchain with height 802251
  3.30 | I | i/interface.[electrum.hodlister.co:50002] | skipping header 802251
  3.37 | I | n/network | fee_histogram [[42.4, 30066], [37.9, 38211], [33.3, 37503], [31.4, 42141], [28.6, 45976], [27.7, 51226], [27.1, 103321], [26.7, 68169], [26.2, 78894], [26.0, 155157], [25.8, 155537], [25.2, 90102], [24.6, 96358], [24.0, 119560], [23.1, 122106], [22.0, 128832], [20.8, 144292], [20.0, 181147], [19.0, 195404], [18.2, 132757], [18.1, 516400], [17.7, 222263], [17.1, 277746], [17.0, 826522], [16.6, 357765], [13.5, 339896], [12.6, 397101], [12.3, 408984], [11.0, 490369], [10.0, 509587], [8.6, 536298], [8.0, 801545], [7.0, 855013], [6.7, 46079], [6.6, 1762675], [6.5, 872671], [6.4, 1037211], [6.3, 3731336], [6.2, 1630712], [6.1, 5304702], [6.0, 2351295], [5.9, 3164173], [5.6, 2735527], [5.3, 2428704], [5.1, 1803922], [5.0, 6356066], [4.7, 3003664], [4.5, 3732275], [4.2, 4527898], [4.0, 6192098], [3.8, 4078391], [3.7, 5867109], [3.3, 4809778], [3.0, 11970570], [2.2, 5736598], [2.1, 5766222], [2.0, 8265215], [1.2, 7125120]]
  3.39 | I | i/interface.[eai.coincited.net:50002] | disconnecting due to: ConnectError(ConnectionRefusedError(111, "Connect call failed ('52.67.225.163', 50002)"))
  3.39 | I | n/network | couldn't launch iface eai.coincited.net:50002:s -- CancelledError()
  3.45 | I | i/interface.[vmd71287.contaboserver.net:50002] | disconnecting due to: ErrorGettingSSLCertFromServer(ConnectError(gaierror(-2, 'Name or service not known')))
  3.46 | I | n/network | couldn't launch iface vmd71287.contaboserver.net:50002:s -- CancelledError()
  3.50 | I | i/interface.[ex03.axalgo.com:50002] | disconnecting due to: ConnectError(gaierror(-5, 'No address associated with hostname'))
  3.50 | I | n/network | couldn't launch iface ex03.axalgo.com:50002:s -- CancelledError()
  3.68 | I | i/interface.[e.keff.org:50002] | disconnecting due to: ConnectError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129)'))
  3.68 | I | n/network | couldn't launch iface e.keff.org:50002:s -- CancelledError()
  3.89 | I | i/interface.[electrum.blockstream.info:50002] | connection established. version: ['electrs-esplora 0.4.1', '1.4']
  4.12 | I | i/interface.[electrum.blockstream.info:50002] | set blockchain with height 802251
  4.12 | I | i/interface.[electrum.blockstream.info:50002] | skipping header 802251
  4.34 | I | i/interface.[wisemansfear.xyz:50002] | succeeded in getting cert
  4.46 | I | i/interface.[34.67.22.216:50002] | succeeded in getting cert
  4.76 | I | i/interface.[wisemansfear.xyz:50002] | connection established. version: ['ElectrumX 1.16.0', '1.4']
  4.96 | I | i/interface.[34.67.22.216:50002] | connection established. version: ['ElectrumX 1.16.0', '1.4']
  4.96 | I | i/interface.[wisemansfear.xyz:50002] | set blockchain with height 802251
  4.96 | I | i/interface.[wisemansfear.xyz:50002] | skipping header 802251
  5.07 | I | i/interface.[bitcoin.lu.ke:50002] | succeeded in getting cert
  5.08 | I | i/interface.[34.67.22.216:50002] | set blockchain with height 802251
  5.08 | I | i/interface.[34.67.22.216:50002] | skipping header 802251
  5.09 | I | n/network | fee_estimates {25: 23146, 10: 24567, 5: 27016, 2: 31304}
/usr/lib/x86_64-linux-gnu/gio/modules/libgvfsdbus.so: undefined symbol: g_date_time_format_iso8601
Failed to load module: /usr/lib/x86_64-linux-gnu/gio/modules/libgvfsdbus.so
  5.20 | I | i/interface.[bitcoin.lu.ke:50002] | connection established. version: ['ElectrumX 1.16.0', '1.4']
  5.23 | I | i/interface.[bitcoin.lu.ke:50002] | set blockchain with height 802251
  5.24 | I | i/interface.[bitcoin.lu.ke:50002] | skipping header 802251
  5.24 | I | n/network | fee_estimates {25: 23146, 10: 24567, 5: 27015, 2: 31304}
  6.28 | I | i/interface.[horsey.cryptocowboys.net:50002] | connection established. version: ['ElectrumX 1.15.0', '1.4']
  6.83 | I | i/interface.[horsey.cryptocowboys.net:50002] | set blockchain with height 802251
  6.83 | I | i/interface.[horsey.cryptocowboys.net:50002] | skipping header 802251
  8.90 | I | storage.WalletStorage | wallet path /home/rafael/.electrum/wallets/ld_wallet
 14.08 | I | p/plugin.Plugins | loaded bitbox02
 14.10 | I | p/plugin.Plugins | loaded coldcard
 14.11 | I | p/plugin.Plugins | loaded digitalbitbox
 14.14 | W | jade | No module named 'electrum.plugins.jade.jadepy.jade_ble'
 14.14 | W | jade | BLE scanning/connectivity will not be available
 14.14 | I | p/plugin.Plugins | loaded jade
 14.27 | I | p/plugin.Plugins | loaded keepkey
 14.37 | I | p/plugin.Plugins | loaded ledger
 14.45 | I | p/plugin.Plugins | loaded safe_t
 14.62 | I | p/plugin.Plugins | loaded trezor
 14.63 | I | plugin.DeviceMgr | scanning devices...
 14.75 | D | util.profiler | DeviceMgr.scan_devices 0.1236 sec
 14.76 | I | plugins.ledger.qt.Plugin | cannot connect at b'0001:0002:00' unpack requires a buffer of 1 bytes
rvalle commented 1 year ago

@SomberNight Logs in the Python version are slightly different, I copy them also:

rafael@tuxraf:~/Development/oss$ python3 Electrum-4.4.5/run_electrum -v
  0.14 | I | i18n | gettext setting initial language to None
  0.32 | I | simple_config.SimpleConfig | electrum directory /home/rafael/.electrum
  0.33 | I | __main__ | get_default_language: detected default as lang='en_UK'
  0.33 | I | i18n | setting language to 'en_UK'
  0.33 | I | logging | Electrum version: 4.4.5 - https://electrum.org - https://github.com/spesmilo/electrum
  0.34 | I | logging | Python version: 3.8.10 (default, May 26 2023, 14:05:08) 
[GCC 9.4.0]. On platform: Linux-5.15.0-10075-tuxedo-x86_64-with-glibc2.29
  0.34 | I | logging | Logging to file: None
  0.34 | I | logging | Log filters: verbosity '*', verbosity_shortcuts ''
  0.34 | I | p/plugin.Plugins | registering hardware bitbox02: ('hardware', 'bitbox02', 'BitBox02')
  0.34 | I | p/plugin.Plugins | registering hardware coldcard: ('hardware', 'coldcard', 'Coldcard Wallet')
  0.34 | I | p/plugin.Plugins | registering hardware digitalbitbox: ('hardware', 'digitalbitbox', 'Digital Bitbox wallet')
  0.34 | I | p/plugin.Plugins | registering hardware jade: ('hardware', 'jade', 'Jade wallet')
  0.34 | I | p/plugin.Plugins | registering hardware keepkey: ('hardware', 'keepkey', 'KeepKey wallet')
  0.34 | I | p/plugin.Plugins | registering hardware ledger: ('hardware', 'ledger', 'Ledger wallet')
  0.34 | I | p/plugin.Plugins | registering hardware safe_t: ('hardware', 'safe_t', 'Safe-T mini wallet')
  0.34 | I | p/plugin.Plugins | registering hardware trezor: ('hardware', 'trezor', 'Trezor wallet')
  0.34 | I | p/plugin.Plugins | registering wallet type ('2fa', 'trustedcoin')
  0.34 | D | util.profiler | Plugins.__init__ 0.0028 sec
  0.34 | I | n/network | blockchains [0]
  0.34 | I | n/network | setting proxy None
  0.34 | I | exchange_rate.FxThread | using exchange CoinGecko
  0.34 | D | util.profiler | Daemon.__init__ 0.0028 sec
  0.34 | I | daemon.Daemon | launching GUI: qt
  0.35 | I | daemon.Daemon | starting taskgroup.
  0.36 | I | daemon.CommandsServer | now running and listening. socktype=unix, addr=/home/rafael/.electrum/daemon_rpc_socket
  0.37 | I | gui.qt.ElectrumGui | Qt GUI starting up... Qt=5.12.8, PyQt=5.14.1
qt5ct: using qt5ct plugin
qt5ct: D-Bus system tray: yes
  0.47 | D | util.profiler | ElectrumGui.__init__ 0.1025 sec
  0.47 | I | daemon.Daemon | starting network.
  0.48 | I | storage.WalletStorage | wallet path /home/rafael/.electrum/wallets/ld_stash
  0.48 | I | n/network | starting network
  0.48 | I | n/network | setting proxy None
  0.48 | I | n/network | connecting to 188.230.155.0:50002:s as new interface
  0.48 | I | n/network | starting taskgroup (0x7f8bd8008130).
  0.48 | I | exchange_rate.CoinGecko | getting fx quotes for USD
  0.48 | D | util.profiler | Daemon._load_wallet 0.0038 sec
  0.51 | I | storage.WalletStorage | wallet path /home/rafael/.electrum/wallets/ld_stash
  0.57 | I | exchange_rate.CoinGecko | received fx quotes
  0.92 | I | i/interface.[venmrle3xuwkgkd42wg7f735l6cghst3sdfa3w3ryib2rochfhld6lid.onion:50002] | disconnecting due to: ErrorGettingSSLCertFromServer(ConnectError(gaierror(-2, 'Name or service not known')))
  0.93 | I | n/network | couldn't launch iface venmrle3xuwkgkd42wg7f735l6cghst3sdfa3w3ryib2rochfhld6lid.onion:50002:s -- CancelledError()
  1.01 | I | i/interface.[wsw6tua3xl24gsmi264zaep6seppjyrkyucpsmuxnjzyt3f3j6swshad.onion:50002] | disconnecting due to: ErrorGettingSSLCertFromServer(ConnectError(gaierror(-2, 'Name or service not known')))
  1.01 | I | n/network | couldn't launch iface wsw6tua3xl24gsmi264zaep6seppjyrkyucpsmuxnjzyt3f3j6swshad.onion:50002:s -- CancelledError()
  1.13 | I | i/interface.[E-X.not.fyi:50002] | connection established. version: ['ElectrumX 1.10.0', '1.4']
  1.16 | I | i/interface.[E-X.not.fyi:50002] | set blockchain with height 802252
  1.16 | I | i/interface.[E-X.not.fyi:50002] | skipping header 802252
  1.16 | I | n/network | no height for main interface
  1.20 | I | n/network | fee_estimates {25: 23146, 10: 24567, 5: 27017, 2: 31305}
  1.22 | I | i/interface.[electrum.coinext.com.br:50002] | connection established. version: ['ElectrumX 1.14.0', '1.4']
  1.50 | I | i/interface.[bitcoin.aranguren.org:50002] | connection established. version: ['Fulcrum 1.9.1', '1.4']
  1.50 | I | i/interface.[electrum.coinext.com.br:50002] | set blockchain with height 802252
  1.50 | I | i/interface.[electrum.coinext.com.br:50002] | skipping header 802252
  1.50 | I | n/network | no height for main interface
  1.50 | I | n/network | switching to E-X.not.fyi:50002:s
  1.50 | I | n/network | fee_estimates {25: 23146, 10: 24567, 5: 27017, 2: 31304}
  1.54 | I | n/network | fee_histogram [[32, 108993], [27, 101349], [25, 176928], [24, 299786], [23, 200535], [22, 76441], [21, 130196], [20, 208280], [19, 444697], [18, 802081], [17, 1178416], [16, 436459], [15, 62127], [14, 146732], [13, 402984], [12, 547096], [11, 485256], [10, 511062], [9, 390039], [8, 950463], [7, 856047], [6, 16773557], [5, 16481095], [4, 16205993], [3, 29562224], [2, 18872508], [1, 13676565]]
  1.80 | I | i/interface.[bitcoin.aranguren.org:50002] | set blockchain with height 802252
  1.81 | I | i/interface.[bitcoin.aranguren.org:50002] | skipping header 802252
  2.42 | I | i/interface.[electrumx-btc.cryptonermal.net:50002] | connection established. version: ['ElectrumX 1.15.0', '1.4']
  2.60 | I | i/interface.[electrumx-btc.cryptonermal.net:50002] | set blockchain with height 802252
  2.60 | I | i/interface.[electrumx-btc.cryptonermal.net:50002] | skipping header 802251
  2.66 | I | n/network | fee_estimates {25: 23146, 10: 24567, 5: 27016, 2: 31303}
  5.58 | I | storage.WalletStorage | wallet path /home/rafael/.electrum/wallets/ld_wallet
  6.93 | I | p/plugin.Plugins | loaded bitbox02
  6.93 | I | p/plugin.Plugins | loaded coldcard
  6.93 | I | p/plugin.Plugins | loaded digitalbitbox
  6.93 | W | jade | No module named 'electrum.plugins.jade.jadepy.jade_ble'
  6.93 | W | jade | BLE scanning/connectivity will not be available
  6.94 | I | p/plugin.Plugins | loaded jade
  6.94 | I | p/plugin.Plugins | loaded keepkey
  6.96 | I | p/plugin.Plugins | loaded ledger
  6.96 | I | p/plugin.Plugins | loaded safe_t
  6.97 | I | p/plugin.Plugins | loaded trezor
  6.97 | I | plugin.DeviceMgr | scanning devices...
  7.00 | D | util.profiler | DeviceMgr.scan_devices 0.0299 sec
  7.00 | W | gui.qt.installwizard.InstallWizard | error getting device infos for bitbox02: Missing libraries for bitbox02. //     ImportError() // Make sure you install it with python3
  7.00 | W | gui.qt.installwizard.InstallWizard | error getting device infos for coldcard: Missing libraries for coldcard. //     ModuleNotFoundError("No module named 'ckcc'") // Make sure you install it with python3
  7.00 | W | gui.qt.installwizard.InstallWizard | error getting device infos for keepkey: Missing libraries for keepkey. // Make sure you install it with python3
  7.00 | I | plugins.ledger.qt.Plugin | cannot connect at b'1-2:1.0' ('0x5515', 'Error in <DefaultInsType.GET_VERSION: 1> command', '')
  7.00 | W | gui.qt.installwizard.InstallWizard | error getting device infos for safe_t: Missing libraries for safe_t. //     ModuleNotFoundError("No module named 'safetlib'") // Make sure you install it with python3
  7.00 | W | gui.qt.installwizard.InstallWizard | error getting device infos for trezor: Missing libraries for trezor. //     ModuleNotFoundError("No module named 'trezorlib'") // Make sure you install it with python3

I think this is the issue:

  7.00 | I | plugins.ledger.qt.Plugin | cannot connect at b'1-2:1.0' ('0x5515', 'Error in <DefaultInsType.GET_VERSION: 1> command', '')

which I have no idea what it means.

rvalle commented 1 year ago

What is the version of the "bitcoin app" installed on the Ledger device?

Bitcoin app in the device is: Version 2.1.3 • 76 KB

SomberNight commented 1 year ago

I've tested with a nano s plus using bitcoin app 2.1.3, both on Linux and windows, but could not reproduce.

Could there be perhaps another program communicating with the ledger device at the same time?

7.00 | I | plugins.ledger.qt.Plugin | cannot connect at b'1-2:1.0' ('0x5515', 'Error in <DefaultInsType.GET_VERSION: 1> command', '')

That looks interesting.

Could you test with the following patch, to add more details to that log line?

diff --git a/electrum/plugins/ledger/ledger.py b/electrum/plugins/ledger/ledger.py
index c6f9942f48..909610f752 100644
--- a/electrum/plugins/ledger/ledger.py
+++ b/electrum/plugins/ledger/ledger.py
@@ -1426,7 +1426,7 @@ class LedgerPlugin(HW_PluginBase):
         try:
             return Ledger_Client.construct_new(device=device, product_key=device.product_key, plugin=self)
         except Exception as e:
-            self.logger.info(f"cannot connect at {device.path} {e}")
+            self.logger.exception(f"cannot connect at {device.path} {e}")
         return None

     def setup_device(self, device_info, wizard, purpose):
ecdsa commented 1 year ago

I have the same error message

126.13 | I | plugins.ledger.qt.Plugin | cannot connect at b'1-2:1.0' ('0x6e00', 'Error in <DefaultInsType.GET_VERSION: 1> command', '')

I logged the following traceback:

  6.95 | E | plugins.ledger.qt.Plugin | cannot connect at b'1-2:1.0' ('0x6e00', 'Error in <DefaultInsType.GET_VERSION: 1> command', '')
Traceback (most recent call last):
  File "/opt/electrum/electrum/plugins/ledger/ledger.py", line 1427, in create_client
    return Ledger_Client.construct_new(device=device, product_key=device.product_key, plugin=self)
  File "/opt/electrum/electrum/plugins/ledger/ledger.py", line 316, in construct_new
    cl = ledger_bitcoin.createClient(transport, chain=get_chain())
  File "/home/voegtlin/.local/lib/python3.10/site-packages/ledger_bitcoin/client.py", line 283, in createClient
    app_name, app_version, _ = base_client.get_version()
  File "/home/voegtlin/.local/lib/python3.10/site-packages/ledger_bitcoin/client_base.py", line 133, in get_version
    raise DeviceException(
ledger_bitcoin.exception.errors.ClaNotSupportedError: ('0x6e00', 'Error in <DefaultInsType.GET_VERSION: 1> command', '')
ecdsa commented 1 year ago

From the code in ledger_bitcoin/client_base.py, I guess it means that the firmware on my device needs to be updated. We could probably transform that exception in a more user friendly message.

SomberNight commented 1 year ago

@ecdsa your issue seems to be different. The first arg of the exception is the error code coming from the device firmware IIUC. You are getting 0x6e00 (ClaNotSupportedError), while OP got 0x5515 (which is not defined in ledger_bitcoin).

Note: I have now tested on my machine with the same "nano s" device @ecdsa used, and am getting a different exception: 0x6d00 (InsNotSupportedError). Unclear why the difference. (bitcoin app 1.1.10, SE 1.3.1, MCU 1.0)

Anyway, @ecdsa's device is producing these errors most likely due to having old fw, and so we can just try to catch these exceptions and fallback to the old plugin code, see https://github.com/spesmilo/electrum/commit/201309a7f0413c4ba1529928785b5e2396eade0e


As OP has a different error code (0x5515), and is reported running bitcoin app 2.1.3 on the device (which is new), his issue is likely different.

inkarkat commented 3 months ago

I have the same issue as OP; with Ledger Nano S, Bitcoin app version 2.2.2, electrum-4.5.4-x86_64.AppImage

 16.61 | I | plugin.DeviceMgr | scanning devices...                                                                                                                                                                  
 16.67 | D | util.profiler | DeviceMgr.scan_devices 0.0589 sec                                                                                                                                                       
 16.67 | I | plugins.ledger.qt.Plugin | cannot connect at b'3-6:1.0' unpack requires a buffer of 1 bytes                                                                                                             
Traceback (most recent call last):                                                                                                                                                                                   
  File "/tmp/.mount_electrTtc6dv/usr/lib/python3.10/site-packages/electrum/plugins/ledger/ledger.py", line 1437, in create_client                                                                                    
    return Ledger_Client.construct_new(device=device, product_key=device.product_key, plugin=self)
  File "/tmp/.mount_electrTtc6dv/usr/lib/python3.10/site-packages/electrum/plugins/ledger/ledger.py", line 318, in construct_new
    cl = ledger_bitcoin.createClient(transport, chain=get_chain())
  File "/tmp/.mount_electrTtc6dv/usr/lib/python3.10/site-packages/ledger_bitcoin/client.py", line 283, in createClient
    app_name, app_version, _ = base_client.get_version()
  File "/tmp/.mount_electrTtc6dv/usr/lib/python3.10/site-packages/ledger_bitcoin/client_base.py", line 142, in get_version
    app_flags = deser_string(r)
  File "/tmp/.mount_electrTtc6dv/usr/lib/python3.10/site-packages/ledger_bitcoin/_serialize.py", line 82, in deser_string
    nit = deser_compact_size(f)
  File "/tmp/.mount_electrTtc6dv/usr/lib/python3.10/site-packages/ledger_bitcoin/_serialize.py", line 66, in deser_compact_size
    nit: int = struct.unpack("<B", f.read(1))[0]
struct.error: unpack requires a buffer of 1 bytes

Same with the Electrum 4.5.4 Python package:

124.55 | I | plugin.DeviceMgr | scanning devices...
124.56 | D | util.profiler | DeviceMgr.scan_devices 0.0102 sec
124.56 | W | gui.qt.installwizard.InstallWizard | error getting device infos for bitbox02: Missing libraries for bitbox02. //     ImportError() // Make sure you install it with python3
124.57 | W | gui.qt.installwizard.InstallWizard | error getting device infos for coldcard: Missing libraries for coldcard. //     ModuleNotFoundError("No module named 'ckcc'") // Make sure you install it with python3
124.57 | W | gui.qt.installwizard.InstallWizard | error getting device infos for jade: Missing libraries for jade. //     ModuleNotFoundError("No module named 'serial'") // Make sure you install it with python3
124.57 | W | gui.qt.installwizard.InstallWizard | error getting device infos for keepkey: Missing libraries for keepkey. // Make sure you install it with python3
124.58 | I | plugins.ledger.qt.Plugin | cannot connect at b'1-2:1.0' unpack requires a buffer of 1 bytes
124.58 | W | gui.qt.installwizard.InstallWizard | error getting device infos for safe_t: Missing libraries for safe_t. //     ModuleNotFoundError("No module named 'safetlib'") // Make sure you install it with python3
124.58 | W | gui.qt.installwizard.InstallWizard | error getting device infos for trezor: Missing libraries for trezor. //     ModuleNotFoundError("No module named 'trezorlib'") // Make sure you install it with python3