I’ve made a migration from a previous server following the Migrating to a different server instructions. Now I’m faced with the problem that the apps used in the previous installation don’t show up. I have only
Dashboard
Files
Photos
Activity
The contacts show up in the navbar’s quick contacts view
but going to the page /apps/contacts gives me an error The page could not be found on the server or you may not be allowed to view it.
I recreated the ncp database user ´ncadmin´ and granted it all privileges over the nextcloud db with GRANT ALL PRIVILEGES ON nextcloud.* TO 'username'@'localhost'; FLUSH PRIVILEGES;
so I can’t see there being any access problems there.
The server logs do show an error with a missing table: Doctrine\DBAL\Exception\TableNotFoundException: An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_storages' doesn't exist. I haven’t found any answers here on the forum though. I attempted to recreate the missing indices with the occ command
sudo -u www-data php occ db:add-missing-indices
with no luck. A repairing attempt didn’t help either: sudo -u www-data php occ maintenance:repair
The error indicates that the table is missing. If you ran a backup then there should also be a backup of the database. It might be the easiest step to recover the nextcloud database, grant all permissions to the respective user an perform a scan of the files on the storage. This updates and synchronizes the catalog of nextcloud files in the database.
Alternativly you can run the create table and related statement from within the database backup.
@kjathome Thanks for the pointers.
The data database is restored with the backup of the previous installation and that’s why I can for instance see the contacts in the contacts quickview in the navbar. I just don’t understand why the nextcloud.oc_storages didn’t follow along the backup or isn’t detected in the new installation. Feels like a permissions problem but I have no idea what it could be.
I’m currently scanning the files and see if this helps… sudo -u www-data php occ files:scan --all produced:
Can you run the following command sudo mysql --database nextcloud --execute "select * from oc_storages; select * from oc_storages_credentials; check table oc_storages, oc_storages_credentials extended; show grants"
to see the content of the tables, the check result as well as the permissions.
+------------+------------------------------------------+-----------+--------------+
| numeric_id | id | available | last_checked |
+------------+------------------------------------------+-----------+--------------+
| 1 | home::ncp | 1 | NULL |
| 2 | local::/var/www/nextcloud/data/ | 1 | NULL |
| 3 | home::XXXXXXX | 1 | NULL |
| 4 | local::/media/myCloudDrive1/ncdata/ | 1 | NULL |
| 5 | home::XXXXXXXXXX | 1 | NULL |
| 6 | local::/media/myCloudDrive1/ncdata/data/ | 1 | NULL |
+------------+------------------------------------------+-----------+--------------+
+-----------------------------------+-------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+-----------------------------------+-------+----------+----------+
| nextcloud.oc_storages | check | status | OK |
| nextcloud.oc_storages_credentials | check | status | OK |
+-----------------------------------+-------+----------+----------+
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` IDENTIFIED VIA mysql_native_password USING 'HEXSTRING' OR unix_socket WITH GRANT OPTION |
| GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
So your config refers to ncadmin whereas mine uses root. When migrating from 32 to 64 bit I did a fresh installation and as far as I remember it was straight forward.
Another approch could be to grep for those tables or other hints in all logs files to see where the issue originates.
I got back to your original post which states that table oc_storages could not be found. But as we can it exists. Nextcloud runs with user www-data, ncadmin is used to connect to the database. ncadmin has all permissions to access that table (could be checked by log in to mysql with user ncadmin and running select * from nextcloud.oc_storages).
I’m not sure but very often it’s due the cache that something stopped to work (=> clear opcache).
And I remeber that once I had an issue with permissions on the tempdirectory (sudo ncc config:system:get “tempdirectory”). Just get the value and check the permissions.
Otherwise check all configs with
The error of oc_storages not being found is gone in the process of addressing errors in the admin overview check. The latest one though is
[webdav] Error: Doctrine\DBAL\Exception\DeadlockException: An exception occurred while executing a query: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at <<closure>>
...
Caused by:
Doctrine\DBAL\Driver\PDO\Exception: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at <<closure>>
...
The system temp directory which happens to be /var/www/nextcloud-data/data/tmp is owned by www-data as I used the -R handle when changing user ownership: sudo chown -R www-data:www-data /var/www/nextcloud.
The list of apps I get from the sudo ncc app:list command is:
…which feels wrong as there is quite a bunch missing. I’m a little bit hesitant to reinstalling them from the app store as this might wipe out the current app data clean. Maybe I have one to sacrifice… which I’ll do next.
In the Apps grid view, for example the GpxPod app is marked as in used which isn’t the case my user apps view. Disabling it and reloading it brings the app into the app list and icon in the nav bar. Will be testing with other…
… like the Contacts app. Reinstalling it brought back the contacts.
There must be a better way of getting back the apps though. I’m wondering now how this happened. Is it because I didn’t put the previous installment into maintenance mode before taking a db dump? @kjathome Did you have to reinstall your apps during your migration?
Contact and calendar data are stored in mariadb/mysql in corresponding tables. That’s good design separating logic and data. Hence it’s possible to (re)install apps.
The apps are stored in a directory tree below /var/www/nextcloud/apps. For this reason the nextcloud directory is also part of the backup process. You could examine the corresponding backup files on our backup device.
That begins to make sense then. I guess the Apps grid looks at the database entries for displaying if the installation has activated/enabled an app and the user apps builds up the list from entries in the nextcloud/apps directory.
That’s true, there is a table named oc_appconfig that reflects the app’s configuration and the content should be consistent with all apps in /var/www/nextcloud/apps. I don’t know if there is command to sync both (similar to nc-scan)
No, what I’ve seen that some apps not yet be supported by a newer nextcloud version. These are disabled during the upgrade process and sometimes I had to do this before manually. But it’s good to read that you finally found a solution
Thanks for hanging in there and for the help along the way. I definitely had a myopic view that everything app related was in the database and that one only needed the data and config folder for fulfilling a migration. Maybe the documentation needs a paragraph on reinstating the apps when migrating to a different server/hardware.