Firmware Update

This guide will help you update your gateway's firmware using the 4PointX Dashboard, so you can follow it step-by-step. This method will work if no major changes (configuration changes or files and directory structure updates) are present in the new firmware.

Requirements

  • A gateway device that is online and running

  • User access to the 4PointX Dashboard

Step-by-Step Instructions

1. Log in to the 4PointX Dashboard

  • Open your web browser and go to the 4PointX Dashboard

  • Enter your username and password

3. Find Your Gateway

  • Select your gateway’s Site, Plant, and Function using the drop-down filters to narrow down the list

  • Look for the gateway you want to update

4. Check Gateway Status

  • Make sure the gateway you want to update shows a green heartbeat indicator. This tells you the gateway is online

5. Start the Firmware Update

  • Click the “Firmware Update” button next to the gateway. This will start the update process for that specific device

6. Wait for the Update to Complete

  • The firmware update may take up to 10 minutes

  • During this time, the gateway will download and install the latest firmware automatically

7. Verify Completion

  • After about 10 minutes, check that your gateway is back online and the heartbeat indicator remains green

  • If there are any errors, check the Gateway to see if it is operational

  • Check if the configuration file (settings.json) is not empty

  • Check if cron is set by running: crontab -l

Tips

  • Always double-check that you have selected the correct site and gateway before starting the update

  • Do not disconnect the gateway from power or network during the update

  • If the firmware update option is not visible or greyed out, check if any other action is in “in progress “ status If not, contact your system administrator or technical support

Note: This dashboard method is suitable for routine firmware updates. For major updates involving configuration changes or structural modifications, use the manual update method instead.

This guide explains step-by-step how to update the firmware on your Gateway device manually, so follow each step carefully.

Requirements

  • A laptop

  • Latest firmware ZIP file: To obtain the latest firmware, contact the module lead for your device’s firmware. They will provide you with a file named similar to 4px-gateway-firmware.tar.gz.

Steps

1. Connect to the Gateway via SSH

  • Open Terminal on your laptop.

  • Enter the command below (replace <gateway_ip> with your device’s IP address):

ssh 4px@<gateway_ip>

  • When prompted, enter the password for the 4px user.

  • After successfully connecting, type exit and press Enter to log out.

2. Copy the Firmware ZIP File to the Gateway

  • Back on your laptop, use this command (update the file path and IP address):

scp /path/to/4px-gateway-firmware.tar.gz 4px@<gateway_ip>:/home/4px/

  • This copies the firmware file to the 4px user’s home directory on the Gateway.

3. Update the Gateway Firmware and Libraries

Reconnect to the Gateway:

ssh 4px@<gateway_ip>

Remove scheduled tasks (crontab):

crontab -r

Set up the network firewall:

sudo iptables -F sudo iptables -P OUTPUT ACCEPT sudo iptables -P INPUT ACCEPT sudo iptables -P FORWARD ACCEPT

Update DNS settings:

sudo nano /etc/resolv.conf

Add these two lines at the top:

nameserver 8.8.8.8 nameserver 1.1.1.1

Save and exit.

Check if the ZIP file is present:

ls /home/4px/

Ensure you see 4px-gateway-firmware.tar.gz listed.

Install required Python and system libraries:

sudo apt update && sudo apt install python3.8 python3.8-dev python3-pip -y
pip3 install --upgrade pip setuptools wheel
pip3 install pymodbus==2.5.3 getmac==0.9.3 deepdiff==6.3.0 requests==2.30.0 kafka-python==2.0.2 opcua==0.98.13 cryptography==41.0.5 dateparser==1.1.8 pandas==1.5.2 numpy==1.20.3 python-dateutil==2.8.2 pycomm3==1.2.14 pyarmor==9.1.1

Install and verify hardware sensors:

sudo apt-get install lm-sensors sudo sensors-detect sensors

Clean up unnecessary packages:

sudo apt remove python3-pip -y sudo apt install vim -y sudo apt autoremove sudo apt clean sudo rm -rf /var/lib/apt/lists/*

Install required network tools:

sudo apt install net-tools util-linux netfilter-persistent iptables-persistent

Restrict sudo permissions for the 4px user:

sudo visudo

Add this line at the end:

4px ALL=NOPASSWD: /sbin/reboot, /sbin/ifconfig, /usr/bin/truncate, /usr/bin/find, /usr/bin/timedatectl, /usr/bin/date, /usr/sbin/hwclock, /sbin/iptables, /usr/sbin/netfilter-persistent

Save and exit.

Switch to the 4px user:

su 4px

Create necessary directories:

mkdir -p /home/4px/4px.data /home/4px/4px.files /home/4px/4px.firmware /home/4px/4px.firmware/config

4. Install the Firmware

Navigate to the firmware directory:

cd /home/4px/4px.firmware

Create the update script:

nano firmware-update.sh

Paste the following into the file and save:

cd /home/4px
tar -xf 4px-gateway-firmware.tar.gz --directory /home/4px/4px.firmware

# running firmware encryption
cd /home/4px/4px.firmware/4px-gateway-firmware
python3 firmware-encrypt.py
rm -rf firmware-encrypt.py

cp /home/4px/4px.firmware/4px-gateway-firmware/config/handshake.py /home/4px/4px.firmware/config/
cp -r --no-clobber /home/4px/4px.firmware/4px-gateway-firmware/config/* /home/4px/4px.firmware/config/
rm -rf /home/4px/4px.firmware/4px-gateway-firmware/config

# Copy everything except 'config' into 4px.firmware
rsync -av --progress /home/4px/4px.firmware/4px-gateway-firmware/ /home/4px/4px.firmware/

# Remove extracted directory
rm -rf /home/4px/4px.firmware/4px-gateway-firmware

# Reload the crontab
crontab /home/4px/4px.firmware/crontab

sleep 10
pkill python3
sudo /sbin/reboot

Run the firmware update script:

sh firmware-update.sh

  • The Gateway will reboot automatically. Wait for it to restart.

Enable scheduled tasks (crontab):

cd /home/4px/4px.firmware crontab crontab

5. Verify the Updates

  • Log in again as the 4px user and check the contents of the firmware directory:

ls /home/4px/4px.firmware

  • You should see several files and subfolders related to your updated firmware.

Tips

  • If you are unsure where to get the firmware ZIP, ask your module lead.

  • If a command gives an error, check your typing carefully and ensure you have the correct permissions.