23.0.5 update to 24.0.1 failed

Hi all,

I always update with web updater in previous versions. Somethings the updates may not be successful, but after adding new indices to the DB, the update problems were usually solved.
But this time the update is failed and I donā€™t know how to solve it. Please give me hints. Many thanks.

The NC index page now shown the following message:

Exception: Database error when running migration 24000Date20220202150027 for app core An exception occurred while executing a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

Detailed logs

Preparing update

Set log level to debug

Turned on maintenance mode

Repair step: Repair MySQL collation

Repair info: All tables already have the correct collation ā†’ nothing to do

Repair step: Repair SQLite autoincrement

Repair step: Copy data from accounts table when migrating from ownCloud

Repair step: Drop account terms table when migrating from ownCloud

Updating database schema

Exception: Database error when running migration 24000Date20220202150027 for app core An exception occurred while executing a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

The update was unsuccessful. Please report this issue to the Nextcloud community.

1 Like

Exception: Database error when running migration 24000Date20220202150027 for app core

Any hints? How to debug this? Thank you in advance.

Is there any means to run it again after you restart the mysql database?

Same problem here!
The mariadb server crashes while the upgrade is in progress.

sudo systemctl status mysql gives a weird message:

This installation of MariaDB is already upgraded to 10.3.34-MariaDB.
There is no need to run mysql_upgrade again for 10.3.34-MariaDB.
You can use --force if you still want to run mysql_upgrade

sudo -u www-data 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
Setting log level to debug
Turned on maintenance mode
Updating database schema
Exception: Database error when running migration 24000Date20211222112246 for app core
An exception occurred while executing a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
Update failed
Maintenance mode is kept active
Resetting log level

Long time user, I have no clue!

Some more information:

sudo -u www-data php updater.phar

Nextcloud Updater - version: v24.0.0beta3-1-g67bf13b dirty

Current version is 24.0.1.

Update to Nextcloud 24.0.1 available. (channel: ā€œstableā€)
Following file will be downloaded automatically: https://download.nextcloud.com/server/releases/nextcloud-24.0.1.zip
Open changelog :arrow_upper_right:

Steps that will be executed:
[:heavy_check_mark:] Check for expected files
[:heavy_check_mark:] Check for write permissions
[:heavy_check_mark:] Create backup
[:heavy_check_mark:] Downloading
[:heavy_check_mark:] Verify integrity
[:heavy_check_mark:] Extracting
[:heavy_check_mark:] Enable maintenance mode
[:heavy_check_mark:] Replace entry points
[:heavy_check_mark:] Delete old files
[:heavy_check_mark:] Move new files in place
[:heavy_check_mark:] Done

Continue update? [y/N] y

Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.

[:heavy_check_mark:] Check for expected files
[:heavy_check_mark:] Check for write permissions
[:heavy_check_mark:] Create backup
[:heavy_check_mark:] Downloading
[:heavy_check_mark:] Verify integrity
[:heavy_check_mark:] Extracting
[:heavy_check_mark:] Enable maintenance mode
[:heavy_check_mark:] Replace entry points
[:heavy_check_mark:] Delete old files
[:heavy_check_mark:] Move new files in place
[:heavy_check_mark:] Done

Update of code successful.

Should the ā€œocc upgradeā€ command be executed? [Y/n]
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
Setting log level to debug
Turned on maintenance mode
Repair step: Repair MySQL collation
Repair info: All tables already have the correct collation ā†’ nothing to do
Repair step: Repair SQLite autoincrement
Repair step: Copy data from accounts table when migrating from ownCloud
Repair step: Drop account terms table when migrating from ownCloud
Updating database schema
Exception: Database error when running migration 24000Date20211222112246 for app core
An exception occurred while executing a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
Update failed
Maintenance mode is kept active
Resetting log level

Keep maintenance mode active? [y/N]
An unhandled exception has been thrown:
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refused
in /var/www/html/nextcloud/lib/private/DB/Connection.php:139
Stack trace:
#0 /var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1519): OC\DB\Connection->connect()
#1 /var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1041): Doctrine\DBAL\Connection->getWrappedConnection()
#2 /var/www/html/nextcloud/lib/private/DB/Connection.php(261): Doctrine\DBAL\Connection->executeQuery()
#3 /var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(345): OC\DB\Connection->executeQuery()
#4 /var/www/html/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(281): Doctrine\DBAL\Query\QueryBuilder->execute()
#5 /var/www/html/nextcloud/lib/private/AppConfig.php(411): OC\DB\QueryBuilder\QueryBuilder->execute()
#6 /var/www/html/nextcloud/lib/private/AppConfig.php(176): OC\AppConfig->loadConfigValues()
#7 /var/www/html/nextcloud/lib/private/AppConfig.php(367): OC\AppConfig->getApps()
#8 /var/www/html/nextcloud/lib/private/legacy/OC_App.php(983): OC\AppConfig->getValues()
#9 /var/www/html/nextcloud/lib/private/Server.php(713): OC_App::getAppVersions()
#10 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(162): OC\Server->OC{closure}()
#11 /var/www/html/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework
Utility{closure}()
#12 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(129): Pimple\Container->offsetGet()
#13 /var/www/html/nextcloud/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query()
#14 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(57): OC\ServerContainer->query()
#15 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(184): OC\AppFramework\Utility\SimpleContainer->get()
#16 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(162): OC\AppFramework\Utility\SimpleContainer->OC\AppFrame
work\Utility{closure}()
#17 /var/www/html/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework
Utility{closure}()
#18 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(129): Pimple\Container->offsetGet()
#19 /var/www/html/nextcloud/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query()
#20 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(57): OC\ServerContainer->query()
#21 /var/www/html/nextcloud/lib/private/Server.php(1105): OC\AppFramework\Utility\SimpleContainer->get()
#22 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(162): OC\Server->OC{closure}()
#23 /var/www/html/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework
Utility{closure}()
#24 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(129): Pimple\Container->offsetGet()
#25 /var/www/html/nextcloud/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query()
#26 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(57): OC\ServerContainer->query()
#27 /var/www/html/nextcloud/lib/private/Server.php(2082): OC\AppFramework\Utility\SimpleContainer->get()
#28 /var/www/html/nextcloud/lib/private/Files/View.php(122): OC\Server->getLockingProvider()
#29 /var/www/html/nextcloud/lib/private/Server.php(454): OC\Files\View->__construct()
#30 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(162): OC\Server->OC{closure}()
#31 /var/www/html/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework
Utility{closure}()
#32 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(129): Pimple\Container->offsetGet()
#33 /var/www/html/nextcloud/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query()
#34 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(57): OC\ServerContainer->query()
#35 /var/www/html/nextcloud/lib/private/Server.php(1445): OC\AppFramework\Utility\SimpleContainer->get()
#36 /var/www/html/nextcloud/lib/base.php(602): OC\Server->boot()
#37 /var/www/html/nextcloud/lib/base.php(1104): OC::init()
#38 /var/www/html/nextcloud/console.php(48): require_once(ā€˜/var/www/html/nā€¦ā€™)
#39 /var/www/html/nextcloud/occ(11): require_once(ā€˜/var/www/html/nā€¦ā€™)
#40 {main}
Maintenance mode is disabled

I have the same problem. When running the updater I get the same output as @solarPowerPlant.

Here is the relevant content of my Mariadb error.log:

> 2022-06-02  9:25:05 0 [Note] Recovering after a crash using tc.log
> 2022-06-02  9:25:05 0 [Note] Starting crash recovery...
> 2022-06-02  9:25:05 0 [Note] Crash recovery finished.
> 2022-06-02  9:25:05 0 [Note] Server socket created on IP: '127.0.0.1'.
> 2022-06-02  9:25:05 0 [Note] Reading of all Master_info entries succeeded
> 2022-06-02  9:25:05 0 [Note] Added new Master_info '' to hash table
> 2022-06-02  9:25:05 0 [Note] /usr/sbin/mysqld: ready for connections.
> Version: '10.3.34-MariaDB-0ubuntu0.20.04.1'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Ubuntu 20.04
> 2022-06-02  9:25:05 0 [Note] InnoDB: Buffer pool(s) load completed at 220602  9:25:05
> 2022-06-02  9:28:25 61 [Note] InnoDB: Ignoring strange row from mysql.innodb_index_stats WHERE database_name = 'nextcloud' AND table_name = 'oc_oauth2_clients' AND index_name = 'oauth2_client_id_idx' AND stat_name = 'n_diff_pfx02'; because stat_name is out of range, the index has 1 unique columns
> 2022-06-02 09:28:26 0x7f8f84376700  InnoDB: Assertion failure in file /build/mariadb-10.3-AwHSs6/mariadb-10.3-10.3.34/storage/innobase/dict/dict0mem.cc line 143
> InnoDB: Failing assertion: dict_tf2_is_valid(flags, flags2)
> InnoDB: We intentionally generate a memory trap.
> InnoDB: Submit a detailed bug report to https://jira.mariadb.org/
> InnoDB: If you get repeated assertion failures or crashes, even
> InnoDB: immediately after the mysqld startup, there may be
> InnoDB: corruption in the InnoDB tablespace. Please refer to
> InnoDB: https://mariadb.com/kb/en/library/innodb-recovery-modes/
> InnoDB: about forcing recovery.
> 220602  9:28:26 [ERROR] mysqld got signal 6 ;
> This could be because you hit a bug. It is also possible that this binary
> or one of the libraries it was linked against is corrupt, improperly built,
> or misconfigured. This error can also be caused by malfunctioning hardware.
> 
> To report this bug, see https://mariadb.com/kb/en/reporting-bugs
> 
> We will try our best to scrape up some info that will hopefully help
> diagnose the problem, but since we have already crashed, 
> something is definitely wrong and this may fail.
> 
> Server version: 10.3.34-MariaDB-0ubuntu0.20.04.1
> key_buffer_size=134217728
> read_buffer_size=131072
> max_used_connections=4
> max_threads=153
> thread_count=9
> It is possible that mysqld could use up to 
> key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 467428 K  bytes of memory
> Hope that's ok; if not, decrease some variables in the equation.
> 
> Thread pointer: 0x7f8f340015c8
> Attempting backtrace. You can use the following information to find out
> where mysqld died. If you see no messages after this, something went
> terribly wrong...
> stack_bottom = 0x7f8f84375dd8 thread_stack 0x49000
> /usr/sbin/mysqld(my_print_stacktrace+0x32)[0x564681897b92]
> /usr/sbin/mysqld(handle_fatal_signal+0x55d)[0x56468138d1bd]
> /lib/x86_64-linux-gnu/libpthread.so.0(+0x14420)[0x7f8f9bfe1420]
> /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7f8f9be1e00b]
> /lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7f8f9bdfd859]
> /usr/sbin/mysqld(+0x4ee4bd)[0x5646810a94bd]
> /usr/sbin/mysqld(+0x4ffa8f)[0x5646810baa8f]
> /usr/sbin/mysqld(+0x987a86)[0x564681542a86]
> /usr/sbin/mysqld(+0x98c70a)[0x56468154770a]
> /usr/sbin/mysqld(+0x6769a8)[0x5646812319a8]
> /usr/sbin/mysqld(_Z17mysql_alter_tableP3THDPK25st_mysql_const_lex_stringS3_P14HA_CREATE_INFOP10TABLE_LISTP10Alter_infojP8st_orderb+0x3720)[0x56468123c870]
> /usr/sbin/mysqld(_ZN19Sql_cmd_alter_table7executeEP3THD+0x2ba)[0x56468128f62a]
> /usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0xdc8)[0x56468119dd28]
> /usr/sbin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_statebb+0x1f3)[0x5646811a5053]
> /usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcjbb+0x1065)[0x5646811a7425]
> /usr/sbin/mysqld(_Z10do_commandP3THD+0x12d)[0x5646811a93dd]
> /usr/sbin/mysqld(_Z24do_handle_one_connectionP7CONNECT+0x1fa)[0x56468128c9ba]
> /usr/sbin/mysqld(handle_one_connection+0x3f)[0x56468128cb8f]
> /lib/x86_64-linux-gnu/libpthread.so.0(+0x8609)[0x7f8f9bfd5609]
> /lib/x86_64-linux-gnu/libc.so.6(clone+0x43)[0x7f8f9befa133]
> 
> Trying to get some variables.
> Some pointers may be invalid and cause the dump to abort.
> Query (0x7f8f3400fff0): ALTER TABLE oc_mounts ADD mount_provider_class VARCHAR(128) DEFAULT NULL
> 
> Connection ID (thread ID): 61
> Status: NOT_KILLED
> 
> Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on
> 
> The manual page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mysqld/ contains
> information that should help you find out what is causing the crash.
> Writing a core file...
> Working directory at /var/lib/mysql
> Resource Limits:
> Limit                     Soft Limit           Hard Limit           Units     
> Max cpu time              unlimited            unlimited            seconds   
> Max file size             unlimited            unlimited            bytes     
> Max data size             unlimited            unlimited            bytes     
> Max stack size            8388608              unlimited            bytes     
> Max core file size        0                    unlimited            bytes     
> Max resident set          unlimited            unlimited            bytes     
> Max processes             7626                 7626                 processes 
> Max open files            32768                32768                files     
> Max locked memory         65536                65536                bytes     
> Max address space         unlimited            unlimited            bytes     
> Max file locks            unlimited            unlimited            locks     
> Max pending signals       7626                 7626                 signals   
> Max msgqueue size         819200               819200               bytes     
> Max nice priority         0                    0                    
> Max realtime priority     0                    0                    
> Max realtime timeout      unlimited            unlimited            us        
> Core pattern: core
> 
> 2022-06-02  9:28:32 0 [Warning] The parameter innodb_file_format is deprecated and has no effect. It may be removed in future releases. See https://mariadb.com/kb/en/library/xtradbinnodb-file-format/
> 2022-06-02  9:28:32 0 [Note] InnoDB: Using Linux native AIO
> 2022-06-02  9:28:32 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
> 2022-06-02  9:28:32 0 [Note] InnoDB: Uses event mutexes
> 2022-06-02  9:28:32 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
> 2022-06-02  9:28:32 0 [Note] InnoDB: Number of pools: 1
> 2022-06-02  9:28:32 0 [Note] InnoDB: Using SSE2 crc32 instructions
> 2022-06-02  9:28:32 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
> 2022-06-02  9:28:32 0 [Note] InnoDB: Completed initialization of buffer pool
> 2022-06-02  9:28:32 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
> 2022-06-02  9:28:32 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=302577015045
> 2022-06-02  9:28:32 0 [Note] InnoDB: Starting final batch to recover 3 pages from redo log.
> 2022-06-02  9:28:32 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
> 2022-06-02  9:28:32 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
> 2022-06-02  9:28:32 0 [Note] InnoDB: Creating shared tablespace for temporary tables
> 2022-06-02  9:28:32 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
> 2022-06-02  9:28:32 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
> 2022-06-02  9:28:32 0 [Note] InnoDB: 10.3.34 started; log sequence number 302577015526; transaction id 1347040659
> 2022-06-02  9:28:32 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
> 2022-06-02  9:28:32 0 [Note] Plugin 'FEEDBACK' is disabled.
> 2022-06-02  9:28:32 0 [Note] Recovering after a crash using tc.log
> 2022-06-02  9:28:32 0 [Note] Starting crash recovery...
> 2022-06-02  9:28:32 0 [Note] Crash recovery finished.
> 2022-06-02  9:28:32 0 [Note] Server socket created on IP: '127.0.0.1'.
> 2022-06-02  9:28:33 0 [Note] Reading of all Master_info entries succeeded
> 2022-06-02  9:28:33 0 [Note] Added new Master_info '' to hash table
> 2022-06-02  9:28:33 0 [Note] /usr/sbin/mysqld: ready for connections.
> Version: '10.3.34-MariaDB-0ubuntu0.20.04.1'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Ubuntu 20.04
> 2022-06-02  9:28:33 0 [Note] InnoDB: Buffer pool(s) load completed at 220602  9:28:33

Had the same issue, and after putting related pieces together it seems that in my case MariaDB 10.3 was running out of memory. Running mysqlcheck in the optimize option seemed to have resolved the issue. You will get ā€œTable does not support optimize, doing recreate + analyze insteadā€ for each table it runs on which you can ignore (Informal message for InnoDB tables - just let it finish)

sudo mysqlcheck -o nextcloud

I had also gone back into my MariaDB configuration file and updated some of the memory values which hadnā€™t been touched since I first installed several years ago (not sure if this did anything):

key_buffer_size = 64K
max_allowed_packet = 16M
thread_stack = 299K
thread_cache_size = 256

This was the hint: https://help.nextcloud.com/t/solved-sqlstate-hy000-general-error-2006-mysql-server-has-gone-away/22680

5 Likes

I had the same issue and this resolved it for me.

Your answer came too late for me. I took the rather drastic measure of dumping and re-creating my whole db server. Update went through afterwards without any changes in my memory configuration.

EXACTLY what I needed to solve my issue! Thank you so very much!

Thank you very much motoxsghb!
sudo mysqlcheck -o solved the issue.

I had the same issue and this resolved it for me too. You saved me :slight_smile: Thank you so much!!!

hi all not related to the opening post but was wondering what systems people have who upgraded from NC23 to NC24?
Is it the case you need both Ubuntu 20.04 and php 8 ?

thanks

I am having the same error but not running MariaDB, running MySQL 8, and this listed solution didnā€™t work for me any additional suggestions?

No idea why this isnā€™t the first solution when you search, but this is definitely the best solution. Thanks!