Save a corrupt Nextcloud install?

NextCloud version: 20.0.8
System: Unraid Server with Nginx

I was running NextCloud on my Unraid for some time and its been working great. However I had a bad Cache drive that was causeing some problems in my server. I swapped out the old SSD drive for a new and I could see when I copied over that it was a few Nextcloud files that were corrupted and could not move.

I am not sure how severe this might be. Currently the frontend of nextcloud shows:

Internal Server Error
The server encountered an internal error and was unable to complete your request.

The nginx error log says:

2021/03/03 13:54:19 [error] 393#393: *30057 upstream timed out (110: Operation timed out) while reading response header from upstream, client: 81.244.81.175, server: _, request: "GET /ocs/v2.php/apps/spreed/api/v1/chat/jb69q3rq?lookIntoFuture=1&lastKnownMessageId=269&includeLastKnown=0 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "nextcloud.wnmedia.se"
2021/03/04 12:37:26 [crit] 387#387: *1 SSL_read() failed (SSL: error:14191044:SSL routines:tls1_enc:internal error) while processing HTTP/2 connection, client: 192.168.1.117, server: 0.0.0.0:443
2021/03/04 12:37:26 [crit] 388#388: *2 SSL_read() failed (SSL: error:14191044:SSL routines:tls1_enc:internal error) while processing HTTP/2 connection, client: 192.168.1.117, server: 0.0.0.0:443
2021/03/04 12:37:26 [crit] 387#387: *4 SSL_read() failed (SSL: error:14191044:SSL routines:tls1_enc:internal error) while processing HTTP/2 connection, client: 192.168.1.117, server: 0.0.0.0:443
2021/03/04 12:37:33 [crit] 387#387: *5 SSL_read() failed (SSL: error:14191044:SSL routines:tls1_enc:internal error) while processing HTTP/2 connection, client: 192.168.1.117, server: 0.0.0.0:443
2021/03/04 12:37:33 [crit] 387#387: *6 SSL_read() failed (SSL: error:14191044:SSL routines:tls1_enc:internal error) while processing HTTP/2 connection, client: 192.168.1.117, server: 0.0.0.0:443
2021/03/04 12:45:22 [crit] 386#386: *11 SSL_read() failed (SSL: error:14191044:SSL routines:tls1_enc:internal error) while processing HTTP/2 connection, client: 192.168.1.117, server: 0.0.0.0:443
2021/03/04 12:45:22 [crit] 386#386: *12 SSL_read() failed (SSL: error:14191044:SSL routines:tls1_enc:internal error) while processing HTTP/2 connection, client: 192.168.1.117, server: 0.0.0.0:443
2021/03/04 12:50:18 [crit] 386#386: *34 SSL_read() failed (SSL: error:14191044:SSL routines:tls1_enc:internal error) while processing HTTP/2 connection, client: 192.168.1.117, server: 0.0.0.0:443
2021/03/04 12:50:18 [crit] 386#386: *35 SSL_read() failed (SSL: error:14191044:SSL routines:tls1_enc:internal error) while processing HTTP/2 connection, client: 192.168.1.117, server: 0.0.0.0:443
2021/03/04 12:53:33 [crit] 386#386: *51 SSL_read() failed (SSL: error:14191044:SSL routines:tls1_enc:internal error) while processing HTTP/2 connection, client: 192.168.1.117, server: 0.0.0.0:443
2021/03/04 12:53:33 [crit] 386#386: *52 SSL_read() failed (SSL: error:14191044:SSL routines:tls1_enc:internal error) while processing HTTP/2 connection, client: 192.168.1.117, server: 0.0.0.0:443
2021/03/04 13:03:24 [crit] 387#387: *30 SSL_read() failed (SSL: error:14191044:SSL routines:tls1_enc:internal error) while processing HTTP/2 connection, client: 192.168.1.117, server: 0.0.0.0:443
2021/03/04 13:03:24 [crit] 387#387: *31 SSL_read() failed (SSL: error:14191044:SSL routines:tls1_enc:internal error) while processing HTTP/2 connection, client: 192.168.1.117, server: 0.0.0.0:443

Also the docker terminal for NextCloud throws this:

Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2006] MySQL server has gone away in /config/www/nextcloud/lib/private/DB/Connection.php:72
Stack trace:
#0 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1449): OC\DB\Connection->connect()
#1 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(892): Doctrine\DBAL\Connection->getWrappedConnection()
#2 /config/www/nextcloud/lib/private/DB/Connection.php(202): Doctrine\DBAL\Connection->executeQuery()
#3 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php(206): OC\DB\Connection->executeQuery()
#4 /config/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(217): Doctrine\DBAL\Query\QueryBuilder->execute()
#5 /config/www/nextcloud/lib/private/AppConfig.php(345): OC\DB\QueryBuilder\QueryBuilder->execute()
#6 /config/www/nextcloud/lib/private/AppConfig.php(110): OC\AppConfig->loadConfigValues()
#7 /config/www/nextcloud/lib/private/AppConfig.php(301): OC\AppConfig->getApps()
#8 /config/www/nextcloud/lib/private/legacy/OC_App.php(949): OC\AppConfig->getValues()
#9 /config/www/nextcloud/lib/private/Server.php(668): OC_App::getAppVersions()
#10 /config/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\Server->OC{closure}()
#11 /config/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}()
#12 /config/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet()
#13 /config/www/nextcloud/lib/private/ServerContainer.php(156): OC\AppFramework\Utility\SimpleContainer->query()
#14 /config/www/nextcloud/lib/private/Server.php(1677): OC\ServerContainer->query()
#15 /config/www/nextcloud/lib/private/Server.php(1017): OC\Server->getMemCacheFactory()
#16 /config/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\Server->OC{closure}()
#17 /config/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}()
#18 /config/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet()
#19 /config/www/nextcloud/lib/private/ServerContainer.php(156): OC\AppFramework\Utility\SimpleContainer->query()
#20 /config/www/nextcloud/lib/private/Server.php(1977): OC\ServerContainer->query()
#21 /config/www/nextcloud/lib/private/Files/View.php(118): OC\Server->getLockingProvider()
#22 /config/www/nextcloud/lib/private/Server.php(395): OC\Files\View->__construct()
#23 /config/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\Server->OC{closure}()
#24 /config/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}()
#25 /config/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet()
#26 /config/www/nextcloud/lib/private/ServerContainer.php(156): OC\AppFramework\Utility\SimpleContainer->query()
#27 /config/www/nextcloud/lib/private/Server.php(1324): OC\ServerContainer->query()
#28 /config/www/nextcloud/lib/base.php(595): OC\Server->boot()
#29 /config/www/nextcloud/lib/base.php(1091): OC::init()
#30 /config/www/nextcloud/console.php(49): require_once(’/config/www/nex…’)
#31 /config/www/nextcloud/occ(11): require_once(’/config/www/nex…’)

I wonder, is there any kind of “Repair” script I can start? Something where it checks missing things and might try to repair it?

What would be a good test to run to try and get this sorted out? Can I remove or reset some settings and test?

If there is not easy way to get this install to work again - is there any guide I can follow on how to backup what I got here - and then install a new NextCloud install and move the files and settings back over again?

From the nginx logs, I’d guess there is a general error with the SSL connections (did you change the certificates?). Perhaps increase log level for more information.

For the Nextcloud part it’s quite obvious that it can’t connect to the database… there is no repair script, you just have to start the database server…