Hello, last night I tried to update my VitelPBX to latest version on VitalPBX 4, but as soon as I hit update I got this error
Fatal error : Uncaught Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘csfr_token’ in ‘field list’ With Query: select lower(hex(csfr_token
)) as csfr_token
from ombu_sessions
where session_id
= unhex(?) and modified
>= from_unixtime(unix_timestamp(now()) - ?) in /usr/share/vitalpbx/www/includes/db.php:0 Stack trace: #0 /usr/share/vitalpbx/www/includes/db.php(0): vitalpbx\db->__construct() #1 /usr/share/vitalpbx/www/includes/session.php(0): vitalpbx\db::query() #2 /usr/share/vitalpbx/www/includes/session.php(0): vitalpbx\session::token_id() #3 /usr/share/vitalpbx/www/includes/session.php(0): vitalpbx\session::start() #4 /usr/share/vitalpbx/www/includes/acl/user.php(0): vitalpbx\session::current() #5 /usr/share/vitalpbx/www/includes/app/Core.php(0): vitalpbx\acl\user::current() #6 /usr/share/vitalpbx/www/includes/app/Core.php(0): app\Core->_loadMainView() #7 /usr/share/vitalpbx/www/index.php(0): app\Core->run() #8 {main} thrown in /usr/share/vitalpbx/www/includes/db.php on line 0
also, any paid modules that I have do not work, it said that module does not exist.
what can be the issue?
miguel
November 11, 2023, 3:22am
2
When something like this happen, just try doing a full update from Linux CLI using root privileges.
apt clean all
apt update
apt upgrade -y
geotek
November 12, 2023, 11:28am
3
Same issue here as well, miguel’s advice didn’t help.
It appears that the current VitalPBX version failed to upgrade the MySQL scheme properly. Creating a new column csfr_token of type varbinary(40) in table ombu_sessions solved the issue for me.
Could a VitalPBX employee please comment on this and tell us about the correct column property? varbinary(40) may not be correct.
Same issue here as well, miguel’s advice didn’t help.
Please post command for how to creating a new column csfr_token of type varbinary(40) in table ombu_sessions
geotek
November 14, 2023, 6:33pm
5
OK, found it out myself. The correct column type is binary(20).
The error occurred because I had changed the MySQL root password. However, this caused the schema update scripts that are called during VitalPBX updates to fail because they expect the root user to have no password.
So the solution is to remove the MySQL root password so that future database migration scripts can be executed during apt upgrades.
1 Like
mo10
November 14, 2023, 7:07pm
6
Good you found that. You sure should not change the root password. This was never a good idea in any version.
When I remove the MySQL root password, update was successful, but when I log of and try to log in, I got error
Exception : SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘csfr_token’ in ‘field list’ With Query: insert into ombu_sessions
( session_id
, user_id
, csfr_token
, created
, modified
) select unhex(?), user_id
, unhex(?), now(), now() from ombu_users
where (username
= ? or email
= ?) and password = unhex(?) on duplicate key update user_id
= values(user_id
), modified
= values(modified
) at file /usr/share/vitalpbx/www/includes/db.php on line 0
miguel
November 15, 2023, 10:12pm
8
You can use the command below to apply pending migrations.
vitalpbx build-db