PandoraFMS server v4 fails to start – exits with Unknown column errors

During the Pandora FMS console upgrade the database schema may not have been upgraded correctly. If this happens then the Pandora server will be unable to start, i.e. when you try /etc/init.d/pandora_server start then it fails and logs its error messages in the /var/log/pandora/pandora_server.error file. If there are Unknown column errors then this is a clear giveaway that the database that you are connecting to doesn’t have the expected schema,

DBD::mysql::db do failed: Unknown column 'extended_info' in 'field list' at /usr/lib/perl5/PandoraFMS/DB.pm line 567.
DBD::mysql::st execute failed: Unknown column 'disabled' in 'where clause' at /usr/lib/perl5/PandoraFMS/DB.pm line 399.
DBD::mysql::db do failed: Unknown column 'tags' in 'field list' at /usr/lib/perl5/PandoraFMS/DB.pm line 567.

The fix is easy to do (assuming you don’t want to fall back to the previous version). Ideally first make a backup of your database using whatever tools you have available (your cpanel Mysql tools or command line mysqldump or phpmyadmin).
Then run the following command line commands,

cd /path/to/pandora_console
cat extras/pandoradb_migrate_v3.1_to_v3.2.sql | mysql -u pandora -p -D pandora

and then at the Enter password: prompt enter the password of the mysql user pandora. Note that the -u is the user i.e. pandora and the -D pandora is the database of pandora. This is the default convention used on the Pandora FMS system though you can use any database username and database name. Yes that is the 3.1 to 3.2 schema upgrade file. There is no harm in repeating that command.

Then repeat that with the 3.2 -> 4.0 schema changes..

cat extras/pandoradb_migrate_v3.2_to_v4.0.sql | mysql -u pandora -p -D pandora

At the end of this then you can start the Pandora server and it should startup correctly.