← Back to all versions
Prepare for upgrading ThingsBoard
Stop ThingsBoard
Check if ThingsBoard and database services are running. Initially ThingsBoard, check status to ensure it is stopped and then databases.
sudo systemctl stop thingsboard
sudo systemctl status thingsboard
Backup Database
Make a backup of the database before upgrading.
PostgreSQL
Check PostgreSQL status. It is unnecessary to stop PostgreSQL for the backup.
sudo systemctl status postgresql
Make sure you have enough space to place a backup of the database
Check database size:
sudo -u postgres psql -c " SELECT pg_size_pretty( pg_database_size('thingsboard') ); "
Check free space:
If there is enough free space — make a backup:
sudo -Hiu postgres pg_dump thingsboard > thingsboard.sql.bak
Check backup file being created.
Cassandra
Check Cassandra status. It is necessary to stop Cassandra for the backup.
sudo systemctl status cassandra
Flush all memtables from the node to SSTables on disk:
Stop Cassandra:
sudo systemctl stop cassandra
Check the status again to ensure it is stopped:
sudo systemctl status cassandra
Make sure you have enough space to place a backup of the database
Check database size:
du -h /var/lib/cassandra/ | tail -1
Check free space:
Make a backup of Cassandra database:
sudo tar -cvf backup/cassandra.tar /var/lib/cassandra
Check archive being created.
Start Database
Cassandra:
sudo systemctl start cassandra
PostgreSQL: Do nothing, PostgreSQL is already running.
Upgrading ThingsBoard PE to 4.2.2.9 (latest 4.2.2 patch)
Important note before upgrading to ThingsBoard 4.2.2
Starting with version 4.2.2, the platform uses Angular 20 (upgraded from Angular 18). The core platform remains fully backward compatible and no upgrade scripts are required. However, custom UI code (widgets or custom CSS) that relies on internal component structure or CSS variable names may break. This can affect up to ~1% of users with heavy customizations. We recommend testing custom UI in a staging environment before upgrading.
ThingsBoard PE package download
wget https://dist.thingsboard.io/thingsboard-4.2.2.9pe.rpm
ThingsBoard PE service upgrade
Stop ThingsBoard service if it is running.
sudo service thingsboard stop
sudo rpm -Uvh thingsboard-4.2.2.9pe.rpm
Configuration files
rpm does not prompt about configuration files. If you changed a configuration file and the new package ships a different version of it, rpm keeps your file in place and writes the new default alongside it as .rpmnew. If no .rpmnew file appears, there is nothing to merge.
The recommended approach is to use the new file as the base: copy your custom values into the .rpmnew file, then replace your current configuration file with it.
Do this before running the upgrade script — the script reads the configuration file for your database connection settings and fails without them. If this version needs no upgrade script, do it before starting the service.
Caution
If you are upgrading from 4.2.0, you must run the script below. However, if you are upgrading from version 4.2.1.x or 4.2.2.x, DO NOT run the upgrade script; proceed directly to starting the service.
Upgrading from 4.2.1.x or 4.2.2.x
You don't need to install the patches in between. When 4.2.2.9 starts, it applies the database changes
of every patch since your version in the background.
When the update is done, the log shows System data patch update completed successfully. In a cluster,
only one core node writes this line, so check the logs of all core nodes.
If the log shows Failed to apply system data patch updates, ThingsBoard keeps running, but the update
isn't complete. The error logged with this line shows the cause. The update runs as the database user from your
ThingsBoard configuration, so that user needs rights to create and change tables, indexes, views, and functions.
Fix the cause and restart ThingsBoard: it retries the update on every start.
Ran the upgrade script anyway? It stops before it changes the database, with
Upgrade failed: database version '…' is not supported for upgrade. If you run 4.2.1.x or 4.2.2.x,
this only means the script isn't needed.
sudo /usr/share/thingsboard/bin/install/upgrade.sh
Start the service
sudo service thingsboard start
Upgrading ThingsBoard PE to 4.2.1.2 (latest 4.2.1 patch)
ThingsBoard PE package download
wget https://dist.thingsboard.io/thingsboard-4.2.1.2pe.rpm
ThingsBoard PE service upgrade
Stop ThingsBoard service if it is running.
sudo service thingsboard stop
sudo rpm -Uvh thingsboard-4.2.1.2pe.rpm
Configuration files
rpm does not prompt about configuration files. If you changed a configuration file and the new package ships a different version of it, rpm keeps your file in place and writes the new default alongside it as .rpmnew. If no .rpmnew file appears, there is nothing to merge.
The recommended approach is to use the new file as the base: copy your custom values into the .rpmnew file, then replace your current configuration file with it.
Do this before running the upgrade script — the script reads the configuration file for your database connection settings and fails without them. If this version needs no upgrade script, do it before starting the service.
Caution
If you are upgrading from 4.2.0, you must run the script below. However, if you are upgrading from version 4.2.1.x, DO NOT run the upgrade script; proceed directly to starting the service.
Upgrading from 4.2.1.x
You don't need to install the patches in between. When 4.2.1.2 starts, it applies the database changes
of every patch since your version in the background.
When the update is done, the log shows System data patch update completed successfully. In a cluster,
only one core node writes this line, so check the logs of all core nodes.
If the log shows Failed to apply system data patch updates, ThingsBoard keeps running, but the update
isn't complete. The error logged with this line shows the cause. The update runs as the database user from your
ThingsBoard configuration, so that user needs rights to create and change tables, indexes, views, and functions.
Fix the cause and restart ThingsBoard: it retries the update on every start.
Ran the upgrade script anyway? It stops before it changes the database, with
Upgrade failed: database version '…' is not supported for upgrade. If you run 4.2.1.x,
this only means the script isn't needed.
sudo /usr/share/thingsboard/bin/install/upgrade.sh
Start the service
sudo service thingsboard start
Upgrading ThingsBoard PE to 4.2
ThingsBoard PE package download
wget https://dist.thingsboard.io/thingsboard-4.2pe.rpm
ThingsBoard PE service upgrade
Stop ThingsBoard service if it is running.
sudo service thingsboard stop
sudo rpm -Uvh thingsboard-4.2pe.rpm
Configuration files
rpm does not prompt about configuration files. If you changed a configuration file and the new package ships a different version of it, rpm keeps your file in place and writes the new default alongside it as .rpmnew. If no .rpmnew file appears, there is nothing to merge.
The recommended approach is to use the new file as the base: copy your custom values into the .rpmnew file, then replace your current configuration file with it.
Do this before running the upgrade script — the script reads the configuration file for your database connection settings and fails without them. If this version needs no upgrade script, do it before starting the service.
sudo /usr/share/thingsboard/bin/install/upgrade.sh
Start the service
sudo service thingsboard start