-
Type:
Problem report
-
Resolution: Fixed
-
Priority:
Blocker
-
Affects Version/s: 8.0.0rc1
-
Component/s: Documentation (D), Server (S)
-
None
-
S26-W40/41
-
1
Summary
Database upgrade to Zabbix 8.0.0rc1 fails when graph_theme ID 5 already exists
Description
While upgrading an existing Zabbix installation to Zabbix 8.0.0rc1, the automatic database upgrade fails at 26% because the upgrade attempts to insert a new graph theme with graphthemeid=5.
The database already contains a custom graph theme using ID 5:
SELECT *
FROM graph_theme
WHERE graphthemeid = 5;
Result:
graphthemeid: 5
theme: custom-theme
The existing theme appears to originate from an older Zabbix installation/customization.
During the upgrade, Zabbix tries to execute:
insert into graph_theme values
(5,'blue-classic-theme','FFFFFF','FFFFFF','CCD5D9','ACBBC2','ACBBC2',
'1F2C33','E33734','429E47','E33734','EBEBEB',
'1A7C11,F63100,2774A4,A54F10,FC6EA3,6C59DC,AC8C14,611F27,F230E0,
5CCD18,BB2A02,5A2B57,89ABF8,7EC25C,274482,2B5429,8048B4,FD5434,
790E1F,87AC4D,E89DF4');
This fails with:
[Z3008] query failed due to primary key constraint:
[1062] Duplicate entry '5' for key 'PRIMARY'
After this error the Zabbix server stops.
Relevant log
2099211:20261001:170044.773 completed 26% of database upgrade
2099211:20261001:170044.779 [Z3008] query failed due to primary key constraint:
[1062] Duplicate entry '5' for key 'PRIMARY'
[insert into graph_theme values
(5,'blue-classic-theme','FFFFFF','FFFFFF','CCD5D9','ACBBC2','ACBBC2',
'1F2C33','E33734','429E47','E33734','EBEBEB',
'1A7C11,F63100,2774A4,A54F10,FC6EA3,6C59DC,AC8C14,611F27,F230E0,
5CCD18,BB2A02,5A2B57,89ABF8,7EC25C,274482,2B5429,8048B4,FD5434,
790E1F,87AC4D,E89DF4')]
2099211:20261001:170044.779 database upgrade failed on patch 07050062,
exiting in 10 seconds
2099211:20261001:170054.780 Zabbix Server stopped.
Zabbix 8.0.0rc1
Environment
Zabbix target version: 8.0.0rc1
Database: MariaDB
MariaDB version: 11.4.8-MariaDB
The upgrade reports mandatory database patches starting from:
required mandatory version: 07050195
starting automatic database upgrade
Existing database contents
Before the upgrade:
SELECT *
FROM graph_theme
WHERE graphthemeid = 5;
returns:
graphthemeid | theme
------------+------------
5 | custom-theme
So database patch 07050062 assumes that graphthemeid=5 is available, which is not necessarily true for an existing upgraded database.
Expected result
The database upgrade should succeed even if an existing/custom graph theme already uses ID 5.
The upgrade patch should either:
- use an ID which cannot conflict with existing data;
- detect/migrate the existing entry;
- or otherwise handle existing custom themes before inserting the new built-in theme.
Actual result
Database patch 07050062 performs an unconditional insert with:
graphthemeid = 5
which causes a primary-key violation and prevents the Zabbix server from starting.
Steps to reproduce
1. Have an existing Zabbix database containing:
INSERT INTO graph_theme (...) VALUES (5, 'custom-theme', ...);
2. Upgrade Zabbix to 8.0.0rc1.
3. Start zabbix_server.
4. Automatic database upgrade reaches patch 07050062.
5. Upgrade fails with:
Duplicate entry '5' for key 'PRIMARY'
- caused by
-
ZBX-27125 SVG and classic graph visualization issues using Dark (classic) theme
-
- Closed
-