MySQL Error when trying to update to 11.0.4
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Is there an existing issue for this?
- [x] I have searched the existing issues
Version
11.0.2
Bug description
When we try to update our GLPI from v11.0.2 to 11.0.4, we get this error.
Any idea?
Relevant log output
Page URL
No response
Steps To reproduce
No response
Your GLPI setup information
GLPI information
GLPI: 11.0.2 (/glpi => /var/www/html/glpi) Installation mode: TARBALL Current language: fr_FR Source Integrity: 2 files changed A: inc/downstream.php D: install/install.php
Server
Operating system: Linux NCPA-SRVGLPI-01 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64PHP: 8.2.29 fpm-fcgi
PHP extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, random, Reflection, SPL, session, standard, sodium, cgi-fcgi, mysqlnd, PDO, xml, bcmath, bz2, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, iconv, imap, intl, ldap, exif, mysqli, pdo_mysql, Phar, posix, readline, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, Zend OPcache
Setup: disable_functions="" max_execution_time="30" max_input_vars="1000" memory_limit="256M" post_max_size="8M" session.cookie_secure="0" session.cookie_httponly="1" session.cookie_samesite="" session.save_handler="files" upload_max_filesize="2M"
Web server: Apache/2.4.65 (Debian) (Apache/2.4.65 (Debian) Server at 10.10.100.41 Port 80)
User agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:146.0) Gecko/20100101 Firefox/146.0
Database:
Server Software: Debian 12
Server Version: 10.11.14-MariaDB-0+deb12u2
Server SQL Mode: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Parameters: glpiuser@localhost/glpi_v10
Host info: Localhost via UNIX socket
Requirements: PHP version (8.2.29) is supported. OS and PHP are relying on 64 bits integers. Sessions configuration is OK. Allocated memory is sufficient. Following extensions are installed: dom, fileinfo, filter, libxml, simplexml, tokenizer, xmlreader, xmlwriter. mysqli extension is installed curl extension is installed gd extension is installed intl extension is installed mbstring extension is installed zlib extension is installed bcmath extension is installed The constant SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES is present. openssl extension is installed Database engine version (10.11.14) is supported. The log file has been created successfully. Write access to /var/lib/glpi/_cache has been validated. Write access to /var/lib/glpi/_cron has been validated. Write access to /var/lib/glpi has been validated. Write access to /var/lib/glpi/_graphs has been validated. Write access to /var/lib/glpi/_lock has been validated. Write access to /var/lib/glpi/_pictures has been validated. Write access to /var/lib/glpi/_plugins has been validated. Write access to /var/lib/glpi/_rss has been validated. Write access to /var/lib/glpi/_sessions has been validated. Write access to /var/lib/glpi/_tmp has been validated. Write access to /var/lib/glpi/_uploads has been validated.
Sessions configuration is secured. exif extension is installed ldap extension is installed Following extensions are installed: bz2, Phar, zip. Zend OPcache extension is installed Following extensions are installed: ctype, iconv, sodium. Write access to /var/www/html/glpi/marketplace has been validated. Timezones seems loaded in database.
GLPI constants
GLPI_ROOT: "/var/www/html/glpi" GLPI_VERSION: "11.0.2" GLPI_SCHEMA_VERSION: "11.0.2@ea2dbba0e1edbf5128d73bdb23c2c9b9f68468ba" GLPI_FILES_VERSION: "11.0.2-52505ef9" GLPI_MIN_PHP: "8.2" GLPI_MAX_PHP: "8.5" GLPI_YEAR: "2025" GLPI_I18N_DIR: "/var/www/html/glpi/locales" GLPI_CONFIG_DIR: "/etc/glpi/" GLPI_VAR_DIR: "/var/lib/glpi" GLPI_LOG_DIR: "/var/log/glpi" GLPI_ENVIRONMENT_TYPE: "production" GLPI_MARKETPLACE_DIR: "/var/www/html/glpi/marketplace" GLPI_ALLOW_IFRAME_IN_RICH_TEXT: false GLPI_SERVERSIDE_URL_ALLOWLIST: ["~^\n (http|https|feed)://
# protocol\n (\n (?:\n
(?:xn--[a-z0-9-]++\.)+xn--[a-z0-9-]++ # a domain name using punycode\n
|\n (?:[\pL\pN\pS\pM\-\]++\.)+[\pL\pN\pM]++ # a multi-level domain name\n |\n [a-z0-9\-\]++
# a single-level domain name\n )\.?\n |
# or\n \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}
# an IP address\n | # or\n \[\n
(?:(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-f]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,1}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){3})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,2}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){2})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,3}(?:(?:[0-9a-f]{1,4})))?::(?:(?:[0-9a-f]{1,4})):)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,4}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,5}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,6}(?:(?:[0-9a-f]{1,4})))?::))))\n \] # an IPv6 address\n
)\n (?:/ (?:[\pL\pN\pS\pM\-._\~!$&'()+,;=:@]|%[0-9A-Fa-f]{2})* )* # a path\n
(?:\? (?:[\pL\pN\-._\~!$&'\\+,;=:@/?]|%[0-9A-Fa-f]{2}) )? # a query (optional)\n
$~ixuD"] GLPI_DISALLOWED_UPLOADS_PATTERN: "/\.(php\d*|phar)$/i" GLPI_TELEMETRY_URI: "https://telemetry.glpi-project.org" GLPI_INSTALL_MODE: "TARBALL" GLPI_NETWORK_MAIL: "[email protected]" GLPI_NETWORK_SERVICES: "https://services.glpi-network.com" GLPI_MARKETPLACE_ENABLE: 3 GLPI_MARKETPLACE_PRERELEASES: false GLPI_MARKETPLACE_ALLOW_OVERRIDE: true GLPI_MARKETPLACE_MANUAL_DOWNLOADS: true GLPI_USER_AGENT_EXTRA_COMMENTS: "" GLPI_DOCUMENTATION_ROOT_URL: "https://links.glpi-project.org" GLPI_DISABLE_ONLY_FULL_GROUP_BY_SQL_MODE: "1" GLPI_LOG_LVL: "warning" GLPI_SKIP_UPDATES: false GLPI_STRICT_ENV: false GLPI_AJAX_DASHBOARD: "1" GLPI_CALDAV_IMPORT_STATE: 0 GLPI_CENTRAL_WARNINGS: "1" GLPI_SYSTEM_CRON: false GLPI_TEXT_MAXSIZE: "4000" GLPI_WEBHOOK_ALLOW_RESPONSE_SAVING: "0" GLPI_WEBHOOK_CRA_MANDATORY: false GLPI_ALTCHA_MODE: "interactive" GLPI_ALTCHA_MAX_NUMBER: 50000 GLPI_ALTCHA_EXPIRATION_INTERVAL: "PT20M" GLPI_DOC_DIR: "/var/lib/glpi" GLPI_CACHE_DIR: "/var/lib/glpi/_cache" GLPI_CRON_DIR: "/var/lib/glpi/_cron" GLPI_GRAPH_DIR: "/var/lib/glpi/_graphs" GLPI_LOCAL_I18N_DIR: "/var/lib/glpi/_locales" GLPI_LOCK_DIR: "/var/lib/glpi/_lock" GLPI_PICTURE_DIR: "/var/lib/glpi/_pictures" GLPI_PLUGIN_DOC_DIR: "/var/lib/glpi/_plugins" GLPI_RSS_DIR: "/var/lib/glpi/_rss" GLPI_SESSION_DIR: "/var/lib/glpi/_sessions" GLPI_TMP_DIR: "/var/lib/glpi/_tmp" GLPI_UPLOAD_DIR: "/var/lib/glpi/_uploads" GLPI_INVENTORY_DIR: "/var/lib/glpi/_inventories" GLPI_THEMES_DIR: "/var/lib/glpi/_themes" GLPI_PLUGINS_DIRECTORIES: ["/var/www/html/glpi/marketplace","/var/www/html/glpi/plugins"] GLPI_NETWORK_REGISTRATION_API_URL: "https://services.glpi-network.com/api/registration/" GLPI_MARKETPLACE_PLUGINS_API_URI: "https://services.glpi-network.com/api/marketplace/"
Réplicats SQL
Not active
Notifications
Way of sending emails: SMTP(smtp://support%40ncpa.fr:********@smtp.office365.com:587?verify_peer=0) Name: '[email protected]' Active: Yes Server: '{outlook.office365.com/imap-oauth-1/ssl/tls}INBOX/support' Login: '[email protected]' Password: Yes Name: '[email protected]' Active: No Server: '{outlook.office365.com/imap-oauth-1/ssl}INBOX/commande' Login: '[email protected]' Password: Yes
Plugins list
barcode Name: Barcode Version: 2.7.1 State: Activé
Install Method: Manual mydashboard Name: Dashboard Version: 2.2.2 State: Activé
Install Method: Manual datainjection Name: Data Injection Version: 2.15.1 State: Activé
Install Method: Manual gappessentials Name: Gapp Essentials Version: 2.3.0 State: Installé / non activé
Install Method: Marketplace glpiinventory Name: GLPI Inventory Version: 1.5.3 State: Installé / non activé
Install Method: Manual geninventorynumber Name: Inventory number generation Version: 2.9.0 State: Activé
Install Method: Manual mreporting Name: More Reporting Version: 1.9.1 State: Installé / non activé
Install Method: Manual oauthimap Name: OAuth IMAP Version: 1.5.0 State: Activé
Install Method: Manual pdf Name: Print to pdf Version: 4.1.1 State: Activé
Install Method: Manual manufacturersimports Name: Suppliers imports Version: 3.1.1 State: Activé
Install Method: Manual
Anything else?
No response
Seems like you run update twice. If an update fails, you have to drop the database, restore the backup of the previous version, and try upgrade again.
i have the same error : MySQL query error: Duplicate entry 'Printer-1225-2025-10-19' for key 'unicity' (1062) in SQL query "UPDATE glpi_printerlogs SET itemtype = 'Printer' WHERE itemtype = ''".
Iam sure that i run update once - my glpi is on VM and i got snapshoot before i start upgrade. So i can restore my job before i start.
I restore my machine twice and i get the same error twice . looks like bug
Returned to 11.0.2 version Run conole database check and check integrity and its ok for version 11.0.2 .
@adamcios could you please give the output of the following query:
SELECT * FROM glpi_printerlogs WHERE items_id=1225 AND date='2025-10-19'
I seem to have the same problem.
Using docker with glpi/glpi:11.0.2 image, tried to update to 11.0.3 and 11.0.4.
Error:
> An error occurred during the update. The error was: MySQL query error: Duplicate entry 'Printer-109-2025-10-19' for key 'unicity' (1062) in SQL query "UPDATE `glpi_printerlogs` SET `itemtype` = 'Printer' WHERE `itemtype` = ''".
SELECT *
FROM glpi_printerlogs
WHERE items_id = 109
AND date = '2025-10-19';
| id | itemtype | items_id | total_pages | bw_pages | color_pages | rv_pages | prints | bw_prints | color_prints | copies | bw_copies | color_copies | scanned | date | date_creation | date_mod | faxed |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 3458 | 109 | 8102 | 0 | 4683 | 240 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2025-10-19 | 2025-10-19 00:23:11.000 | 2025-10-19 00:23:11.000 | 0 | |
| 3497 | Printer | 109 | 8102 | 0 | 4683 | 240 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2025-10-19 | 2025-10-19 20:51:48.000 | 2025-10-19 20:51:48.000 | 0 |
Haven't done anything fancy with the install, plugin list below.
www-data@47f8b7da0008:~/glpi$ php bin/console plugin:list
+----------------------+-------------------------------------+---------+---------------------------+----------------+
| Plugin Key | Name | Version | Status | Install Method |
+----------------------+-------------------------------------+---------+---------------------------+----------------+
| fields | Additional fields | 1.23.1 | Enabled | Marketplace |
| webapplications | Appliances Dashboard | 5.1.2 | Installed / Not Activated | Marketplace |
| archisw | Apps structures | 3.0.24 | Installed / Not Activated | Marketplace |
| archibp | Business Processes | 2.0.13 | Installed / Not Activated | Marketplace |
| datainjection | Data injection | 2.15.2 | Enabled | Marketplace |
| databaseinventory | Database Inventory | 1.1.2 | Enabled | Marketplace |
| formcreator | Formcreator End-of-Life Updater | 3.0.0 | Not Installed | Marketplace |
| genericobject | Generic Objects End-of-Life Updater | 3.0.0 | Not Installed | Marketplace |
| glpiinventory | GLPI Inventory | 1.6.4 | Enabled | Marketplace |
| addressing | IP Addressing | 3.1.0 | Not Installed | Marketplace |
| metademands | Meta-Demands | 3.5.3 | Not Installed | Marketplace |
| mreporting | More Reporting | 1.9.1 | Not Installed | Marketplace |
| samlsso | samlsso | 1.2.5 | Enabled | Marketplace |
| statecheck | Statecheck Rules | 2.4.7 | Installed / Not Activated | Marketplace |
| manufacturersimports | Suppliers imports | 3.1.1 | Enabled | Marketplace |
+----------------------+-------------------------------------+---------+---------------------------+----------------+
SELECT * FROM glpi_printerlogs WHERE items_id = 109 AND date = '2025-10-19'; id itemtype items_id total_pages bw_pages color_pages rv_pages prints bw_prints color_prints copies bw_copies color_copies scanned date date_creation date_mod faxed 3458 109 8102 0 4683 240 0 0 0 0 0 0 0 2025-10-19 2025-10-19 00:23:11.000 2025-10-19 00:23:11.000 0 3497 Printer 109 8102 0 4683 240 0 0 0 0 0 0 0 2025-10-19 2025-10-19 20:51:48.000 2025-10-19 20:51:48.000 0
Thanks for the feedback.
Your data confirms what I suspected: this is due to an inventory tha same day, with different versions of GLPI (the older one without itemtype specified, the new one with it).
A quick solution would be to remove the line without itemtype; but that may concerns many lines. We'll work on a solution.
Local solution (tested on a very few records; make sure you know what you do and you have a db backup!).
You can identify problematic lines with the following query:
SELECT * FROM glpi_printerlogs AS a
JOIN(
SELECT items_id, date
FROM glpi_printerlogs
GROUP BY items_id, date
HAVING COUNT(items_id) > 1
) AS b
WHERE a.items_id = b.items_id AND a.date = b.date AND a.itemtype = ''
If that seems correct, you can then remove the lines using:
DELETE FROM glpi_printerlogs WHERE id IN (
SELECT a.id FROM glpi_printerlogs AS a
JOIN(
SELECT items_id, date
FROM glpi_printerlogs
GROUP BY items_id, date
HAVING COUNT(items_id) > 1
) AS b
WHERE a.items_id = b.items_id AND a.date = b.date AND a.itemtype = ''
)
After that change, you should be able to run the update without issues.
Seems like the delete query did its job. Upgrade worked.
Seems like the delete query did its job. Upgrade worked.
Great! Thanks for the feedback. I'll work on a solution for the next release in the next weeks.
Used your local solution @trasher and it worked for me too. Upgrade worked.
@adamcios could you please give the output of the following query:
SELECT * FROM glpi_printerlogs WHERE items_id=1225 AND date='2025-10-19'
@adamcios unsuprisingly, you have the same issue as others ;)