Upgrade 19.0.13 --> 20.0.11 - Error

Hello,

I was starting an upgrade from version 19.0.13 to version 20.0.11 in the command line. It worked without any problems. When I want to complete the upgrade process in the browser I get the following error message:

Doctrine\DBAL\Exception\NotNullConstraintViolationException: An exception occurred while executing ‘INSERT INTO oc_bookmarks_folders (user_id, title) VALUES(?, ?)’ with params [null, “”]: SQLSTATE[23000]: Integrity constraint violation: 1048 Column ‘user_id’ cannot be null

Das Update ist fehlgeschlagen. Bitte melde dieses Problem an die Nextcloud Community.

Info:
Nextcloud is installed on a Raspberry Pi 3B with the NextcoudPi-Image.

There are complications with the bookmarks app. Any idea how to solve this issue?
Many thanks in advance!

Try disabling bookmarks–app…

And next time you might wanna use ncp built-in updater?

How can I disable the bookmarks-app in the console?

I made the past updates always via the console, because when updating via the ncp built-in updater the updates were often canceled.

In the meantime I was able to solve the problem.

If I now want to activate the bookmarks app in the browser, I get the same error message. How can the bookmarks app used in Version 20?

If your model Pi is 32 bits, the news app has been reported to work only on 64 bits. If this is the case for the bookmarks app, it should be reported on Github, to ask for 32 bits compatibility.

To check run uname -a or lscpu: armv7 (or lower) is 32 bits , armv8 is 64 bits

You should have reported the issue, with output of ncp.log.
In my experience the ncp updater works best, it even reverts when an update breaks the install. Ncp updater makes use of the NC’s native cli updater afaik.

The used architecture ist armv7

@marcelklehr In this case are there known issuses with the bookmarks app?
Does the bookmarks app not work on Raspberry Pi 3B+ anymore?
I had to deactivate the bookmarks app to finish the update process of nextcloud. In Nextcloud 20.0.11 it isn’t possible to re-activate the bookmarks app. Also a new installation of the bookmarks app brings no solution. In both cases the following error occurs:

An exception occurred while executing ‘INSERT INTO oc_bookmarks_folders (user_id, title) VALUES(?, ?)’ with params [null, “”]: SQLSTATE[23000]: Integrity constraint violation: 1048 Column ‘user_id’ cannot be null

Any idea?

Thank you for reporting this! It’s unlikely to be a problem with processor architecture. Can you post the whole backtrace, perhaps?

What do you mean by “whole backtrace”? Where do I get this from?
When updating and activating the bookmarks app, I got the error message as described in my first post. On the advice of @JimmyKater, I disabled the bookmarks app to complete the update process.
But when I try to activate the bookmarks app again, I get almost the same error message (see my previous post).
What other information do you need?

The backtrace of an error is the locations in the code that were being executed before the error happened. Usually, long file paths with line numbers at the end :wink: :heart:

Doctrine\DBAL\Exception\NotNullConstraintViolationException: An exception occurred while executing 'INSERT INTO `oc_bookmarks_folders` (`user_id`, `title`) VALUES(?, ?)' with params [null, ""]: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'user_id' cannot be null

    /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php - line 169:

    Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException("An exceptio ... l", Doctrine\DBA ... ]})

    /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php - line 149:

    Doctrine\DBAL\DBALException::wrapException(Doctrine\DBA ... {}, Doctrine\DBA ... ]}, "An exceptio ... l")

    /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php - line 1071:

    Doctrine\DBAL\DBALException::driverExceptionDuringQuery(Doctrine\DBA ... {}, Doctrine\DBA ... ]}, "INSERT INTO ... )", { 1: null,2: ""})

    /var/www/nextcloud/lib/private/DB/Connection.php - line 222:

    Doctrine\DBAL\Connection->executeUpdate("INSERT INTO ... )", [ null,""], [ 2,2])

    /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php - line 209:

    OC\DB\Connection->executeUpdate("INSERT INTO ... )", { dcValue1: null,dcValue2: ""}, { dcValue1: 2,dcValue2: 2})

    /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php - line 248:

    Doctrine\DBAL\Query\QueryBuilder->execute()

    /var/www/nextcloud/apps/bookmarks/lib/Migration/OrphanedTreeItemsRepairStep.php - line 181:

    OC\DB\QueryBuilder\QueryBuilder->execute()

    /var/www/nextcloud/apps/bookmarks/lib/Migration/OrphanedTreeItemsRepairStep.php - line 112:

    OCA\Bookmarks\Migration\OrphanedTreeItemsRepairStep->ensureRootFolder(null)

    /var/www/nextcloud/lib/private/Repair.php - line 113:

    OCA\Bookmarks\Migration\OrphanedTreeItemsRepairStep->run(OC\Repair {})

    /var/www/nextcloud/lib/private/legacy/OC_App.php - line 1050:

    OC\Repair->run()

    /var/www/nextcloud/lib/private/Installer.php - line 160:

    OC_App::executeRepairSteps("bookmarks", [ "OCA\\Book ... "])

    /var/www/nextcloud/apps/settings/lib/Controller/AppSettingsController.php - line 448:

    OC\Installer->installApp("bookmarks")

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 169:

    OCA\Settings\Controller\AppSettingsController->enableApps([ "bookmarks"], [])

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 100:

    OC\AppFramework\Http\Dispatcher->executeController(OCA\Settings ... {}, "enableApps")

    /var/www/nextcloud/lib/private/AppFramework/App.php - line 152:

    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Settings ... {}, "enableApps")

    /var/www/nextcloud/lib/private/Route/Router.php - line 309:

    OC\AppFramework\App::main("OCA\\Settin ... r", "enableApps", OC\AppFramew ... {}, { _route: "s ... "})

    /var/www/nextcloud/lib/base.php - line 1008:

    OC\Route\Router->match("/settings/apps/enable")

    /var/www/nextcloud/index.php - line 37:

    OC::handleRequest()

Verursacht durchDoctrine\DBAL\Driver\PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'user_id' cannot be null

    /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php - line 1062:

    Doctrine\DBAL\Driver\PDOStatement->execute()

    /var/www/nextcloud/lib/private/DB/Connection.php - line 222:

    Doctrine\DBAL\Connection->executeUpdate("INSERT INTO ... )", [ null,""], [ 2,2])

    /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php - line 209:

    OC\DB\Connection->executeUpdate("INSERT INTO ... )", { dcValue1: null,dcValue2: ""}, { dcValue1: 2,dcValue2: 2})

    /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php - line 248:

    Doctrine\DBAL\Query\QueryBuilder->execute()

    /var/www/nextcloud/apps/bookmarks/lib/Migration/OrphanedTreeItemsRepairStep.php - line 181:

    OC\DB\QueryBuilder\QueryBuilder->execute()

    /var/www/nextcloud/apps/bookmarks/lib/Migration/OrphanedTreeItemsRepairStep.php - line 112:

    OCA\Bookmarks\Migration\OrphanedTreeItemsRepairStep->ensureRootFolder(null)

    /var/www/nextcloud/lib/private/Repair.php - line 113:

    OCA\Bookmarks\Migration\OrphanedTreeItemsRepairStep->run(OC\Repair {})

    /var/www/nextcloud/lib/private/legacy/OC_App.php - line 1050:

    OC\Repair->run()

    /var/www/nextcloud/lib/private/Installer.php - line 160:

    OC_App::executeRepairSteps("bookmarks", [ "OCA\\Book ... "])

    /var/www/nextcloud/apps/settings/lib/Controller/AppSettingsController.php - line 448:

    OC\Installer->installApp("bookmarks")

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 169:

    OCA\Settings\Controller\AppSettingsController->enableApps([ "bookmarks"], [])

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 100:

    OC\AppFramework\Http\Dispatcher->executeController(OCA\Settings ... {}, "enableApps")

    /var/www/nextcloud/lib/private/AppFramework/App.php - line 152:

    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Settings ... {}, "enableApps")

    /var/www/nextcloud/lib/private/Route/Router.php - line 309:

    OC\AppFramework\App::main("OCA\\Settin ... r", "enableApps", OC\AppFramew ... {}, { _route: "s ... "})

    /var/www/nextcloud/lib/base.php - line 1008:

    OC\Route\Router->match("/settings/apps/enable")

    /var/www/nextcloud/index.php - line 37:

    OC::handleRequest()

Verursacht durchPDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'user_id' cannot be null

    /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php - line 127:

    PDOStatement->execute(null)

    /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php - line 1062:

    Doctrine\DBAL\Driver\PDOStatement->execute()

    /var/www/nextcloud/lib/private/DB/Connection.php - line 222:

    Doctrine\DBAL\Connection->executeUpdate("INSERT INTO ... )", [ null,""], [ 2,2])

    /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php - line 209:

    OC\DB\Connection->executeUpdate("INSERT INTO ... )", { dcValue1: null,dcValue2: ""}, { dcValue1: 2,dcValue2: 2})

    /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php - line 248:

    Doctrine\DBAL\Query\QueryBuilder->execute()

    /var/www/nextcloud/apps/bookmarks/lib/Migration/OrphanedTreeItemsRepairStep.php - line 181:

    OC\DB\QueryBuilder\QueryBuilder->execute()

    /var/www/nextcloud/apps/bookmarks/lib/Migration/OrphanedTreeItemsRepairStep.php - line 112:

    OCA\Bookmarks\Migration\OrphanedTreeItemsRepairStep->ensureRootFolder(null)

    /var/www/nextcloud/lib/private/Repair.php - line 113:

    OCA\Bookmarks\Migration\OrphanedTreeItemsRepairStep->run(OC\Repair {})

    /var/www/nextcloud/lib/private/legacy/OC_App.php - line 1050:

    OC\Repair->run()

    /var/www/nextcloud/lib/private/Installer.php - line 160:

    OC_App::executeRepairSteps("bookmarks", [ "OCA\\Book ... "])

    /var/www/nextcloud/apps/settings/lib/Controller/AppSettingsController.php - line 448:

    OC\Installer->installApp("bookmarks")

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 169:

    OCA\Settings\Controller\AppSettingsController->enableApps([ "bookmarks"], [])

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 100:

    OC\AppFramework\Http\Dispatcher->executeController(OCA\Settings ... {}, "enableApps")

    /var/www/nextcloud/lib/private/AppFramework/App.php - line 152:

    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Settings ... {}, "enableApps")

    /var/www/nextcloud/lib/private/Route/Router.php - line 309:

    OC\AppFramework\App::main("OCA\\Settin ... r", "enableApps", OC\AppFramew ... {}, { _route: "s ... "})

    /var/www/nextcloud/lib/base.php - line 1008:

    OC\Route\Router->match("/settings/apps/enable")

    /var/www/nextcloud/index.php - line 37:

    OC::handleRequest()
1 Like

Thank you! Now, we’re one step closer to the problem’s root. It seems you have unexpected rows in your oc_bookmarks_tree table. Can you run the following query in mysql?

SELECT * from oc_bookmarks_tree WHERE NOT type = 'bookmark' AND NOT type = 'folder' AND NOT type = 'share';

I’m sorry, I’m not an expert here. Can you explain how I can access/open the database, please? Where do I have to run this command?

Ok, I’ve opened MariaDB with the command “sudo mysql -u root”, but there is no database selected → MariaDB [(none)]. How can I find out the database-name?

1 Like

Awesome! show databases; will show you your databases

Ok, thanks.

I executed the command in the database “nextcloud”:
database_nextcloud

because in the database “mysql” the table doesn’t extists:

When I try to activate bookmarks again, the (same) error message appears.

1 Like

Perfect! That’s ok, we’re still only diagnosing. So the bookmarks_tree table is not corrupt, but links to entries in other tables that are possibly corrupt.

Let’s find those:

SELECT * from oc_bookmarks_shared_folders WHERE user_id IS NULL;
SELECT * from oc_bookmarks_folders WHERE user_id IS NULL;
SELECT * from oc_bookmarks WHERE user_id IS NULL;

database_nextcloud_2

Mh. Now I’m questioning my sanity. Which version of the bookmarks app is this at the moment?

Bookmarks version 4.4.0
bookmarks_error

Alright, the bookmarks version is good. That means the latest code of that repair step doesn’t account for everything.

Let’s try this:

SELECT * from oc_bookmarks_tree t JOIN oc_bookmarks_shared_folders s ON t.id = s.id AND t.type = 'share' WHERE s.id IS NULL;

This will find tree entries for shares that no longer exist.

Update: Corrected query syntax

I got a syntax error:
database_nextcloud_3