Update failed, 9.0.53 to 9.0.54 or 10.0.1

Hi,

I an trying to update nextcloud from 9.0.53. I downloaded the tar.bz2, extracted and renamed it to the correct name folder, and move the data directorie and the config.php file to the new folder. When I run

sudo -u www-data php nextcloud/occ upgrade

I receive the fowling messages and error.

Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Set log level to debug
Turned on maintenance mode
Checking whether the database schema can be updated (this can take a long time depending on the database size)
Checked database schema update
Checking updates of apps
Checked database schema update for apps
Updating database schema
Updated database
Updating <theming> ...
Updated <theming> to 0.2.0
Starting code integrity check...
Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'INSERT INTO `oc_appconfig` (`appid`,`configkey`,`configvalue`) SELECT ?,?,? FROM `oc_appconfig` WHERE `appid` = ? AND `configkey` = ? HAVING COUNT(*) = 0' with params ["core", "oc.integritycheck.checker", "[]", "core", "oc.integritycheck.checker"]:

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
Update failed
Maintenance mode is kept active
Reset log level

The Mysql server is a remote MariaDB server, running few other databases. As this is the first time we have problem with the db server, I thought you experts could give us some tips about what we should look for. Any help will be appreciated.

Thanks for the quick response. This is the content of my my.conf

[client]
port		= 3306
socket		= /var/run/mysqld/mysqld.sock

[mysqld_safe]
socket		= /var/run/mysqld/mysqld.sock
nice		= 0

[mysqld]
user		= mysql
pid-file	= /var/run/mysqld/mysqld.pid
socket		= /var/run/mysqld/mysqld.sock
port		= 3306
basedir		= /usr
datadir		= /var/lib/mysql
tmpdir		= /tmp
lc-messages-dir	= /usr/share/mysql
skip-external-locking
bind-address           = 192.168.1.62
key_buffer		= 16M
max_allowed_packet	= 16M
thread_stack		= 192K
thread_cache_size       = 8
myisam-recover         = BACKUP
query_cache_limit	= 1M
query_cache_size        = 16M
log_error = /var/log/mysql/error.log
expire_logs_days	= 10
max_binlog_size         = 100M
ssl-ca=/etc/ssl/certs/ca_certs.pem
ssl-cert=/etc/ssl/certs/mysqlserver.cert
ssl-key=/etc/ssl/private/mysqlserver.key

[mysqldump]
quick
quote-names
max_allowed_packet	= 16M

[mysql]

[isamchk]
key_buffer		= 16M

!includedir /etc/mysql/conf.d/

Maybe you are interested in the the follow variables

| skip_name_resolve   | OFF   
| max_allowed_packet  | 16777216
| wait_timeout        | 28800

If you want other variables values, please ask. I had played with those values myself with no results and I can test whatever you want. BUT I also read that problem could be a improper query and this motivated me to ask you experts. Interesting is no errors show up in the mysql error log. Thanks again.

In your php settings you probably have timeout settings as well:
mysql.connect_timeout

Sorry for the delay in answering. Other servers took our attention for a looong time.

the content of “/etc/php/7.0/cli/php.ini” is

[PHP]
engine = On
short_open_tag = Off
precision = 14
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 17
disable_functions =
disable_classes =
zend.enable_gc = On
expose_php = On
max_execution_time = 300
max_input_time = 300
memory_limit = -1
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
html_errors = On
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 256M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
default_charset = "UTF-8"
doc_root =
user_dir =
enable_dl = Off
file_uploads = On
upload_max_filesize = 256M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 14400
mysql.connect_timeout = 14400
[CLI Server]
cli_server.color = On
[Date]
[filter]
[iconv]
[intl]
[sqlite3]
[Pcre]
[Pdo]
[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=
[Phar]
[mail function]
SMTP = localhost
smtp_port = 25
mail.add_x_header = On
[SQL]
sql.safe_mode = Off
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[Interbase]
ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = Off
[OCI8]
[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[bcmath]
bcmath.scale = 0
[browscap]
[Session]
session.save_handler = files
session.use_strict_mode = 0
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 0
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[Assertion]
zend.assertions = -1
[COM]
[mbstring]
[gd]
[exif]
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[sysvshm]
[ldap]
ldap.max_links = -1
[mcrypt]
[dba]
[opcache]
[curl]
[openssl]

using 10.0.2 files

www-data@nextcloud:/var/www/html/nextcloud$ php occ upgrade
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Set log level to debug
Checking whether the database schema can be updated (this can take a long time depending on the database size)
 Done                                     
 27/27 [============================] 100%
Checked database schema update
Checking updates of apps
Checking whether the database schema for <activity> can be updated (this can take a long time depending on the database size)
 Done                                     
 2/2 [============================] 100%  
Checking whether the database schema for <dav> can be updated (this can take a long time depending on the database size)
 Done                                     
 10/10 [============================] 100%
Checking whether the database schema for <federatedfilesharing> can be updated (this can take a long time depending on the database size)
 Done                                     
 1/1 [============================] 100%  
Checking whether the database schema for <federation> can be updated (this can take a long time depending on the database size)
 Done                                     
 1/1 [============================] 100%  
Checking whether the database schema for <files_sharing> can be updated (this can take a long time depending on the database size)
 Done                                     
 1/1 [============================] 100%  
Checking whether the database schema for <files_trashbin> can be updated (this can take a long time depending on the database size)
 Done                                     
 1/1 [============================] 100%  
Checking whether the database schema for <notifications> can be updated (this can take a long time depending on the database size)
 Done                                     
 1/1 [============================] 100%  
Checking whether the database schema for <user_ldap> can be updated (this can take a long time depending on the database size)
 Done                                     
 3/3 [============================] 100%  
Checked database schema update for apps
Updating database schema
Updated database
Updating <federatedfilesharing> ...
Updated <federatedfilesharing> to 1.0.1
Updating <gallery> ...
Updated <gallery> to 15.0.1
Updating <provisioning_api> ...
Updated <provisioning_api> to 1.0.0
Updating <theming> ...
Updated <theming> to 1.0.1
Updating <updatenotification> ...
Updated <updatenotification> to 1.0.1
Updating <federation> ...
Updated <federation> to 1.0.1
Updating <user_ldap> ...
Updated <user_ldap> to 1.0.1
Updating <files> ...
Updated <files> to 1.5.2
Updating <activity> ...
Updated <activity> to 2.3.2
Updating <dav> ...
Fix classification for calendar objects
 Done                                      
    4/4 [============================] 100%
Updated <dav> to 1.0.1
Updating <files_sharing> ...
Updated <files_sharing> to 1.0.0
Updating <files_trashbin> ...
Updated <files_trashbin> to 1.0.0
Updating <files_versions> ...
Updated <files_versions> to 1.3.0
Updating <comments> ...
Updated <comments> to 1.0.0
Updating <notifications> ...
Updated <notifications> to 0.3.0
Updating <systemtags> ...
Updated <systemtags> to 1.0.2
Drop old database tables
 Done                                              
 31/31 [============================] 100%         
Remove old (< 9.0) calendar/contact shares
 Done                                              
 4/4 [============================] 100%           
Fix permissions so avatars can be stored again
 Done                                              
 2/2 [============================] 100%           
Repair unmerged shares
 Done                                              
 4/4 [============================] 100%           
Starting code integrity check...
Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'INSERT INTO `oc_appconfig` (`appid`,`configkey`,`configvalue`) SELECT ?,?,? FROM `oc_appconfig` WHERE `appid` = ? AND `configkey` = ? HAVING COUNT(*) = 0' with params ["core", "oc.integritycheck.checker", "[]", "core", "oc.integritycheck.checker"]:

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
Update failed
Maintenance mode is kept active
Reset log level

You allow persistant connections, so it shouldn’t be a problem of a php timeout. In my.cnf you can change the settings as well (at least during the upgrade):
https://support.rackspace.com/how-to/how-to-change-the-mysql-timeout-on-a-server/
other solution could be that you enable reconnect in you php.ini:
mysqli.reconnect = On

What kind of a system are you using and how many users and data? Just to check, for smaller setups on real systems you normally don’t need many adjustments, only on larger setups or limited hardware.

For more details, you could enhance the loglevel of your servers (webserver, php and mysql), then you should be able to figure out which process run into a timeout.