canonical / surl

Ubuntu Store API thin wrapper
GNU General Public License v3.0
9 stars 11 forks source link

Import error when trying to use surl on Raspberry Pi armhf #26

Closed kileyhykawy closed 2 years ago

kileyhykawy commented 3 years ago

After installing surl (version 0.7.3, revision 399) on Ubuntu Server 20.04 and trying to run it, I get a Python import error:

Traceback (most recent call last):
  File "/snap/surl/399/bin/surl_cli.py", line 24, in <module>
    from surl import main
  File "/snap/surl/399/lib/python3.5/site-packages/surl/__init__.py", line 11, in <module>
    import macaroonbakery._utils as utils
  File "/snap/surl/399/lib/python3.5/site-packages/macaroonbakery/_utils/__init__.py", line 11, in <module>
    from pymacaroons import Macaroon
  File "/snap/surl/399/lib/python3.5/site-packages/pymacaroons/__init__.py", line 2, in <module>
    from .macaroon import Macaroon
  File "/snap/surl/399/lib/python3.5/site-packages/pymacaroons/macaroon.py", line 13, in <module>
    from pymacaroons.caveat_delegates import (
  File "/snap/surl/399/lib/python3.5/site-packages/pymacaroons/caveat_delegates/__init__.py", line 4, in <module>
    from .encrypted_first_party import (
  File "/snap/surl/399/lib/python3.5/site-packages/pymacaroons/caveat_delegates/encrypted_first_party.py", line 5, in <module>
    from pymacaroons.field_encryptors import SecretBoxEncryptor
  File "/snap/surl/399/lib/python3.5/site-packages/pymacaroons/field_encryptors/__init__.py", line 2, in <module>
    from .secret_box_encryptor import SecretBoxEncryptor
  File "/snap/surl/399/lib/python3.5/site-packages/pymacaroons/field_encryptors/secret_box_encryptor.py", line 3, in <module>
    from nacl.secret import SecretBox
  File "/snap/surl/399/lib/python3.5/site-packages/nacl/secret.py", line 17, in <module>
    import nacl.bindings
  File "/snap/surl/399/lib/python3.5/site-packages/nacl/bindings/__init__.py", line 17, in <module>
    from nacl.bindings.crypto_aead import (
  File "/snap/surl/399/lib/python3.5/site-packages/nacl/bindings/crypto_aead.py", line 18, in <module>
    from nacl._sodium import ffi, lib
ImportError: /snap/surl/399/lib/python3.5/site-packages/nacl/_sodium.abi3.so: undefined symbol: crypto_pwhash_argon2id_opslimit_moderate

Is the snap broken on armhf or am I missing something?

kileyhykawy commented 3 years ago

Should mention that this happened with surl help

knitzsche commented 2 years ago

fyi Kiley, I separately noticed this this morning, and filed this bug (against store server ; ). Up to those folks which issue/bug to track this with. https://bugs.launchpad.net/snapstore-server/+bug/1948462

Roadmaster commented 2 years ago
$ ldd /snap/surl/398/lib/python3.5/site-packages/nacl/_sodium.abi3.so
    linux-vdso.so.1 (0x0000ffffa13b8000)
    libsodium.so.18 => not found
    libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000ffffa1331000)
    libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffffa11d8000)
    /lib/ld-linux-aarch64.so.1 (0x0000ffffa138c000)

For some reason libsodium was not included in the snap for these architectures.

knitzsche commented 2 years ago

Maybe add python3-nacl as a stage-package: https://packages.ubuntu.com/focal/armhf/python3-nacl/filelist

Roadmaster commented 2 years ago

I don't think that's needed, pynacl is an indirect dependency through pymacaroons (PyNaCl>=1.1.2,<2.0) and is already installed, with the Python file raising the problem being part of it: /snap/surl/399/lib/python3.5/site-packages/nacl/bindings/crypto_aead.py

I'll check why libsodium is not installed on arm architectures, it could be unavailable or something similar.

knitzsche commented 2 years ago

libsodium is installed with the snap on armhf: ubuntu@ubuntu:/snap/surl/current$ find -name sodium ./lib/python3.5/site-packages/nacl/_sodium.abi3.so ./lib/python3.5/site-packages/nacl/bindings/sodium_core.py ./usr/include/sodium ./usr/include/sodium.h ./usr/lib/arm-linux-gnueabihf/libsodium.a ./usr/lib/arm-linux-gnueabihf/libsodium.so ./usr/lib/arm-linux-gnueabihf/libsodium.so.18 ./usr/lib/arm-linux-gnueabihf/libsodium.so.18.0.1 ./usr/lib/arm-linux-gnueabihf/pkgconfig/libsodium.pc ./usr/share/doc/libsodium-dev ./usr/share/doc/libsodium18

Roadmaster commented 2 years ago

Hello - Can I trouble you both @knitzsche @kileyhykawy to try the version of surl that's available on edge?

snap refresh --channel=edge surl

That version is based on core20 and worked fine in my tests on an arm64-based system (on which I was able to reproduce your problem with the old core-based version of surl).

If this works well I'll probably promote the edge revision to stable.

knitzsche commented 2 years ago

Hi - I just succeeded with rev 413 on uc20/pi3b+ and on server on pi4. Thanks

Roadmaster commented 2 years ago

I've published surl 0.8.0 to the stable channel, @kileyhykawy this should take care of your issue as well.