Store PLCnext CommunityPLCnext on LinkedInPLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community

  1. goodman7499
  2. Container @ PLCnext (Docker, Moby, balena)
  3. Monday, 26 April 2021
Hello PLCnext community,

I'm working on a project to connect my AXC F 2152 to both the Google cloud and Telegram. To establish the connection to Telegram I've used the PLCnext Bot app available on the PLCnext Store, while for the cloud connection I've tried to install NodeRed using the Balena container.

The problem I have right now is that after installing the Balena container and NodeRed, while PLCnext Bot was already installed, the PLC next does not boot up after a restart. When starting the controller it stays some time with the Boot led blinking and the D led solid orange, but after some time, the Boot led turns off and only the D led remains on. I attach the image with the log given after the error.
The strange part is that the part that seems to have a problem is the PLCnext Bot and not the NodeRed, even when I configured the Balena engine to not restart NodeRed automatically. This already happened the last two times I tried to install NodeRed, although after several tries the PLCnext is sometimes able to boot up.

The hardware version of the AXC F 2152 is 2 while the firmware is the 2021.0.2 version. For the PLCnext Bot the version is 2.0 and for both Balena and NodeRed the versions are the latest after following the installation tips provided in GitHub.

Thank you in advance,
Kind regards

Guzmán
Attachments (1)
Accepted Answer
Frank PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo
Hi Guzman,

this issue is caused due to a timeout problem caused from the PLCnext Bot app.
The firmware and the app are starting with the same priority and depinding on some other timings this could lead to a timeout in the startup of the firmware. --> This is what you can see here.

I've already informed the contributor of the app to implement a startup delay.

As a quick alternative you could also include a sleep in the init.d script of the firmware.

Hint:

  • For the change were root priviliges required - create a root user
  • Any changes on the init scripts could break the PLC!


Modify the init script /etc/init.d/plcnext as follows:


# Now start the application
sleep 10
su - plcnext_firmware -c "$ARP_EXPORTS \
cd /opt/plcnext/; \
umask 002; \
Arp.System.Application $ARP_OPTIONS > /dev/null 2>&1 &"
echo "plcnext started ${ARP_OPTIONS_MESSAGE#", "}" >&2
sleep 10
Phoenix Contact Electronics Headquarter - PLCnext Runtime Product Management and Support
goodman7499 Accepted Answer Pending Moderation
0
Votes
Undo
Hello Frank!

The issue you are pointing makes sense with the behaviour since it was sometimes able to boot up but it was completely random. I will try the changes you propose and contact back if anything goes wrong.

Just one thing, could you be a little more specific on where that piece of code should go? I've found the plcnext file in the init.d folder but I don't know where to copy the instructions. You can see a photo of the current state of the file.

Thanks you very much!
Best regards

Guzmán
Attachments (1)
Frank PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo
Hi Guzman,

sure, please find below the compelte start procedure with the sleeps highlighted.


start() {
if [ -f $PIDFILE ] && kill -0 $(cat $PIDFILE); then
echo 'plcnext already running' >&2
return 1
fi
echo 'Starting service plcnext' >&2

if [ ! -d /etc/device_data/license_store ]; then
mkdir /etc/device_data/license_store
#allow arp to write to the folder
chmod 750 /etc/device_data/license_store
chown plcnext_firmware /etc/device_data/license_store
fi

if [ ! -d /etc/device_data/firmware ]; then
mkdir /etc/device_data/firmware
#allow arp to write to the folder
chmod 750 /etc/device_data/firmware
chown plcnext_firmware /etc/device_data/firmware
fi

# Workaround to enable firmware with reduced right to create pidfile
touch $PIDFILE
chown plcnext_firmware:plcnext $PIDFILE

# Set needed exports
if [ -f /etc/init.d/plcnext-exports ] ; then
source /etc/init.d/plcnext-exports
ARP_EXPORTS="$ARP_EXPORTS;"
fi

# Add more options
ARP_OPTIONS="$ARP_OPTIONS --settings=/etc/plcnext/Device.acf.settings"
ARP_OPTIONS="$ARP_OPTIONS --config=/etc/plcnext/device/Default.acf.config"

# Now start the application
sleep 10
su - plcnext_firmware -c "$ARP_EXPORTS \
cd /opt/plcnext/; \
umask 002; \
Arp.System.Application $ARP_OPTIONS > /dev/null 2>&1 &"
echo "plcnext started ${ARP_OPTIONS_MESSAGE#", "}" >&2
sleep 10
}


Good luck :-)

Frank
Phoenix Contact Electronics Headquarter - PLCnext Runtime Product Management and Support
goodman7499 Accepted Answer Pending Moderation
0
Votes
Undo
Hello again Frank,

I've made the modification you pointed and the PLC seems to work perfectly. My only question is, would this fix the problem completely? Or could it happen that the sleep 10 is not long enough for the timeout not to happen again? So in the case I get the same error as before I could extend the delay time.

Thank you very much for your help!
Kind regards

Guzmán
Frank PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo
Hi Guzman,

the workaround delays the startup of the PLCnext process and the process itself is beeing monitored from a watchdog.
So, it would be thinkable, that an app which takes realy a looong time for the startup could still trigger the watchdog.

A better solution would be to delay the app init scripts and this is exactly what the contributor of the PLCnext Bot App will do next.
Also, will we modify the app creation guide accordingly.

Coming back to your questions.
This workaround is not a 100% guarantee, but worked well in all from us known cases.

Hope that helps,
Frank
Phoenix Contact Electronics Headquarter - PLCnext Runtime Product Management and Support
goodman7499 Accepted Answer Pending Moderation
0
Votes
Undo
Hello Frank,

The solution you proposed worked, but I had to increase the sleep time to 20 instead of 10, at first it wasn't working. I will keep an eye on the updates of the PLCnext Bot app.
Thank you very much for your help.

Regards,
Guzmán
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.