NCP backup fails with error on mysql-dump - how to fix?

ncp

#1

hey there ncp-folks.

i have nc 1.5.1. installed (can’t update to 1.6.x but this might be a different problem) and wanted to do a backup manually…
it came up with the following error

[ nc-backup ]
check free space...
Maintenance mode enabled
backup database...
mysqldump: Error 1712: Index oc_cards_properties is corrupted when dumping table `oc_cards_properties` at row: 0
Abort...
Maintenance mode disabled
Maintenance mode already disabled

automatic backup seems to have stopped on feb, 6th (at least that’s the date i found the latest backup file)

this is my system info (received via ncp-web)

## System Info

‣ You should enable automount to use your plugged in USB drive

|NextCloudPi version|v1.5.1|
| --- | --- |
|NextCloudPi image|untagged|
|distribution|Raspbian GNU/Linux 9 \n \l|
|automount|no|
|USB devices|sda|
|datadir|/media/USBdrive/ncdata|
|data in SD|no|
|data filesystem|ext2/ext3|
|data disk usage|57G/916G|
|rootfs usage|3.0G/15G|
|swapfile|/var/swap|
|dbdir|/var/lib/mysql|
|Nextcloud check|ok|
|Nextcloud version|14.0.4.2|
|HTTPD service|up|
|PHP service|up|
|MariaDB service|up|
|Redis service|up|
|Postfix service|up|
|internet check|ok|
|port check 80|open|
|port check 443|open|
|IP|192.168.xxx.yyy|
|gateway|192.168.xxx.yyy|
|interface|eth0|
|certificates|you.wannaknow.tld|
|NAT loopback|no|
|uptime|44days|

help welcome. and if you’d need more infos pls let me know…
cheers and thanks in advance
jimmy


#2

well well well…

i just tried a reboot and of course system came back on. but after trying to turn maintenance mode back off i received the following messages

root@nextcloud:/var/www/nextcloud# sudo -u www-data php occ maintenance:mode --off
An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory in /var/www/nextcloud/lib/private/DB/Connection.php:64
Stack trace:
#0 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /var/www/nextcloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#6 /var/www/nextcloud/lib/private/DB/ConnectionFactory.php(152): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#7 /var/www/nextcloud/lib/private/Server.php(630): OC\DB\ConnectionFactory->getConnection('mysql', Array)
#8 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#9 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(117): Pimple\Container->offsetGet('OCP\\IDBConnecti...')
#10 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OCP\\IDBConnecti...')
#11 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(165): OC\ServerContainer->query('OCP\\IDBConnecti...')
#12 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#13 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(117): Pimple\Container->offsetGet('DatabaseConnect...')
#14 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('DatabaseConnect...')
#15 /var/www/nextcloud/lib/private/Server.php(1533): OC\ServerContainer->query('DatabaseConnect...')
#16 /var/www/nextcloud/lib/private/Server.php(352): OC\Server->getDatabaseConnection()
#17 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#18 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(117): Pimple\Container->offsetGet('OC\\Authenticati...')
#19 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OC\\Authenticati...')
#20 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(68): OC\ServerContainer->query('OC\\Authenticati...')
#21 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(98): OC\AppFramework\Utility\SimpleContainer->buildClass(Object(ReflectionClass))
#22 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(119): OC\AppFramework\Utility\SimpleContainer->resolve('OC\\Authenticati...')
#23 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OC\\Authenticati...')
#24 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(68): OC\ServerContainer->query('OC\\Authenticati...')
#25 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(98): OC\AppFramework\Utility\SimpleContainer->buildClass(Object(ReflectionClass))
#26 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(119): OC\AppFramework\Utility\SimpleContainer->resolve('OC\\Authenticati...')
#27 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OC\\Authenticati...')
#28 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(165): OC\ServerContainer->query('OC\\Authenticati...')
#29 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#30 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(117): Pimple\Container->offsetGet('OC\\Authenticati...')
#31 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OC\\Authenticati...')
#32 /var/www/nextcloud/lib/private/Server.php(364): OC\ServerContainer->query('OC\\Authenticati...')
#33 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#34 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(117): Pimple\Container->offsetGet('OCP\\IUserSessio...')
#35 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OCP\\IUserSessio...')
#36 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(165): OC\ServerContainer->query('OCP\\IUserSessio...')
#37 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#38 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(117): Pimple\Container->offsetGet('UserSession')
#39 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('UserSession')
#40 /var/www/nextcloud/lib/private/Server.php(1416): OC\ServerContainer->query('UserSession')
#41 /var/www/nextcloud/lib/private/Server.php(1024): OC\Server->getSession()
#42 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#43 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(117): Pimple\Container->offsetGet('OC\\Security\\CSR...')
#44 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OC\\Security\\CSR...')
#45 /var/www/nextcloud/lib/private/Server.php(1020): OC\ServerContainer->query('OC\\Security\\CSR...')
#46 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#47 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(117): Pimple\Container->offsetGet('CsrfTokenManage...')
#48 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('CsrfTokenManage...')
#49 /var/www/nextcloud/lib/private/Server.php(1879): OC\ServerContainer->query('CsrfTokenManage...')
#50 /var/www/nextcloud/lib/private/Server.php(816): OC\Server->getCsrfTokenManager()
#51 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#52 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(117): Pimple\Container->offsetGet('OCP\\IRequest')
#53 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OCP\\IRequest')
#54 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(165): OC\ServerContainer->query('OCP\\IRequest')
#55 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#56 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(117): Pimple\Container->offsetGet('Request')
#57 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('Request')
#58 /var/www/nextcloud/lib/private/Server.php(1283): OC\ServerContainer->query('Request')
#59 /var/www/nextcloud/lib/private/Server.php(454): OC\Server->getRequest()
#60 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#61 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(117): Pimple\Container->offsetGet('OCP\\L10N\\IFacto...')
#62 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OCP\\L10N\\IFacto...')
#63 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(165): OC\ServerContainer->query('OCP\\L10N\\IFacto...')
#64 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#65 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(117): Pimple\Container->offsetGet('L10NFactory')
#66 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('L10NFactory')
#67 /var/www/nextcloud/lib/private/Server.php(1469): OC\ServerContainer->query('L10NFactory')
#68 /var/www/nextcloud/lib/private/Server.php(1480): OC\Server->getL10NFactory()
#69 /var/www/nextcloud/lib/base.php(234): OC\Server->getL10N('lib')
#70 /var/www/nextcloud/lib/base.php(659): OC::checkConfig()
#71 /var/www/nextcloud/lib/base.php(1068): OC::init()
#72 /var/www/nextcloud/console.php(46): require_once('/var/www/nextcl...')
#73 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')

errrr… what happend?


#3

corrupted database… look at filesystem errors. Also you can do a hard drive test (nc-hdd-test)


#4

output:
[ nc-hdd-test ]

=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Enabled.

* Stats for sda

=== START OF INFORMATION SECTION ===
Model Family: Western Digital Elements / My Passport (USB, AF)
Device Model: WDC WD10JMVW-11AJGS4
Serial Number: WD-WXF1A96P9F4A
LU WWN Device Id: 5 0014ee 65c5cadf2
Firmware Version: 01.01A01
User Capacity: 1,000,204,886,016 bytes [1.00 TB]
Sector Sizes: 512 bytes logical, 4096 bytes physical
Rotation Rate: 5400 rpm
Device is: In smartctl database [for details use: -P show]
ATA Version is: ACS-2 (minor revision not indicated)
SATA Version is: SATA 3.0, 3.0 Gb/s (current: 3.0 Gb/s)
Local Time is: Mon Feb 11 16:09:04 2019 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status: (0x00) Offline data collection activity
was never started.
Auto Offline Data Collection: Disabled.
Self-test execution status: ( 0) The previous self-test routine completed
without error or no self-test has ever
been run.
Total time to complete Offline
data collection: (18300) seconds.
Offline data collection
capabilities: (0x7b) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
command.
Offline surface scan supported.
Self-test supported.
Conveyance Self-test supported.
Selective Self-test supported.
SMART capabilities: (0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: ( 2) minutes.
Extended self-test routine
recommended polling time: ( 205) minutes.
Conveyance self-test routine
recommended polling time: ( 5) minutes.
SCT capabilities: (0x7035) SCT Status supported.
SCT Feature Control supported.
SCT Data Table supported.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x002f 200 200 051 Pre-fail Always - 0
3 Spin_Up_Time 0x0027 131 129 021 Pre-fail Always - 4416
4 Start_Stop_Count 0x0032 100 100 000 Old_age Always - 219
5 Reallocated_Sector_Ct 0x0033 200 200 140 Pre-fail Always - 0
7 Seek_Error_Rate 0x002e 200 200 000 Old_age Always - 0
9 Power_On_Hours 0x0032 090 089 000 Old_age Always - 7985
10 Spin_Retry_Count 0x0032 100 100 000 Old_age Always - 0
11 Calibration_Retry_Count 0x0032 100 253 000 Old_age Always - 0
12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 32
192 Power-Off_Retract_Count 0x0032 200 200 000 Old_age Always - 9
193 Load_Cycle_Count 0x0032 001 001 000 Old_age Always - 616646
194 Temperature_Celsius 0x0022 119 103 000 Old_age Always - 28
196 Reallocated_Event_Count 0x0032 200 200 000 Old_age Always - 0
197 Current_Pending_Sector 0x0032 200 200 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0030 100 253 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x0032 200 200 000 Old_age Always - 0
200 Multi_Zone_Error_Rate 0x0008 200 200 000 Old_age Offline - 0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Short offline Completed without error 00% 7970 -
# 2 Extended offline Completed without error 00% 7950 -
# 3 Short offline Completed without error 00% 7946 -
# 4 Short offline Completed without error 00% 7922 -
# 5 Short offline Completed without error 00% 7898 -
# 6 Short offline Completed without error 00% 7874 -
# 7 Short offline Completed without error 00% 7850 -
# 8 Short offline Completed without error 00% 7826 -
# 9 Short offline Completed without error 00% 7802 -
#10 Extended offline Completed without error 00% 7783 -
#11 Short offline Completed without error 00% 7778 -
#12 Short offline Completed without error 00% 7754 -
#13 Short offline Completed without error 00% 7730 -
#14 Short offline Completed without error 00% 7706 -
#15 Short offline Completed without error 00% 7682 -
#16 Short offline Completed without error 00% 7658 -
#17 Short offline Completed without error 00% 7634 -
#18 Extended offline Completed without error 00% 7615 -
#19 Short offline Completed without error 00% 7611 -
#20 Short offline Completed without error 00% 7587 -
#21 Short offline Completed without error 00% 7563 -

SMART Selective self-test log data structure revision number 1
SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
1 0 0 Not_testing
2 0 0 Not_testing
3 0 0 Not_testing
4 0 0 Not_testing
5 0 0 Not_testing
Selective self-test flags (0x0):
After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

i think that’s the short test. it looks good, doesnt it?

how? where? could it be a dying sd-card? if yes - how to set up anew? with backups from feb, 6th? plus save all calendars and addresses in external files (which is possible) and then restore them on new sd-card?

anyways: thank you for your help so far… :slight_smile:


#5

so this is what i did…

new sd-card: formatted, gotten me the newest image from ownyourbits.com and burned it to sd
booted pi with new sd.
looged in via ssh
did some manual adjustments (like localisation etc)
ran ncp
did some adjustments there…
updated ncp
restored ncp-backup
restored ncbackup (from feb 6th)
upgraded nc to newest version 15.0.4 (had been 14.0.4. before)
and it seems to be workig. if everything is there i’d know by tomorrow. but it looks good at the very moment.

thanks for this great tool, @nachoparker


#6

I am glad the backups helped