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

yubioath-desktop unable to import 'yubikey' Python module #202295

Closed
aidalgol opened this issue Nov 22, 2022 · 5 comments
Closed

yubioath-desktop unable to import 'yubikey' Python module #202295

aidalgol opened this issue Nov 22, 2022 · 5 comments
Labels
0.kind: bug Something is broken

Comments

@aidalgol
Copy link
Contributor

Describe the bug

yubioath-desktop is unable to talk to YubiKey devices, seemingly because it is unable to import the yubikey python module.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Launch yubioath-desktop from a terminal
qrc:/qml/main.qml:305:5: QML Shortcut: Shortcut: Only binding to one of multiple key bindings associated with 7. Use 'sequences: [ <key> ]' to bind to all of them.
qrc:/qml/main.qml:297:5: QML Shortcut: Shortcut: Only binding to one of multiple key bindings associated with 9. Use 'sequences: [ <key> ]' to bind to all of them.
Qt Quick Layouts: Detected recursive rearrange. Aborting after two iterations.
Qt Quick Layouts: Detected recursive rearrange. Aborting after two iterations.
"PyOtherSide error: Traceback (most recent call last):\n\n  File \"qrc:///py/yubikey.py\", line 23, in <module>\n    from ykman.device import scan_devices, list_all_devices, connect_to_device, get_name, read_info\n\nImportError: cannot import name 'connect_to_device' from 'ykman.device' (/nix/store/r7ns0h8gd7f2rm27m2dwxxv9qzr22kqy-python3.10-yubikey-manager-5.0.0/lib/python3.10/site-packages/ykman/device.py)\n"
Unhandled PyOtherSide error: Cannot import module: yubikey (Traceback (most recent call last):

  File "qrc:///py/yubikey.py", line 23, in <module>
    from ykman.device import scan_devices, list_all_devices, connect_to_device, get_name, read_info

ImportError: cannot import name 'connect_to_device' from 'ykman.device' (/nix/store/r7ns0h8gd7f2rm27m2dwxxv9qzr22kqy-python3.10-yubikey-manager-5.0.0/lib/python3.10/site-packages/ykman/device.py)
)
"PyOtherSide error: Traceback (most recent call last):\n\n  File \"<string>\", line 1, in <module>\n\nNameError: name 'yubikey' is not defined\n"
Unhandled PyOtherSide error: Function not found: 'yubikey.init' (Traceback (most recent call last):

  File "<string>", line 1, in <module>

NameError: name 'yubikey' is not defined
)
"PyOtherSide error: Traceback (most recent call last):\n\n  File \"<string>\", line 1, in <module>\n\nNameError: name 'yubikey' is not defined\n"
Unhandled PyOtherSide error: Function not found: 'yubikey.controller.check_descriptors' (Traceback (most recent call last):

  File "<string>", line 1, in <module>

NameError: name 'yubikey' is not defined
)
qml: TypeError: Cannot read property 'success' of undefined undefined
"PyOtherSide error: Traceback (most recent call last):\n\n  File \"<string>\", line 1, in <module>\n\nNameError: name 'yubikey' is not defined\n"
Unhandled PyOtherSide error: Function not found: 'yubikey.controller.is_win_non_admin' (Traceback (most recent call last):

  File "<string>", line 1, in <module>

NameError: name 'yubikey' is not defined
)
qml: TypeError: Cannot read property 'winNonAdmin' of undefined undefined

Expected behavior

No Python errors, and the TOTP tokens to show up in the UI.

Screenshots

This is what the UI displays, indefinitely.
image

Additional context

The behaviour is the same regardless of whether a YubiKey device is present.

yubikey-oath is installed via home-manager, using a flake-based config.

Notify maintainers

@Mic92 @rissson

Metadata

nix-shell -p nix-info --run "nix-info -m"
this path will be fetched (0.00 MiB download, 0.00 MiB unpacked):
  /nix/store/a2mfyh90szmc055ivfnv182b5a4naq90-nix-info
copying path '/nix/store/a2mfyh90szmc055ivfnv182b5a4naq90-nix-info' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.78, NixOS, 22.05 (Quokka), 22.05.20221114.16f4e04`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.8.1`
 - channels(aidan): `"nixpkgs"`
 - channels(root): `"nixos"`
 - nixpkgs: `/home/aidan/.nix-defexpr/channels/nixpkgs`
@aidalgol aidalgol added the 0.kind: bug Something is broken label Nov 22, 2022
@Mic92
Copy link
Member

Mic92 commented Nov 22, 2022

It's not clear to me, which python package they want here.

@Mic92
Copy link
Member

Mic92 commented Nov 22, 2022

It looks like upstream has deprecated this package in favor of: https://github.com/Yubico/yubioath-flutter

Mic92 added a commit to Mic92/nixpkgs that referenced this issue Nov 22, 2022
@Mic92
Copy link
Member

Mic92 commented Nov 22, 2022

See #202411

@onny onny closed this as completed Nov 24, 2022
@0xf09f95b4
Copy link
Contributor

0xf09f95b4 commented Dec 24, 2022

Hi!

The error is caused by a dependency on yubikey-manager5, while yubioath-desktop still needs yubikey-manager4, because the python libs had breaking changes (see Yubico/yubikey-manager-qt#328).

By dropping the yubikey-manager dependency to yubikey-manager4, this can be fixed.

A workaround:

nixpkgs.config.packageOverrides = pkgs: {
   yubioath-desktop = pkgs.yubioath-desktop.override { yubikey-manager = pkgs.yubikey-manager4; };
}; 

A suggested fix:

Change https://github.com/NixOS/nixpkgs/blob/nixos-22.11/pkgs/applications/misc/yubioath-desktop/default.nix:

, yubikey-personalization
-, yubikey-manager
+,yubikey-manager4
, makeWrapper

and

-  pythonPath = [ yubikey-manager ];
+  pythonPath = [ yubikey-manager4 ];

I know that this package is dropped in master (#202411) but this could be a relatively simple fix for 22.11, before changing to the new flutter-based gui.

Thanks!

rkjnsn added a commit to rkjnsn/nixpkgs that referenced this issue Jan 4, 2023
yubioath-desktop has been removed on unstable in favor of yubioath-flutter, but 22.11 currently only has the former, and it's broken due to NixOS#202295. This change fixes it by depending on the previous, compatible version of the yubikey-manager library.
@rkjnsn
Copy link
Contributor

rkjnsn commented Jan 4, 2023

Thanks for the suggested fix, @0xf09f95b4. Submitted a PR: #209098. 🤞🏻 it gets picked up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

5 participants