Nextcloud

Information applies to: NethServer 7.x, Nextcloud 16.x (for previous versions check old revisions of this document)

Nextcloud provides a safe, secure, and compliant file synchronization and sharing solution on servers that you control. NethServer 7 provides a preconfigured Nextcloud instance integrated with other NethServer services.

With the release of Nextcloud 16 we also switched from PHP 7.1 to PHP 7.2
If there are no dependency problems and PHP 7.1 is no longer required by any other application, it can be removed:

  yum remove *rh-php71*


Where is Nextcloud installation located?

  • The rpm package puts Nextcloud files under /usr/share/nextcloud directory.
  • Nextcloud config file is located at /usr/share/nextcloud/config/config.php.
  • User data is under /var/lib/nethserver/nextcloud directory.


Can I upgrade Nextcloud via its built-in updater?
It is not recommended. NethServer manages updates through RPM packages.

How can I run Nextcloud'socc command?
occ command should be run as the HTTP user (apache) and with the same php version used by your Nextcloud instance. One method to call occ command is:

sudo -u apache scl enable rh-php72 -- php -dmemory_limit=512M /usr/share/nextcloud/occ


After updating/upgrading Nextcloud, the apps are disabled
Nextcloud update/upgrade procedure disables 3rd. party apps to avoid incompatibility problems. Server logs keep track of which apps were disabled. After a successful update/upgrade procedure you can use the Applications page to update and re-enable the apps. Apps can also be enabled from the command line:

# example: enabling calendar app
sudo -u apache scl enable rh-php72 -- php -dmemory_limit=512M /usr/share/nextcloud/occ app:enable calendar


Logged in as admin but don't have access to administration features
At first install, NethServer's Nextcloud instance has an internal admin account with a default password of Nethesis,1234 (that should be changed). When an account provider is installed (nethserver-directory: openLDAP; nethserver-dc: Active Directory) users can authenticate into Nextcloud with their LDAP credentials. This can pose some inconvenience, as the account provider might have an account named admin as well, and trip you when login in to Nextcloud. This can be alleviated by setting a different password for Nextcloud's admin account.

How to reset Nextcloud's admin password

sudo -u apache scl enable rh-php72 -- php -dmemory_limit=512M /usr/share/nextcloud/occ user:resetpassword admin


Nextcloud remains in maintenance mode after an upgrade

sudo -u apache scl enable rh-php72 -- php -dmemory_limit=512M /usr/share/nextcloud/occ maintenance:mode --off


"Nextcloud will be updated to version xx.x.x" message is shown after an upgrade

This could be due to a partial upgrade done by the rpm packages. The specific issue might have been reflected on server logs. By running occ upgrade command you'll either finish the upgrade process or get some errors showing the problem:

sudo -u apache scl enable rh-php72 -- php -dmemory_limit=512M /usr/share/nextcloud/occ upgrade


Warning: "There were problems with the code integrity check"

Some files have not passed the integrity check. These could be custom files, or leftovers from a previous update or installation.

  • Find the problematic files using the “List of invalid files…” shown on Nextcloud's admin interface
  • Determine the type of issue (INVALID_HASH, MISSING_FILE, EXTRA_FILE, EXCEPTION…) for each file
  • Act accordingly to the self-explanatory issue type and the solutions provided in the Nextcloud documentation
  • Trigger a “Rescan…” to verify the issues have been solved


Background jobs: Last job execution ran X weeks/months ago. Something seems wrong.

If cron is the selected job scheduler for Nextcloud, make sure a cron job for /usr/share/nextcloud/cron.php is in place, and it is called by apache user using the right php version. Since Nextcloud 14.0.3 release, NethServer takes care of this.


"File is locked"

Nextcloud implements a file locking mechanism to avoid file corruption. By default, Nextcloud uses the database locking backend.

Under some circumstances, a file could remain inaccessible due to an unreleased lock. To manually release the locks:

sudo -u apache scl enable rh-php72 -- php -dmemory_limit=512M /usr/share/nextcloud/occ maintenance:mode --on

mysql nextcloud
DELETE FROM oc_file_locks WHERE 1;
\q

sudo -u apache scl enable rh-php72 -- php -dmemory_limit=512M /usr/share/nextcloud/occ maintenance:mode --off


Nextcloud stuck at "update in process" after using the built-in updater

Please, avoid using the built-in updater. Stick to the update methods supported by your GNU/Linux distribution. If you need a newer version ask to the package maintainer.

To revert the changes:

mysqldump nextcloud > nextcloud-$(date +%F-%T).sql    # optional
cp -aR /usr/share/nextcloud /usr/share/nextcloud.bad  # optional (as a backup)

Restore Nextcloud's config.php file form a backup. If no backup present, edit Nextcloud's config file (e.g. /usr/share/nextcloud/config/config.php) removing the lines referring to maintenance and updater.secret.

yum -y remove nextcloud
yum install nethserver-nextcloud

Check Nextcloud is working as expected. If all is good, you can get rid of the backup files:

rm nextcloud-*.sql
rm -r /usr/share/nextcloud.bad/    # use -rf to force removal without confirmation


Exception: Updates between multiple major versions are unsupported

Problem arises if some major release update was skipped. Nextcloud manual says:

It is best to keep your Nextcloud server upgraded regularly, and to install all point releases and major releases. Major releases are 11, 12, and 13. Point releases are intermediate releases for each major release. For example, 13.0.4 and 12.0.9 are point releases. Skipping major releases is not supported.

Some users reported the following working solution (having a backup of Nextcloud's files, configuration and user data is advisable before proceeding):

  • Find out the previously installed major release (checking logs, yum history…):
[root@server ~]# yum history packages *nextcloud
ID     | Action(s)      | Package                                              
-------------------------------------------------------------------------------
    23 | Updated        | nethserver-nextcloud-1.1.7-1.ns7.noarch            EE
    23 | Update         |                      1.2.7-1.ns7.noarch            EE
    23 | Updated        | nextcloud-12.0.2-2.el7.noarch                      EE
    23 | Update         |           14.0.3-1.el7.noarch                      EE
  • Find out installed and available nethserver-nextcloud and nextcloud packages:
[root@server ~]# yum --showduplicates list *nextcloud
  • Downgrade *nextcloud packages to the latest next major release that follows to the previously installed release (in this example, the previously installed major release was nextcloud-12 so the next major release that follows is nextcloud-13):
[root@server ~]# yum downgrade nethserver-nextcloud-1.2.4-1.ns7 nextcloud-13.0.6-1.el7
  • Keep updating *nextcloud packages to the latest next major release until reaching the current release (if there is any other major release in-between, do the update specifying the packages' version):
[root@server ~]# yum update nethserver-nextcloud nextcloud


  • Bookmarks app
    • If Bookmarks app fails to install due to gmp library not being available, install the library for the php version being used:
yum install rh-php72-php-gmp
systemctl reload rh-php72-php-fpm