DB Conversion in unsecure state as SSH pipe was broken

Hi,

how can I continue - or see completion of - a started DB Conversion (from SQLite to MariaDB)?

The conversion was started successfully, but in the middle, the SSH pipe broke.
I don’t see any log entry (where) and can’t restart the same command as the DB already exists.

Command used was:
sudo -u apache /usr/bin/php occ db:convert-type --all-apps mysql nextclouduser 127.0.0.1 nextcloud

Output until the end of the SSH session:

Creating schema in new database
The following tables will not be converted:
oc_privatedata
Continue with the conversion (y/n)? [n] y
oc_accounts
2/2 [============================] 100%oc_activity
chunked query, 28 chunks
27170/27170 [============================] 100%oc_activity_mq
0 [>---------------------------]oc_addressbookchanges
22/22 [============================] 100%oc_addressbooks
2/2 [============================] 100%oc_appconfig
165/165 [============================] 100%oc_authtoken
101/101 [============================] 100%oc_bruteforce_attempts
378/378 [============================] 100%oc_calendar_invitations
0 [>---------------------------]oc_calendar_reminders
0 [>---------------------------]oc_calendar_resources
0 [>---------------------------]oc_calendar_resources_md
0 [>---------------------------]oc_calendar_rooms
0 [>---------------------------]oc_calendar_rooms_md
0 [>---------------------------]oc_calendarchanges
0 [>---------------------------]oc_calendarobjects
0 [>---------------------------]oc_calendarobjects_props
0 [>---------------------------]oc_calendars
2/2 [============================] 100%oc_calendarsubscriptions
0 [>---------------------------]oc_cards
2/2 [============================] 100%oc_cards_properties
8/8 [============================] 100%oc_collres_accesscache
0 [>---------------------------]oc_collres_collections
0 [>---------------------------]oc_collres_resources
0 [>---------------------------]oc_comments
0 [>---------------------------]oc_comments_read_markers
0 [>---------------------------]oc_credentials
0 [>---------------------------]oc_dav_cal_proxy
0 [>---------------------------]oc_dav_shares
0 [>---------------------------]oc_direct_edit
0 [>---------------------------]oc_directlink
0 [>---------------------------]oc_federated_reshares
0 [>---------------------------]oc_file_locks
chunked query, 125 chunks
124173/124173 [============================] 100%oc_filecache
chunked query, 771 chunks
48500/770656 [=>--------------------------] 6%client_loop: send disconnect: Broken pipe

This is where it stopped.
What can I do?

Thanks upfront!

Nextcloud version: 19.0.2.2
Operating system and version: CentOS 7.8
Apache or nginx version: Apache/2.4.6 (CentOS)
PHP version: PHP 7.4.9

Is this the first time you’ve seen this error? (Y/N) : Y

Steps to replicate it:

  1. Upgrade to 19.0.2.2
  2. Start db:convert-type command as above
  3. SSH pipe breaks while waiting for result

Just for future reference, it would be a good idea to run tasks like that with byobu or screen when using SSH. If the session disconnects without exiting, it continues to run in the background and can be reconnected.

It’s likely your DB conversion was terminated along with your SSH session.

1 Like

You can also use “tmux” instead of “screen”. Use

tmux attach || tmux new

Back to your problem.
Perhaps you can drop the database and execute the command again.

https://mariadb.com/kb/en/drop-database/

1 Like

Thank you both!
I have now created a new table and started the conversion again with a longer SSH timeout.
If that also fails, I’ll look into screen, tmux and byobu!

tmux:
apt-get install tmux

Start (i use the command in /usr/local/bin/t / chmod 755 /usr/local/bin/t):

tmux attach || tmux new

Start your db-command in the tmux-session.

You can now detach from session if you like:
Detach (not stop) “tmux” with “ctrl-b d” or close ssh-terminal.

Re-attach:
ssh to server and again:
tmux attach || tmux new

Exit “tmux” with “exit”.

Test it with a program that never stops like “top”.

I recommend byobu personally (it uses either screen or tmux on the backend). It gives you a nice ticker at the bottom with system info. Install on the server:

apt install byobu
byobu-enable

Then log out and back in. If your SSH drops, it will hold your session open and connect you back to it automatically next time you connect. Even with multiple tabbed consoles open.

Hi, thank you guys again!
I have really dropped the database, installed byobu - as suggested by KarlF12 and then re-done the conversion successfully!
Works perfectly and I finally am down to 2 minor comments / warnings in the NextCloud Admin panel

Best regards!