Installing open62541 libraries

Topics about the Software of Revolution Pi
jackybek
Posts: 9
Joined: 23 Jul 2020, 02:41
Answers: 0

Installing open62541 libraries

Post by jackybek »

Currently I use 2 DIY raspberry pi to setup a Linux environment running gnu c libraries.
1. 1 opcua server
2. 1 opcua client

Communication is via tcpip port 20004.

I intend to upgrade my equipment to kunbus and port my executables from raspberry pi to kunbus

Question:
1. Can the base kunbus OS support such porting ?
2. If I want to make use of the interface ports, does kunbus provides the necessary c libraries ?
User avatar
dirk
KUNBUS
Posts: 1926
Joined: 15 Dec 2016, 13:19
Answers: 4

Re: Installing open62541 libraries

Post by dirk »

Hi jackybek, We have everything on the public Git Hub repository. The system image is based on Raspbian so - Yes, it will work.
Have a look at the sources of the "piTest" tool - Tutorial 13 – PiTest source code.
jackybek
Posts: 9
Joined: 23 Jul 2020, 02:41
Answers: 0

Re: Installing open62541 libraries

Post by jackybek »

Thanks Dirk.
Today I started the installation of the following packages into RevPi Core3+ acting as the opcua server.

1. Open62541
2. Xml2
3. OpenSSL

I then compile my c code and when I run the server code on revPi, there is no problem.
However when I use UAExpert to connect, the server crashed (segmentation fault).

This issue did not happen on regular raspberry pi 3 (opcua client) connecting to another raspberry pi 3(opcua server).
I suspect it is due to OpenSSL conflict. Is there anything on the Rev Pi core 3 + that could interfere with my code ?
jackybek
Posts: 9
Joined: 23 Jul 2020, 02:41
Answers: 0

Re: Installing open62541 libraries

Post by jackybek »

Hi Kirk,
I did some digging and dump out the log entries during runtime. Comparing between a regular RPI and RevPi, this is the difference:

On RevPi Core 3+
[2020-12-31 08:34:44.604 (UTC+0800)] info/userland Completed creation of monitoring nodes
[2020-12-31 08:34:44.605 (UTC+0800)] info/network TCP network layer listening on opc.tcp://192.168.1.20:4840/
[2020-12-31 08:34:49.667 (UTC+0800)] info/network Connection 4 | New connection over TCP from 192.168.1.157
[2020-12-31 08:34:49.669 (UTC+0800)] info/channel Connection 4 | SecureChannel 1 | SecureChannel opened with SecurityPolicy http://opcfoundation.org/UA/SecurityPolicy#None and a revised lifetime of 300.00s
[2020-12-31 08:34:49.673 (UTC+0800)] info/channel Connection 4 | SecureChannel 1 | CloseSecureChannel
[2020-12-31 08:34:49.674 (UTC+0800)] info/network Connection 4 | Closed
[2020-12-31 08:34:49.711 (UTC+0800)] info/network Connection 4 | New connection over TCP from 192.168.1.157
[2020-12-31 08:34:49.729 (UTC+0800)] info/securitypolicy The basic256sha256 security policy channel with openssl is created.
[2020-12-31 08:34:49.794 (UTC+0800)] info/channel Connection 4 | SecureChannel 2 | SecureChannel opened with SecurityPolicy http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256 and a revised lifetime of 600.00s
[2020-12-31 08:34:49.886 (UTC+0800)] info/channel Connection 4 | SecureChannel 2 | Session 386dae0b-1463-fd01-9889-c81c167117a1 created
[2020-12-31 08:34:52.035 (UTC+0800)] info/securitypolicy The Aes128Sha256RsaOaep security policy channel with openssl is created.
Segmentation fault

On a RPi 3+

[2020-12-31 08:25:54.269 (UTC+0800)] info/userland Completed creation of monitoring nodes

[2020-12-31 08:25:54.270 (UTC+0800)] info/network TCP network layer listening on opc.tcp://192.168.1.109:4840/
[2020-12-31 08:29:48.466 (UTC+0800)] info/network Connection 4 | New connection over TCP from 192.168.1.157
[2020-12-31 08:29:48.482 (UTC+0800)] info/securitypolicy The basic256sha256 security policy channel with openssl is created.
[2020-12-31 08:29:48.539 (UTC+0800)] info/channel Connection 4 | SecureChannel 1 | SecureChannel opened with SecurityPolicy http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256 and a revised lifetime of 600.00s
[2020-12-31 08:29:48.607 (UTC+0800)] info/channel Connection 4 | SecureChannel 1 | Session 9084d62b-7514-e8cf-29b2-bbcbd2bd7b17 created
[2020-12-31 08:29:52.725 (UTC+0800)] info/securitypolicy The Aes128Sha256RsaOaep security policy channel with openssl is created.
[2020-12-31 08:29:52.766 (UTC+0800)] info/session SecureChannel 1 | Session ns=1;g=9084d62b-7514-e8cf-29b2-bbcbd2bd7b17 | ActivateSession: Session activated
[2020-12-31 08:29:52.795 (UTC+0800)] info/session SecureChannel 1 | Session ns=1;g=9084d62b-7514-e8cf-29b2-bbcbd2bd7b17 | Subscription 1 | Created the Subscription with a publishing interval of 500.00 ms
[2020-12-31 08:29:52.803 (UTC+0800)] info/session SecureChannel 1 | Session ns=1;g=9084d62b-7514-e8cf-29b2-bbcbd2bd7b17 | Subscription 1 | MonitoredItem 1 | Created the MonitoredItem
[2020-12-31 08:29:52.803 (UTC+0800)] info/session SecureChannel 1 | Session ns=1;g=9084d62b-7514-e8cf-29b2-bbcbd2bd7b17 | Subscription 1 | MonitoredItem 2 | Created the MonitoredItem
[2020-12-31 08:37:18.787 (UTC+0800)] info/channel Connection 4 | SecureChannel 1 | SecureChannel renewed with a revised lifetime of 600.00s
========================================
As you can observer RevPi 3 is not able to create a secure session, whereas the RPi was able to. As a result, RevPi crashed.
Is there some settings in RevPI 3 that is interfering with the creation of secure session between a client and RevPi 3+?
User avatar
dirk
KUNBUS
Posts: 1926
Joined: 15 Dec 2016, 13:19
Answers: 4

Re: Installing open62541 libraries

Post by dirk »

Hi jackybek, can you post your outputs of this commands:

Code: Select all

pi@RevPi39627:~ $ uname -a
Linux RevPi39627 4.19.95-rt38-v7+ #1 SMP PREEMPT RT Tue, 16 Jun 2020 13:25:43 +0200 armv7l GNU/Linux
pi@RevPi39627:~ $ cat /etc/revpi/image-release
2020-06-25-revpi-stretch.img
How did you install the software i.e. what steps or commands did you run?
jackybek
Posts: 9
Joined: 23 Jul 2020, 02:41
Answers: 0

Re: Installing open62541 libraries

Post by jackybek »

This is what i got:

pi@RevPi39718:~ $ uname -a
Linux RevPi39718 4.19.95-rt38-v7+ #1 SMP PREEMPT RT Tue, 16 Jun 2020 13:25:43 +0 200 armv7l GNU/Linux
pi@RevPi39718:~ $ cat /etc/revpi/image-release
2020-03-02-revpi-stretch.img
pi@RevPi39718:~ $

This is how i install the various libraries:
1. open62541
sudo apt-get install git cmake cmake-curses-gui build-essential gcc python3-pip qttools5-dev python3-pyqt5 libmbedtls-dev check libsubunit-dev python-sphinx graphviz python-sphinx-rtd-theme

2. openssl (https://cloudwafer.com/blog/installing- ... -04-18-04/)
sudo apt install build-essential checkinstall zlib1g-dev -y
sudo wget https://www.openssl.org/source/openssl-1.1.1h.tar.gz
sudo tar -xf openssl-1.1.1c.tar.gz
sudo make; sudo make test; sudo make install

3. xml2
wget ftp://xmlsoft.org/libxml2/libxml2-sources-2.7.2.tar.gz
tar -xvzf libxml2-sources-2.7.2.tar.gz
./configure --prefix/usr/
make; sudo make install
jackybek
Posts: 9
Joined: 23 Jul 2020, 02:41
Answers: 0

Re: Installing open62541 libraries

Post by jackybek »

Step 2: should be
openssl (https://cloudwafer.com/blog/installing- ... -04-18-04/)
sudo apt install build-essential checkinstall zlib1g-dev -y
sudo wget https://www.openssl.org/source/openssl-1.1.1h.tar.gz
sudo tar -xf openssl-1.1.1h.tar.gz
sudo make; sudo make test; sudo make install
User avatar
dirk
KUNBUS
Posts: 1926
Joined: 15 Dec 2016, 13:19
Answers: 4

Re: Installing open62541 libraries

Post by dirk »

Hi jackybek, this seems a bit tricky. Your assumption that there is some kind of OpenSSL conflict is right. So maybe with the next "Buster" release it might work. But anyhow it is far from our usual support here.
jackybek
Posts: 9
Joined: 23 Jul 2020, 02:41
Answers: 0

Re: Installing open62541 libraries

Post by jackybek »

I realize that the version you used is june2020, whereas mine is mar2020.
How can I upgrade mine to june2020 to attempt another test ?
User avatar
dirk
KUNBUS
Posts: 1926
Joined: 15 Dec 2016, 13:19
Answers: 4

Re: Installing open62541 libraries

Post by dirk »

Hi have a look here How to Update Your System
Post Reply