Nextcloud 17.0.2 upgrade with a database issue

Hey guys, I have been using Nextcloud on Ubuntu for quite a while. I have had few issues, but this time when I went to do the upgrade, I am getting a database error. I have scoured the boards looking for anything that I could use, but I have not been successful.

Here is the error that I get:

When upgrade run from the CLI
Doctrine\DBAL\Exception\DriverException: An exception occurred while executing ‘SELECT id FROM oc_jobs WHERE (class = ?) AND (argument = ?) LIMIT 1’ with params [“OC\Preview\BackgroundCleanupJob”, “null”]:

In the browser:
Doctrine\DBAL\Exception\DriverException: An exception occurred while executing ‘SELECT id FROM oc_jobs WHERE (class = ?) AND (argument = ?) LIMIT 1’ with params [“OC\Preview\BackgroundCleanupJob”, “null”]: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

Repair warning: Unable to clear the frontend cache

I have made sure that the MariaDB was in fact online and connected, but the error persists.

Any help would be greatly appreciated!!

Brad

Hey Brad,

this is nearly equal (I think) to my error updating from Version 15 to 16.0.7:
Doctrine\DBAL\Exception\NotNullConstraintViolationException: An exception occurred while executing ‘INSERT INTO oc_jobs (class, argument, last_run, last_checked) VALUES(?, ?, ?, ?)’ with params [“OCA\DAV\BackgroundJob\RegisterRegenerateBirthdayCalendars”, “null”, 0, 1577979126]: SQLSTATE[HY000]: General error: 1364 Field ‘id’ doesn’t have a default value

Actually I have no solution how to fix.

Maybe this helps: https://docs.nextcloud.com/server/17/admin_manual/configuration_database/linux_database_configuration.html#db-troubleshooting-label

That is a different error. I am sorry, I can’t help with this one.

@Liebling65
I think your database table oc_jobs provides no AUTO_INCREMENT value for the column id.

Edit: But it could be also a result of using MySQL STRICT mode, which checks the column DEFAULT value.

2 Likes

Thanks guys, I will take a look at the link @Bernie_O but I won;t have a chance until tomorrow.

@Liebling65 How do you check if AUTO_INCREMENT is on the table?

Thanks

@Bernie_O That link was unfortunately not helpful. Do you have any other suggestions?

After looking at the error, it almost looks like one of the database maintenance jobs didn’t run BackgroundCleanupjob. Is there a way to run that manually?

Does anyone have any ideas? I can’t seem to find anything out there.

I corrected the issue with a workaround. I never figured out what caused the issue, but moved the config.php to a backup and recreated the INSTALL_NOW file in the config directory. Then I hit the web interface and I was able to get the server up and running by adding the database information.

I thought that would still fail as it was a DB error, but apparently not…

In either case, if this happens to anyone, this should work for you!

Brad

@sunstar:
Can you please describe more detailed what exactly you have done?

I`m running nextcloud on a shared webspace and with every single update I have massive DB errors, which could only be fixed by repairing all tables in PhpMyAdmin, waiting for the next error, repairing all tables in PhpMyAdmin, waiting, and so on. This took endless time…

Sure, I went to the nextcloud install directory, in my case /var/www/nextcloud and then I renamed the config.php file to something else and I restarted the apache service. Then I went to the web interface, and I was prompted for all the configuration settings/parameters (DB name, Admin name, etc). I used the same DB but I had to create a new admin account (The other still exists and you can clean it up after), then the server ran through the config and it came back up.

Then I disabled the new admin account that I had created.

This didn’t address the initial DB issues I was having, but it did workaround them, and correct any configuration issue that had existed.

Hope this helps!!