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

Remote agent fail to start on raspberry pi #4958

Open
1 task done
kaizoku-oh opened this issue Aug 7, 2024 · 1 comment
Open
1 task done

Remote agent fail to start on raspberry pi #4958

kaizoku-oh opened this issue Aug 7, 2024 · 1 comment

Comments

@kaizoku-oh
Copy link

What kind of issue is this?

  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

Configuration

Operating system: Raspbian Lite (32bit)

PlatformIO Version (platformio --version): PlatformIO Core, version 6.1.15

Description of problem

I have a fresh install of raspbian lite on a raspberry pi 3, after installing python, platformio and pio remote agent I cannot start the remote agent and I get an error that seems to be related to openssl.

Steps to Reproduce

  1. Install raspbian-lite/raspbian on raspberry pi (3 in my case)
# Update stuff...
sudo apt update && sudo apt upgrade -y

# Make sure needed python packages are installed
sudo apt install python3 python3-pip python3-venv

# Get version
python --version

Python 3.11.2

# Make sure pip is installed and up to date
python -m pip install --upgrade pip
# Get version
python -m pip --version

pip 23.0.1
  1. Install PlatformIO
# Install PlatformIO
curl -fsSL -o get-platformio.py https://raw.githubusercontent.com/platformio/platformio-core-installer/master/get-platformio.py
python3 get-platformio.py

# Get version
$HOME/.platformio/penv/bin/platformio --version

PlatformIO Core, version 6.1.15

# Add PlatformIO to PATH...

# Install udev rules
curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/system/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rules
# Reload service to apply changes
sudo service udev restart
  1. Setup remote agent
# Install OS dependencies for remote agent
sudo apt install libffi-dev libssl-dev

# Install required libraries for the remote agent
pio remote agent
# ==> SUCCESS
  1. Login to PlatformIO account and get the token
pio account login

Username or email:
Password: 
Successfully logged in!

pio account token

Password: 
Personal Authentication Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  1. Start remote agent
# Start remote agent
pio remote agent start
# ==> ERROR

Actual Results

ImportError: Traceback (most recent call last):
  File "/home/bayrem/.platformio/penv/lib/python3.11/site-packages/platformio/__main__.py", line 103, in main
    cli()  # pylint: disable=no-value-for-parameter
    ^^^^^
  File "/home/bayrem/.platformio/penv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bayrem/.platformio/penv/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/bayrem/.platformio/penv/lib/python3.11/site-packages/platformio/cli.py", line 85, in invoke
    return super().invoke(ctx)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/bayrem/.platformio/penv/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bayrem/.platformio/penv/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bayrem/.platformio/penv/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bayrem/.platformio/penv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bayrem/.platformio/penv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bayrem/.platformio/penv/lib/python3.11/site-packages/platformio/remote/cli.py", line 68, in remote_agent_start
    from platformio.remote.client.agent_service import RemoteAgentService
  File "/home/bayrem/.platformio/penv/lib/python3.11/site-packages/platformio/remote/client/agent_service.py", line 27, in <module>
    from platformio.remote.client.base import RemoteClientBase
  File "/home/bayrem/.platformio/penv/lib/python3.11/site-packages/platformio/remote/client/base.py", line 30, in <module>
    from platformio.remote.factory.ssl import SSLContextFactory
  File "/home/bayrem/.platformio/penv/lib/python3.11/site-packages/platformio/remote/factory/ssl.py", line 16, in <module>
    from OpenSSL import SSL  # pylint: disable=import-error
    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bayrem/.platformio/packages/contrib-pioremote/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/home/bayrem/.platformio/packages/contrib-pioremote/OpenSSL/crypto.py", line 17, in <module>
    from OpenSSL._util import (
  File "/home/bayrem/.platformio/packages/contrib-pioremote/OpenSSL/_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/home/bayrem/.platformio/packages/contrib-pioremote/cryptography/hazmat/bindings/openssl/binding.py", line 14, in <module>
    from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: /home/bayrem/.platformio/packages/contrib-pioremote/cryptography/hazmat/bindings/_openssl.abi3.so: undefined symbol: FIPS_mode

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `python -m pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  https://docs.platformio.org/page/faq/index.html

* Report this problem to the developers
  https://github.com/platformio/platformio-core/issues

============================================================

Expected Results

2024-08-07 08:12:23 [info] Name: raspberry
2024-08-07 08:12:23 [info] Connecting to PlatformIO Remote Development Cloud
2024-08-07 08:12:23 [info] Successfully connected
2024-08-07 08:12:23 [info] Authenticating
2024-08-07 08:12:24 [info] Successfully authorized

Additional info

There are other people who faced a similar issue:

@albertskog
Copy link

albertskog commented Sep 4, 2024

I was able to make it work by upgrading the cryptography package used by pioremote to a higher version:

pip install --no-compile --upgrade -t ~/.platformio/packages/contrib-pioremote cryptography==36.0.2

It is pinned to cryptography >= 3.3, < 35.0.0 in ~/.platformio/packages/contrib-pioremote/package-postinstall.py, probably because of reasons described in #3865. The TLDR seems to be Rust is required to build the package since 35.0.0, so it was pinned so we would not need to install all of rustc on our Raspberry Pi just to build it. It seems cryptography is available as a wheel in Piwheels these days, so it should be possible to stop pinning it to a pre-Rust version?

This is my first time looking into the inner workings of Platformio, I can't find the source for contrib-pioremote, is it not here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants