Environment:
- Nextcloud version (eg, 12.0.3):
- Operating system and version (11.1-RELEASE-p4):
- Apache or nginx version (nginx/1.12.1):
- PHP version (PHP 7.1.10 (cli) (built: Nov 4 2017) (NTS)):
Issue: Upgrading from 12.0.3 to 12.0.4
I will admit I am not very familiar with PostgreSQL DBMS. However, I will share as much as I can, since I am currently stumped.
I have a Nextcloud Instance at version 12.0.3 that I am upgrading to 12.0.4. I had been doing some testing previously on another machine where it was installed on a MySQL instance. Using pgloader
, I was able to migrate from MySQL to Postgresql (relatively smoothly; wasn’t able to migrate the calendar or contacts data, but that’s okay, I had file backups).
My Current PostgreSQL Data consists of the following:
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+-----------+-----------+---------+-------+-------------------------
nextcloud | nextcloud | UTF8 | C | C | =Tc/nextcloud +
| | | | | nextcloud=CTc/nextcloud
postgres | postgres | SQL_ASCII | C | C |
template0 | postgres | SQL_ASCII | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | SQL_ASCII | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)
Figure 1: Database List
With the following users/roles:
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------------------+-----------
nextcloud | Create DB | {}
pgsql_root | Superuser, Create role, Create DB | {}
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
Figure 2: User/Role List
And the following schemas:
List of schemas
Name | Owner
--------+----------
public | postgres
(1 row)
Figure 3: Schema List
The update process had successfully downloaded and applied the file changes (at least from the browser’s point of view). I would label this as the “First Stage”. At the beginning of the “Second Stage”, a message at the bottom advises the following:
To avoid timeouts with larger installations, you can instead run the following command from your installation directory:
./occ upgrade
So I obliged with the following command:
sudo -u www php nextcloud/occ upgrade
Figure 4: Upgrade Command
…and received the following output:
The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see http://php.net/manual/en/book.pcntl.php
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Set log level to debug
Updating database schema
Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'ALTER INDEX idx_17216_appconfig_config_key_index RENAME TO appconfig_config_key_index':
SQLSTATE[42501]: Insufficient privilege: 7 ERROR: must be owner of relation idx_17216_appconfig_config_key_index
Update failed
Maintenance mode is kept active
Reset log level
Is this the first time you’ve seen this error? (Y):
Now, from the error I already understand this is a permissions issue. I have tried the following to grant the correct permissions to the nextcloud
role for the “nextcloud” database:
- At StackOverflow, Give all the permissions to a user on a DB, I have followed Unkas’s answer (2nd below)
However, I have run into the same issue when running the command again in Figure 4. What am I missing?
** EDIT **: Adding Nextcloud.log
https://pastebin.com/9EBVBUJB