Bug #108960 Copying mysql databases from /var/lib/mysql_old won't let mysql-server to start
Submitted: 1 Nov 2022 20:22 Modified: 2 Nov 2022 14:10
Reporter: aly shirali Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version: OS:Ubuntu
Assigned to: CPU Architecture:Any

[1 Nov 2022 20:22] aly shirali
Description:
After `mysql-server` on my `ubuntu 20.04` server crashed, I copied `/var/lib/mysql` to backup folder on the server. Now I tried to restore all databases by copying from backup path to `/var/lib/mysql` but after doing this it won't let `mysql-server` to start.

```
information that should help you find out what is causing the crash.
2022-11-01T20:12:19.497292Z 0 [System] [MY-013951] [Server] 2022-11-01T20:12:19Z UTC - mysqld got signal 6 ;
2022-11-01T20:12:19.497293Z 0 [System] [MY-013951] [Server] Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
2022-11-01T20:12:19.497294Z 0 [System] [MY-013951] [Server] BuildID[sha1]=42fffe844f4ae6ac576008e5df6b737ffd4d4eef
2022-11-01T20:12:19.497295Z 0 [System] [MY-013951] [Server] Thread pointer: 0x55866695e820
2022-11-01T20:12:19.497296Z 0 [System] [MY-013951] [Server] Attempting backtrace. You can use the following information to find out
2022-11-01T20:12:19.497297Z 0 [System] [MY-013951] [Server] where mysqld died. If you see no messages after this, something went
2022-11-01T20:12:19.497298Z 0 [System] [MY-013951] [Server] terribly wrong...
2022-11-01T20:12:19.497299Z 0 [System] [MY-013951] [Server] stack_bottom = 7f3f2e7cabe0 thread_stack 0x100000
2022-11-01T20:12:19.497300Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(my_print_stacktrace(unsigned char const*, unsigned long)+0x41) [0x558660d3af11]
2022-11-01T20:12:19.497301Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(print_fatal_signal(int)+0x39b) [0x55865fbcc97b]
2022-11-01T20:12:19.497302Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(my_server_abort()+0x76) [0x55865fbccac6]
2022-11-01T20:12:19.497303Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(my_abort()+0xe) [0x558660d34f3e]
2022-11-01T20:12:19.497304Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(ut_dbg_assertion_failed(char const*, char const*, unsigned long)+0x349) [0x558660fc7759]
2022-11-01T20:12:19.497305Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(+0x2520908) [0x558660f95908]
2022-11-01T20:12:19.497306Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(trx_undo_prev_version_build(unsigned char const*, mtr_t*, unsigned char const*, dict_index_t const*, unsigned long*, mem_block_info_t*, unsigned char**, mem_block_info_t*, dtuple_t const**, unsigned long, lob::undo_vers_t*)+0x698) [0x558660f95fe8]
2022-11-01T20:12:19.497307Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(row_vers_build_for_consistent_read(unsigned char const*, mtr_t*, dict_index_t*, unsigned long**, ReadView*, mem_block_info_t**, mem_block_info_t*, unsigned char**, dtuple_t const**, lob::undo_vers_t*)+0x2ac) [0x558660f467ac]
2022-11-01T20:12:19.497308Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(Row_sel_get_clust_rec_for_mysql::operator()(row_prebuilt_t*, dict_index_t*, unsigned char const*, que_thr_t*, unsigned char const**, unsigned long**, mem_block_info_t**, dtuple_t const**, mtr_t*, lob::undo_vers_t*)+0x776) [0x558660f26056]
2022-11-01T20:12:19.497309Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(row_search_mvcc(unsigned char*, page_cur_mode_t, row_prebuilt_t*, unsigned long, unsigned long)+0x2599) [0x558660f2d349]
2022-11-01T20:12:19.497310Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(ha_innobase::index_read(unsigned char*, unsigned char const*, unsigned int, ha_rkey_function)+0x341) [0x558660d96e51]
2022-11-01T20:12:19.497311Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(handler::index_read_idx_map(unsigned char*, unsigned int, unsigned char const*, unsigned long, ha_rkey_function)+0x131) [0x55865fce5901]
2022-11-01T20:12:19.497312Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(handler::ha_index_read_idx_map(unsigned char*, unsigned int, unsigned char const*, unsigned long, ha_rkey_function)+0x1ec) [0x55865fcde3ac]
2022-11-01T20:12:19.497313Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(dd::Raw_table::find_record(dd::Object_key const&, std::unique_ptr<dd::Raw_record, std::default_delete<dd::Raw_record> >&)+0x6b) [0x558660b4b2ab]
2022-11-01T20:12:19.497314Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(bool dd::cache::Storage_adapter::get<dd::Item_name_key, dd::Abstract_table>(THD*, dd::Item_name_key const&, enum_tx_isolation, bool, dd::Abstract_table const**)+0x281) [0x558660b39351]
2022-11-01T20:12:19.497315Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(dd::sync_meta_data(THD*)+0xa57) [0x558660abbfd7]
2022-11-01T20:12:19.497316Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(dd::bootstrap::restart(THD*)+0xfa) [0x558660abd93a]
2022-11-01T20:12:19.497317Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(+0x2292af1) [0x558660d07af1]
2022-11-01T20:12:19.497318Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(dd::upgrade_57::do_pre_checks_and_initialize_dd(THD*)+0xb38) [0x558660d0d9c8]
2022-11-01T20:12:19.497319Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(+0x121cfb6) [0x55865fc91fb6]
2022-11-01T20:12:19.497320Z 0 [System] [MY-013951] [Server] /usr/sbin/mysqld(+0x2839d7d) [0x5586612aed7d]
2022-11-01T20:12:19.497321Z 0 [System] [MY-013951] [Server] /lib/x86_64-linux-gnu/libpthread.so.0(+0x8609) [0x7f3f3d92a609]
2022-11-01T20:12:19.497322Z 0 [System] [MY-013951] [Server] /lib/x86_64-linux-gnu/libc.so.6(clone+0x43) [0x7f3f3d4fb133]
2022-11-01T20:12:19.497323Z 0 [System] [MY-013951] [Server] Trying to get some variables.
2022-11-01T20:12:19.497324Z 0 [System] [MY-013951] [Server] Some pointers may be invalid and cause the dump to abort.
2022-11-01T20:12:19.497325Z 0 [System] [MY-013951] [Server] Query (0): is an invalid pointer
2022-11-01T20:12:19.497326Z 0 [System] [MY-013951] [Server] Connection ID (thread ID): 1
2022-11-01T20:12:19.497327Z 0 [System] [MY-013951] [Server] Status: NOT_KILLED
2022-11-01T20:12:19.497328Z 0 [System] [MY-013951] [Server] The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
2022-11-01T20:12:19.497329Z 0 [System] [MY-013951] [Server] information that should help you find out what is causing the crash.
2022-11-01T20:12:20.428088Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31-0ubuntu0.20.04.1) starting as process 163519
2022-11-01T20:12:20.435161Z 0 [System] [MY-013951] [Server] A backtrace was processed and added to the main error-log in the appropriate format.
2022-11-01T20:12:20.446410Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-11-01T20:12:21.216911Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-11-01T20:12:21.364955Z 1 [Warning] [MY-013021] [InnoDB] A transaction id in a record of table `mysql`.`tables` is newer than the system-wide maximum.
2022-11-01T20:12:21.365075Z 1 [Warning] [MY-013021] [InnoDB] A transaction id in a record of table `mysql`.`tables` is newer than the system-wide maximum.
2022-11-01T20:12:21.365626Z 1 [Warning] [MY-013021] [InnoDB] A transaction id in a record of table `mysql`.`tables` is newer than the system-wide maximum.
2022-11-01T20:12:21.365679Z 1 [Warning] [MY-013021] [InnoDB] A transaction id in a record of table `mysql`.`tables` is newer than the system-wide maximum.
2022-11-01T20:12:21.366345Z 1 [ERROR] [MY-013183] [InnoDB] Assertion failure: trx0rec.ic:92:next_undo_offset > undo_offset thread 140550543333120
```

How to repeat:
backup files by copying to backup folder and purge mysql-server and reinstall it the restore backup files.
[2 Nov 2022 14:10] MySQL Verification Team
Hi Mr. shirali,

Thank you for your bug report.

However, we can not repeat it.

You have not indicated whether you used our latest binary , which is 8.0.31.

More important, you can not copy datadir from one to another and hope that it will work.

There are special commands for copying and cloning, which are described in our Reference Manual.

Not a bug.