[Solved] Problem with mariadb and nextcloud

Hi.
After a power failure i face a problem with nextcloud running.
I couldn’t found or understand what the problem is so i deside to try install owncloud to see if could be installed and during the installation of owncloud this message comes …

 
	 DietPi-Software: G_AGUG                                                                  
     │  - Exit code: 100                                                                        
     │  - DietPi version: v6.18.14 (Fourdee/master) | HW_MODEL:11 | HW_ARCH:2 | DISTRO:4        
     │  - Image creator: DietPi Core Team                                                       
     │  - Pre-image: Meveric                                                                    
     │                                                                                          
     │ Log file contents:                                                                       
     │ Reading package lists...                                                                 
     │ Building dependency tree...                                                              
     │ Reading state information...                                                             
     │ Calculating upgrade...                                                                   
     │ 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.                           
     │ 2 not fully installed or removed.                                                        
     │ After this operation, 0 B of additional disk space will be used.                         
     │ Setting up mariadb-server-10.1 (10.1.37-0+deb9u1) ...^M 
	 
	 
	 /var/lib/dpkg/info/mariadb-server-10.1.postinst: line 18: 23541 Done                     
     │ echo "$password_column_fix_query"^M                                                      
     │      23542 Aborted                 | $MYSQL_BOOTSTRAP 2>&1^M                             
     │      23543                       | $ERR_LOGGER^M                                         
     │ dpkg: error processing package mariadb-server-10.1 (--configure):^M                      
     │  subprocess installed post-installation script returned error exit status 134^M          
     │ dpkg: dependency problems prevent configuration of mariadb-server:^M                     
     │  mariadb-server depends on mariadb-server-10.1 (>= 10.1.37-0+deb9u1); however:^M         
     │   Package mariadb-server-10.1 is not configured yet.^M                                   
     │ ^M                                                                                       
     │ dpkg: error processing package mariadb-server (--configure):^M                           
     │  dependency problems - leaving unconfigured^M                                            
     │ Errors were encountered while processing:^M                                              
     │  mariadb-server-10.1^M                                                                   
     │  mariadb-server^M  
	 
	 
subprocess installed post-installation script returned error exit status 134^M          
     │ dpkg: dependency problems prevent configuration of mariadb-server:^M                     
     │  mariadb-server depends on mariadb-server-10.1 (>= 10.1.37-0+deb9u1); however:^M         
     │   Package mariadb-server-10.1 is not configured yet.^M                                   
     │ ^M                                                                                       
     │ dpkg: error processing package mariadb-server (--configure):^M                           
     │  dependency problems - leaving unconfigured^M                                            
     │ Errors were encountered while processing:^M                                              
     │  mariadb-server-10.1^M                                                                   
     │  mariadb-server^M                                                                        
     │ E: Sub-process /usr/bin/dpkg returned an error code (1)                                  
     │                                                                                          
     │                                                                                          
     │                                                                                          
     │ Unable to continue, DietPi-Software will now terminate.

I run nextcloud pihole and ovpn on odroid xu4.This is third time it happens.Hope can be a solution.
Thank you.

satfoxy
Thanks for your report.

Did you paste the error from the first pop-up or did you retry once? I guess you hit retry at least once, otherwise there wouldn’t be “0 upgraded, 0 newly installed” in the APT error output.

Okay, since this is a MariaDB issue, Nextcloud and ownCloud will both fail for the same reason. Since you already used Nextcloud, I suggest you stay with it. Revert the done ownCloud install steps first to clean up:

rm -R /var/www/owncloud

Do you have a Nextcloud database backup? I can imagine the following happened:

  • Due to your power loss, the database got corrupted. Very common if power loss occurred while something is writing to the database.
  • With corrupted database, Nextcloud will not work, which is what you found.
  • The ownCloud install attempt triggered the MariaDB APT package to upgrade.
  • The APT upgrade failed for the same reason: Corrupted database

I suggest some steps below, but those might fail, depending on the kind of database corruption:

Since the new binaries are already in place, but the databases might not yet have been upgraded, please try to do that manually:

mysql_upgrade

If you have no database backup, please try to create one:

mysqldump -A > /mnt/dietpi_userdata/mariadb_backup.sql

Next check for database errors:

mysqlcheck -A

If errors show up, try repairing them:

mysqlrepair -A

If really nothing of the above works, there is no easy way to recreate the database. Perhaps it’s possible to identify the corrupted table and remove it manually. But this might lead to follow-up errors, if index and tables do not match anymore. Possible fixes, if any, depend on the output of the above.

If you have a backup in place that is not too old, so lost data changes can be restored without too much effort (or backup creation above worked well), then you could try the following:

You could try to purge MariaDB and reinstall:

apt-get purge mariadb-server-10.1 # Check carefully if some dependencies (besides MariaDB meta packages) would be removed, since we don't want that!
dietpi-software reinstall 88

Then recover the database backup:

mariadb < /path/to/mariadb_backup.sql
mysql_upgrade # Failsafe

Long story short:

  • database corruptions are nasty and you are never safe from them.
  • So regularly do a full database backup, e.g. I create one every night via cron job
  • I hope going through the steps above carefully will allow you to resolve it without data loss.

Thanks alot for the replay.I have reinstaled everything from the beggining but I will keep in mind the post for future needs.
Thanks again.