Siemens Simatic IOT2040

Hello,
after being able to deploy some services on a Raspberry Pi, a balenaFin and a RevPi Core 3, now I’m trying to do the same on a Siemens Simatic IOT2040 but… it doesn’t work. The service keeps restarting, and I can’t get even a simple output.

Is anyone being able to successfully run something on this platform?

Cheers,
Matteo

Hi there
Could you share some additional information here? What’s your OS version and the errors encountered? Also, could you share a minimum Dockerfile/compose file we could use for reproducing that behavior? Thanks!

Hi Michael,
I’m running Resin OS 2.12.7+rev2 and all I can see is that the service is restarting over and over.

Dockerfile.template

# base-image for node on any machine using a template variable,
# see more about dockerfile templates here: https://www.balena.io/docs/learn/develop/dockerfile/#dockerfile-templates
# and about balena base images here: https://www.balena.io/docs/reference/base-images/base-images/
# FROM balenalib/%%BALENA_MACHINE_NAME%%-node:6-stretch-run



# AUTOGENERATED FILE
FROM balenalib/iot2000-debian:buster-run

# remove several traces of debian python
RUN apt-get purge -y python.*

# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8

# install python dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
		ca-certificates \
		netbase \
	&& rm -rf /var/lib/apt/lists/*

# key 63C7CC90: public key "Simon McVittie <smcv@pseudorandom.co.uk>" imported
# key 3372DCFA: public key "Donald Stufft (dstufft) <donald@stufft.io>" imported
RUN gpg --batch --keyserver keyring.debian.org --recv-keys 4DE8FF2A63C7CC90 \
	&& gpg --batch --keyserver keyserver.ubuntu.com --recv-key 6E3CBCE93372DCFA \
	&& gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 0x52a43a1e4b77b059

ENV PYTHON_VERSION 3.7.4

# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 19.2.1

ENV SETUPTOOLS_VERSION 41.0.1

RUN set -x \
	&& buildDeps=' \
		curl \
	' \
	&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
	&& curl -SLO "http://resin-packages.s3.amazonaws.com/python/v$PYTHON_VERSION/Python-$PYTHON_VERSION.linux-i386-openssl1.1.tar.gz" \
	&& echo "7259ee9bce64d1ab714d93cc183fa89283c894036cfc7c76d21f23727e3f8f26  Python-$PYTHON_VERSION.linux-i386-openssl1.1.tar.gz" | sha256sum -c - \
	&& tar -xzf "Python-$PYTHON_VERSION.linux-i386-openssl1.1.tar.gz" --strip-components=1 \
	&& rm -rf "Python-$PYTHON_VERSION.linux-i386-openssl1.1.tar.gz" \
	&& ldconfig \
	&& if [ ! -e /usr/local/bin/pip3 ]; then : \
		&& curl -SLO "https://raw.githubusercontent.com/pypa/get-pip/430ba37776ae2ad89f794c7a43b90dc23bac334c/get-pip.py" \
		&& echo "19dae841a150c86e2a09d475b5eb0602861f2a5b7761ec268049a662dbd2bd0c  get-pip.py" | sha256sum -c - \
		&& python3 get-pip.py \
		&& rm get-pip.py \
	; fi \
	&& pip3 install --no-cache-dir --upgrade --force-reinstall pip=="$PYTHON_PIP_VERSION" setuptools=="$SETUPTOOLS_VERSION" \
	&& find /usr/local \
		\( -type d -a -name test -o -name tests \) \
		-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
		-exec rm -rf '{}' + \
	&& cd / \
	&& apt-get purge -y --auto-remove $buildDeps \
	&& rm -rf /usr/src/python ~/.cache

# make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \
	&& ln -sf pip3 pip \
	&& { [ -e easy_install ] || ln -s easy_install-* easy_install; } \
	&& ln -sf idle3 idle \
	&& ln -sf pydoc3 pydoc \
	&& ln -sf python3 python \
	&& ln -sf python3-config python-config

# set PYTHONPATH to point to dist-packages
ENV PYTHONPATH /usr/lib/python3/dist-packages:$PYTHONPATH



# use `install_packages` if you need to install dependencies,
# for instance if you need git, just uncomment the line below.
# RUN install_packages git

# Defines our working directory in container
WORKDIR /usr/src/app

# Copies the package.json first for better cache on later pushes
# COPY package.json package.json

# This install npm dependencies on the balena build server,
# making sure to clean up the artifacts it creates in order to reduce the image size.
# RUN JOBS=MAX npm install --production --unsafe-perm && rm -rf /tmp/*

# This will copy all files in our root to the working  directory in the container
COPY . ./

# Enable udevd so that plugged dynamic hardware devices show up in our container.
ENV UDEV=1

# server.js will run when container starts up on the device
CMD ["python3", "app.py"]

app.py

import time

while 1 == 1:
  print("hello world!")
  time.sleep(600)

Thanks,
Matteo

Hello @mcomisso , can you please allow support access for this device and provide us its uuid or dashboard link?

Hello Alexis,
UUID 328601c294669458351f678aa8afef89 and access granted!

Thanks,
Matteo

Thanks, I’m doing some tests on the device.

Ok, it turns out Debian does not run on Intel quark processors, see https://www.debian.org/releases/jessie/i386/ch02s01.html.en .
And this is the processor iot2000 devices use.
Sorry this took some time :slight_smile:
I’ve pinged our team to remove the Debian base images for iot2000.
You can use Alpine base images instead (I’ve tested one, it works) but you’ll need to adapt your Dockerfile (replace apt-get with apk, etc…).

Hi Alexis,
thank you very much for your support!

I’ll try with Alpine but I’m quite sure that this time it will work as expected.

I suggest your team to also update the “Getting started” page for this device (https://www.balena.io/docs/learn/getting-started/iot2000/nodejs/#adding-your-first-device) since it points to the “simple-server-node” project that uses the Debian stretch image. This is mainly why I ended on using that distro…

Thanks again!

Matteo