thingsboard-gateway icon indicating copy to clipboard operation
thingsboard-gateway copied to clipboard

[BUG] TB Gateway 3.4.2 + Docker on RPI4

Open elgutierrez opened this issue 1 year ago • 4 comments

Describe the bug I'm trying to run tb-gateway on RPI 4 using docker. I'm pulling the latest image (3.4.2), but when I run the docker run command, I get exec /bin/sh: exec format error

Error traceback (If available):

sudo docker run -it   -v ~/.tb-gateway/logs:/thingsboard_gateway/logs   -v ~/.tb-gateway/extensions:/thingsboard_gateway/extensions   -v ~/.tb-gateway/config:/thingsboard_gateway/config   --name tb-gateway --restart unless-stopped   thingsboard/tb-gateway

exec /bin/sh: exec format error

Versions (please complete the following information):

  • OS: Raspbian
  • Thingsboard IoT Gateway: 3.4.2

elgutierrez avatar Nov 09 '23 10:11 elgutierrez

Its because docker container is not made for Rpi. Pls guys, add Rpi container to official list.

Jonnik84 avatar Nov 13 '23 17:11 Jonnik84

@elgutierrez, you can try building an image file on RPi 4 for yourself.

My machine info:

  • Debian GNU/Linux 12 (bookworm)
  • Linux 6.1.0-rpi4-rpi-v8 # 1 SMP PREEMPT Debian 1:6.1.54-1+rpt2 (2023-10-05) aarch64 GNU/Linux

Step 01. Install required libs

$ sudo apt install python3-dev python3-pip libglib2.0-dev git

Step 02. Clone the source and build an image on RPi

$ git clone --recurse-submodules https://github.com/thingsboard/thingsboard-gateway.git --depth 1
$ cd thingsboard-gateway
~/thingsboard-gateway $ cp setup.py requirements.txt ./docker
~/thingsboard-gateway $ cp -r ./thingsboard_gateway ./docker
~/thingsboard-gateway $ docker build -t local-gateway docker
~/thingsboard-gateway $ docker images

REPOSITORY               TAG       IMAGE ID       CREATED          SIZE
local-gateway            latest    43899620cfb9   21 minutes ago   612MB

Step 03. Run

$ docker run -it \
-v /host/path/to/config:/thingsboard_gateway/config \
-v /host/path/to/extensions:/thingsboard_gateway/extensions \
-v /host/path/to/log:/thingsboard_gateway/logs \
--name tb-gateway \
--restart always local-gateway

Note

You will need to prepare the relevant config files to get the tb-gateway up and running properly.

simenkid avatar Nov 21 '23 07:11 simenkid

Thanks @simenkid! I had to install from the sources as the latest release still have Bacnet issues but it might be useful in the future

elgutierrez avatar Nov 23 '23 10:11 elgutierrez

this is because cryptography requires the rust compiler which can be installed by modifying the dockerfile

# Install Rust RUN apt-get update && apt-get install -y curl && \ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \ echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> $HOME/.bashrc && \ /bin/bash -c "source $HOME/.bashrc" && \ rustup update

The tb_updater.py file has import version and this module cannot be found

rajatksud avatar Apr 29 '24 11:04 rajatksud

Hi,

We have created a separated tag for RPi - tb-gateway:3.5.1-rpi, please try to use it instead of latest. Unfortunately, at the moment we cannot combine them.

imbeacon avatar Jun 20 '24 12:06 imbeacon