glpi-project / glpi

GLPI is a Free Asset and IT Management Software package, Data center management, ITIL Service Desk, licenses tracking and software auditing.
https://glpi-project.org
GNU General Public License v3.0
4.3k stars 1.29k forks source link

uninteractive database:update from 10.0.8 to 10.0.9 fails #15192

Closed dani closed 1 year ago

dani commented 1 year ago

Code of Conduct

Is there an existing issue for this?

Version

10.0.8

Bug description

I've updated my 10.0.7 instance to 10.0.8 last week, and everything was fine. Today, trying to update to 10.0.9 fails

[root@web1 web]# sudo -u php-glpi_1 php82 ./bin/console -n database:update
Some optional system requirements are missing. Run the "php bin/console system:check_requirements" command for more details.
+-----------------------+----------------+--------+
|                       | Current        | Target |
+-----------------------+----------------+--------+
| Database host         | db             |        |
| Database name         | glpi_1         |        |
| Database user         | glpi_1         |        |
| GLPI version          | 10.0.8         | 10.0.9 |
| GLPI database version | 10.0.8         | 10.0.9 |
+-----------------------+----------------+--------+
Checking database schema integrity...
The database schema is not consistent with the installed GLPI version (10.0.8). Run the "php bin/console database:check_schema_integrity" command to view found differences.
[root@web1 web]# 

If I run database:check_schema_integrity

[root@web1 web]# sudo -u php-glpi_1 php82 ./bin/console database:check_schema_integrity
Table schema differs for table "glpi_queuednotifications".
--- Expected database schema
+++ Current database schema
@@ @@
   `create_time` datetime,
   `documents` text,
   `entities_id` int NOT NULL DEFAULT 0,
-  `event` varchar(255),
   `headers` text,
   `is_deleted` tinyint NOT NULL DEFAULT 0,
   `items_id` int NOT NULL DEFAULT 0,
[root@web1 web]# 

It looks like the update from 10.0.7 to 10.0.8 did not create the event column in the glpi_queuednotifications table, which is now preventing further upgrades. Only uninteractive update are affected. I can upgrade the DB from the web interface (and most likely from the cli if I omit -n and validate the upgrade)

Relevant log output

No response

Page URL

No response

Steps To reproduce

  1. Update a 10.0.7 install to 10.0.8
  2. Try to update from 10.0.8 to 10.0.9

Your GLPI setup information

Informations sur le système, l'installation et la configuration
GLPI 10.0.9 ( => /opt/glpi_1/web)
Installation mode: TARBALL
Current language:fr_FR

Server
 
Operating system: Linux web1 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64
PHP 8.1.21 fpm-fcgi (Core, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apcu, bcmath, bz2, calendar, cgi-fcgi, ctype,
    curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, igbinary, imagick, imap, intl, json, ldap, libxml,
    mbstring, memcached, msgpack, mysqli, mysqlnd, openssl, pcre, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, posix, session, shmop,
    snmp, soap, sockets, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tokenizer, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip,
    zlib)
Setup: max_execution_time="600" memory_limit="256M" post_max_size="100M" safe_mode="" session.save_handler="files"
    upload_max_filesize="100M" 
Software: Apache ()
    Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36
Server Software: MariaDB Server
    Server Version: 10.6.14-MariaDB
    Server SQL Mode: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
    Parameters: glpi_1@db/glpi_1
    Host info: db via TCP/IP

PHP version (8.1.21) is supported.
Sessions configuration is OK.
Allocated memory is sufficient.
mysqli extension is installed.
Following extensions are installed: dom, fileinfo, filter, libxml, json, simplexml, xmlreader, xmlwriter.
curl extension is installed.
gd extension is installed.
intl extension is installed.
zlib extension is installed.
The constant SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES is present.
Database engine version (10.6.14) is supported.
No files from previous GLPI version detected.
The log file has been created successfully.
Write access to /opt/glpi_1/data/_cache has been validated.
Write access to /opt/glpi_1/web/config has been validated.
Write access to /opt/glpi_1/data/_cron has been validated.
Write access to /opt/glpi_1/data/_files has been validated.
Write access to /opt/glpi_1/data/_dumps has been validated.
Write access to /opt/glpi_1/data/_graphs has been validated.
Write access to /opt/glpi_1/data/_lock has been validated.
Write access to /opt/glpi_1/data/_pictures has been validated.
Write access to /opt/glpi_1/data/_plugins has been validated.
Write access to /opt/glpi_1/data/_rss has been validated.
Write access to /opt/glpi_1/sessions has been validated.
Write access to /opt/glpi_1/tmp has been validated.
Write access to /opt/glpi_1/tmp has been validated.

PHP Warning (2): file_exists(): open_basedir restriction in effect. File(/usr/sbin/getenforce) is not within the allowed path(s): (/opt/glpi_1:/usr/share/pear/:/usr/share/php/:/etc/redhat-release) in /opt/glpi_1/web/src/System/Requirement/SeLinux.php at line 52

Web server root directory configuration seems safe.
PHP directive "session.cookie_secure" should be set to "on" when GLPI can be accessed on HTTPS protocol.
OS and PHP are relying on 64 bits integers.
exif extension is installed.
ldap extension is installed.
openssl extension is installed.
Following extensions are installed: bz2, Phar, zip.
Zend OPcache extension is installed.
Following extensions are installed: ctype, iconv, mbstring.
Following extensions are not present: sodium.
Write access to /opt/glpi_1/web/marketplace has been validated.
Access to timezone database (mysql) is not allowed.

GLPI constants
 
GLPI_ROOT: "/opt/glpi_1/web"
GLPI_VAR_DIR: "/opt/glpi_1/data"
GLPI_DOC_DIR: "/opt/glpi_1/data/_files"
GLPI_SESSION_DIR: "/opt/glpi_1/sessions"
GLPI_TMP_DIR: "/opt/glpi_1/tmp"
GLPI_UPLOAD_DIR: "/opt/glpi_1/tmp"
GLPI_CONFIG_DIR: "/opt/glpi_1/web/config"
GLPI_MARKETPLACE_DIR: "/opt/glpi_1/web/marketplace"
GLPI_USE_CSRF_CHECK: "1"
GLPI_CSRF_EXPIRES: "7200"
GLPI_CSRF_MAX_TOKENS: "100"
GLPI_USE_IDOR_CHECK: "1"
GLPI_IDOR_EXPIRES: "7200"
GLPI_ALLOW_IFRAME_IN_RICH_TEXT: false
GLPI_SERVERSIDE_URL_ALLOWLIST: ["/^(https?|feed):\\/\\/[^@:]+(\\/.*)?$/"]
GLPI_TELEMETRY_URI: "https://telemetry.glpi-project.org"
GLPI_INSTALL_MODE: "TARBALL"
GLPI_NETWORK_MAIL: "glpi@teclib.com"
GLPI_NETWORK_SERVICES: "https://services.glpi-network.com"
GLPI_MARKETPLACE_ALLOW_OVERRIDE: true
GLPI_MARKETPLACE_MANUAL_DOWNLOADS: true
GLPI_USER_AGENT_EXTRA_COMMENTS: ""
GLPI_DISABLE_ONLY_FULL_GROUP_BY_SQL_MODE: "1"
GLPI_AJAX_DASHBOARD: "1"
GLPI_CALDAV_IMPORT_STATE: 0
GLPI_DEMO_MODE: "0"
GLPI_CENTRAL_WARNINGS: "1"
GLPI_CACHE_DIR: "/opt/glpi_1/data/_cache"
GLPI_CRON_DIR: "/opt/glpi_1/data/_cron"
GLPI_DUMP_DIR: "/opt/glpi_1/data/_dumps"
GLPI_GRAPH_DIR: "/opt/glpi_1/data/_graphs"
GLPI_LOCAL_I18N_DIR: "/opt/glpi_1/data/_locales"
GLPI_LOCK_DIR: "/opt/glpi_1/data/_lock"
GLPI_LOG_DIR: "/opt/glpi_1/data/_log"
GLPI_PICTURE_DIR: "/opt/glpi_1/data/_pictures"
GLPI_PLUGIN_DOC_DIR: "/opt/glpi_1/data/_plugins"
GLPI_RSS_DIR: "/opt/glpi_1/data/_rss"
GLPI_INVENTORY_DIR: "/opt/glpi_1/data/_inventories"
GLPI_NETWORK_REGISTRATION_API_URL: "https://services.glpi-network.com/api/registration/"
GLPI_MARKETPLACE_PLUGINS_API_URI: "https://services.glpi-network.com/api/marketplace/"
GLPI_I18N_DIR: "/opt/glpi_1/web/locales"
GLPI_VERSION: "10.0.9"
GLPI_SCHEMA_VERSION: "10.0.9@77fc44668eaae89b61d95fe606d20d93d66110cd"
GLPI_MARKETPLACE_PRERELEASES: false
GLPI_MIN_PHP: "7.4.0"
GLPI_MAX_PHP: "8.3.0"
GLPI_YEAR: "2023"

Libraries
 
htmlawed/htmlawed version 1.2.14 in (/opt/glpi_1/web/vendor/htmlawed/htmlawed)
phpmailer/phpmailer version 6.8.0 in (/opt/glpi_1/web/vendor/phpmailer/phpmailer/src)
simplepie/simplepie version 1.5.8 in (/opt/glpi_1/web/vendor/simplepie/simplepie/library)
tecnickcom/tcpdf version 6.6.2 in (/opt/glpi_1/web/vendor/tecnickcom/tcpdf)
michelf/php-markdown in (/opt/glpi_1/web/vendor/michelf/php-markdown/Michelf)
true/punycode in (/opt/glpi_1/web/vendor/true/punycode/src)
iamcal/lib_autolink in (/opt/glpi_1/web/vendor/iamcal/lib_autolink)
sabre/dav in (/opt/glpi_1/web/vendor/sabre/dav/lib/DAV)
sabre/http in (/opt/glpi_1/web/vendor/sabre/http/lib)
sabre/uri in (/opt/glpi_1/web/vendor/sabre/uri/lib)
sabre/vobject in (/opt/glpi_1/web/vendor/sabre/vobject/lib)
laminas/laminas-i18n in (/opt/glpi_1/web/vendor/laminas/laminas-i18n/src)
laminas/laminas-servicemanager in (/opt/glpi_1/web/vendor/laminas/laminas-servicemanager/src)
monolog/monolog in (/opt/glpi_1/web/vendor/monolog/monolog/src/Monolog)
sebastian/diff in (/opt/glpi_1/web/vendor/sebastian/diff/src)
donatj/phpuseragentparser in (/opt/glpi_1/web/vendor/donatj/phpuseragentparser/src/UserAgent)
elvanto/litemoji in (/opt/glpi_1/web/vendor/elvanto/litemoji/src)
symfony/console in (/opt/glpi_1/web/vendor/symfony/console)
scssphp/scssphp in (/opt/glpi_1/web/vendor/scssphp/scssphp/src)
laminas/laminas-mail in (/opt/glpi_1/web/vendor/laminas/laminas-mail/src/Protocol)
laminas/laminas-mime in (/opt/glpi_1/web/vendor/laminas/laminas-mime/src)
rlanvin/php-rrule in (/opt/glpi_1/web/vendor/rlanvin/php-rrule/src)
blueimp/jquery-file-upload in (/opt/glpi_1/web/vendor/blueimp/jquery-file-upload/server/php)
ramsey/uuid in (/opt/glpi_1/web/vendor/ramsey/uuid/src)
psr/log in (/opt/glpi_1/web/vendor/psr/log/Psr/Log)
psr/simple-cache in (/opt/glpi_1/web/vendor/psr/simple-cache/src)
psr/cache in (/opt/glpi_1/web/vendor/psr/cache/src)
league/csv in (/opt/glpi_1/web/vendor/league/csv/src)
mexitek/phpcolors in (/opt/glpi_1/web/vendor/mexitek/phpcolors/src/Mexitek/PHPColors)
guzzlehttp/guzzle in (/opt/glpi_1/web/vendor/guzzlehttp/guzzle/src)
guzzlehttp/psr7 in (/opt/glpi_1/web/vendor/guzzlehttp/psr7/src)
glpi-project/inventory_format in (/opt/glpi_1/web/vendor/glpi-project/inventory_format/lib/php)
wapmorgan/unified-archive in (/opt/glpi_1/web/vendor/wapmorgan/unified-archive/src)
paragonie/sodium_compat in (/opt/glpi_1/web/vendor/paragonie/sodium_compat/src)
symfony/cache in (/opt/glpi_1/web/vendor/symfony/cache)
html2text/html2text in (/opt/glpi_1/web/vendor/html2text/html2text/src)
symfony/css-selector in (/opt/glpi_1/web/vendor/symfony/css-selector)
symfony/dom-crawler in (/opt/glpi_1/web/vendor/symfony/dom-crawler)
twig/twig in (/opt/glpi_1/web/vendor/twig/twig/src)
twig/string-extra in (/opt/glpi_1/web/vendor/twig/string-extra)
symfony/polyfill-ctype not found
symfony/polyfill-iconv not found
symfony/polyfill-mbstring not found
symfony/polyfill-php80 not found
symfony/polyfill-php81 not found
symfony/polyfill-php82 in (/opt/glpi_1/web/vendor/symfony/polyfill-php82)
league/oauth2-client in (/opt/glpi_1/web/vendor/league/oauth2-client/src/Provider)
league/oauth2-google in (/opt/glpi_1/web/vendor/league/oauth2-google/src/Provider)
thenetworg/oauth2-azure in (/opt/glpi_1/web/vendor/thenetworg/oauth2-azure/src/Provider)
phpCas version 1.6.1 in (/usr/share/pear)

LDAP directories
 
Server: 'dc3', Port: '389', BaseDN: 'DC=local,DC=org', Connection filter:
        '(&(objectClass=user)(objectCategory=person)(|(memberOf=CN=Domain
        Admins,OU=Groups,DC=local,DC=org)(memberOf=CN=Equipe,OU=Groups,DC=local,DC=org)))', RootDN: 'glpi@local.org', Use TLS:
        '1'

SQL replicas
 
Not active

Notifications
 
Way of sending emails: PHP

Plugins list
 
    mydashboard          Name: Dashboard                      Version: 2.1.5      State: Installed / not activated               
        Install Method: Manual
    tag                  Name: Gestion des tags               Version: 2.11.2     State: Installed / not activated               
        Install Method: Manual

Anything else?

No response

cedric-anne commented 1 year ago

Hi,

Indeed, non interactive mode will block the update as schema produced by 10.0.8 update is different than expected.

CLI migration from to from GLPI 10.0.7 to GLPI 10.0.8 was certainly returning an error code. If you process updates using a script in non-interactive mode, you should probably handle error result code to detect update issues and fix them.

Anyway, we will not solve this specific case as it would require too many code, and we expect administrators to have fix the 10.0.7->10.0.8 migration issue when command tell them that there was a problem.

dani commented 1 year ago

The database:update was not returning an error code (exit code 0), as the error wasn't catched by my ansible playbook. Anyway, not a big deal

cedric-anne commented 1 year ago

The database:update was not returning an error code (exit code 0), as the error wasn't catched by my ansible playbook.

My bad. #15193 should fix this bad behaviour in the future.