solokeys / solo2-cli

Solo 2 library and CLI in Rust
https://docs.rs/solo2
Apache License 2.0
173 stars 31 forks source link

update fails #51

Closed loveshack closed 2 years ago

loveshack commented 2 years ago

I've just tried "solo2 update" before reporting anything else (from firmware 1:20200101.8) with the cli v0.1.1 on Debian 11, with no luck. When I tap (more like prod) at the prompt, the key goes dead and needs to be unplugged. The kernel log has multiple disconnect messages. I don't know if it's necessary, but I had reloaded udev with the given rules; I don't know when they are actually needed, but probably the readme here should at least mention installing them. Anyway, I see this before it dies:

$ SOLO2_LOG=info solo2 update
Downloading latest release from https://github.com/solokeys/solo2/
Fetched firmware version 1:20200101.9
 INFO  solo2::transport > using CTAP as minimal transport
 INFO  solo2::device    > device fw version: 1:20200101.8
 INFO  solo2::device    > new fw version: 1:20200101.9
Tap button on key to confirm, or replug to abort...
 INFO  solo2::transport > using CTAP as minimal transport

The prompt says "replug to abort", but the command just hangs pending ^C. Also it says "tap the button", but there isn't anything most people would call a button, and it's not clear whether that means any of the edges or a specific one.

loveshack commented 2 years ago

For what it's worth, I tried the update from a Fedora 35 live image, and it worked. I can't tell what the relevant difference is between the two, though they were on different laptops (F35 on Dell XPS 9630, Debian 11 on Thinkpad T460 I didn't want to reboot for that). Using a backported pcscd 1.9.5 from Debian unstable (more recent than Fedora's), along with a fixed libccid to use PCSC, didn't help.

I hadn't seen relevant syslog messages originally. These are from the failed attempt, but I don't know what to make of them:

pcscd[1950009]: 01000118 winscard.c:1618:SCardTransmit() Card not transacted: 0x80100017
pcscd[1950009]: 00000026 eventhandler.c:336:EHStatusHandlerThread() Error communicating to: SoloKeys Solo 2 [CCID/ICCD Interface] (3E0EA0575ACCC859B74D69D262679BEF) 00 00
pcscd[1950009]: 00400245 ccid_usb.c:858:WriteUSB() write failed (1/90): -4 LIBUSB_ERROR_NO_DEVICE

Can someone suggest how to debug this?

lauhayden commented 2 years ago

The difference is that Fedora has a more recent CCID library, as mentioned in one of their updates. In order to update firmware on older Linux distros, add the udev rules to /etc/udev/rules.d and re-plug. I believe you can also update the libccid configuration, as mentioned here: https://github.com/solokeys/solo2-cli/issues/52#issuecomment-1054548831

loveshack commented 2 years ago

Thanks, but unfortunately not. As I understand it's supposed not to need pcscd, but I used the 1.5.0 backport I did (linked through the wontfix Debian issue), which is the latest release. Anyway, as far as I can tell, the only relevant part of that is the definition in Info.plist. (It would at least be useful to document that simple solution -- if there was any sign of support for the keys, sigh.)

lauhayden commented 2 years ago

Sorry I wasn't clear enough, I think libccid and the udev rules are independent solutions. For what it's worth, I ran into the same symptoms as you (the CLI asking for the key to confirm) but was able to update once I added the udev rules. I'm on Ubuntu 20.04.

loveshack commented 2 years ago

Thanks for making me double check this.

It turns out that my udev rules were missing the "ROM bootloader (unmodified)" line. I don't remember how I got the rules originally on the Debian system -- apparently not from the right place, or maybe they were bundled somewhere and I just picked the ones labelled Solo 2. Anyhow, it works now, thanks again.