Maintenance
- Monitoring
- Maintenance
- Backup
- Restoring backup
- How to upgrade
- Upgrade via built-in updater
- Upgrade manually
- Upgrade via snap packages
- Migrating to a different server
- Migrating from ownCloud
- Issues and troubleshooting
- General troubleshooting
- Patching Nextcloud
- Code signing
Monitoring
OpenMetrics
New in version 33
Nextcloud exposes a /metrics endpoint. By default, it responds only on localhost. You can change this behaviour with openmetrics_allowed_clients
'openmetrics_allowed_clients' => [
'192.168.0.0/16',
],
注意
Ensure this endpoint is not accessible to everyone as it could lead to some load on your server.
You can view the content of this endpoint with the following command:
curl "https://your.domain/metrics"
If for some reason you want to disable some metrics (eg. if they take too long to generate), you can disable them by adding their class name into openmetrics_skipped_classes
'openmetrics_skipped_classes' => [
'OC\OpenMetrics\Exporters\FilesByType',
],
另见
Check Configuration Parameters for more information
Maintenance
- Backup
- Restoring backup
- How to upgrade
- Upgrade via built-in updater
- Upgrade manually
- Upgrade via snap packages
- Migrating to a different server
- Migrating from ownCloud
Backup
To backup a Nextcloud installation there are five main things you need to retain:
- The config folder
- The custom apps folder (only if you have custom apps installed)
- The data folder
- The theme folder
- The database
Maintenance mode
maintenance:mode locks the sessions of logged-in users and prevents new logins in order to prevent inconsistencies of your data. You must run occ as the HTTP user, like this example on Ubuntu Linux:
$ sudo -E -u www-data php occ maintenance:mode --on
You may also put your server into this mode by editing config/config.php. Change "maintenance" => false to "maintenance" => true:
<?php
"maintenance" => true,
Don't forget to change it back to false when you are finished.
Backup folders
Copy your config, data, and theme directories to a location outside your Nextcloud environment. Alternatively, copy your entire Nextcloud installation directory (including the data directory). You could use this command:
rsync -Aavx nextcloud/ nextcloud-dirbkp_`date +"%Y%m%d"`/
Backup database
注意
Before restoring a backup see Restoring backup
MariaDB
MariaDB is the recommended database engine. To backup MariaDB using mariadb-dump:
mariadb-dump --single-transaction -h [server] -u [username] -p[password] [db_name] > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
If you have enabled MariaDB 4-byte support (Enabling MySQL 4-byte support, needed for emoji), add --default-character-set=utf8mb4:
mariadb-dump --single-transaction --default-character-set=utf8mb4 -h [server] -u [username] -p[password] [db_name] > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
MySQL
To backup MySQL:
mysqldump --single-transaction -h [server] -u [username] -p[password] [db_name] > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
If you have enabled MySQL 4-byte support (Enabling MySQL 4-byte support, needed for emoji), add --default-character-set=utf8mb4:
mysqldump --single-transaction --default-character-set=utf8mb4 -h [server] -u [username] -p[password] [db_name] > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
SQLite
sqlite3 data/owncloud.db .dump > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
PostgreSQL
PGPASSWORD="password" pg_dump [db_name] -h [server] -U [username] -f nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
Restoring backup
To restore a Nextcloud installation there are four main things you need to restore:
- The configuration directory
- The data directory
- The database
- The theme directory
提示
You must have the database, data directory, and configuration files. You cannot complete restoration without all three.
Restore folders
提示
This guide assumes that your previous backup is called "nextcloud-dirbkp"
Simply copy your configuration and data folder (or even your whole Nextcloud install and data folder) to your Nextcloud environment. You could use this command:
rsync -Aax nextcloud-dirbkp/ nextcloud/
Restore database
注意
Before restoring a backup you need to make sure to delete all existing database tables.
The easiest way to do this is to drop and recreate the database. SQLite does this automatically.
MariaDB
MariaDB is the recommended database engine. To restore MariaDB using the mariadb client:
mariadb -h [server] -u [username] -p[password] -e "DROP DATABASE nextcloud"
mariadb -h [server] -u [username] -p[password] -e "CREATE DATABASE nextcloud"
If you use UTF8 with multibyte support (e.g. for emojis in filenames), use:
mariadb -h [server] -u [username] -p[password] -e "DROP DATABASE nextcloud"
mariadb -h [server] -u [username] -p[password] -e "CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci"
MySQL
To restore MySQL:
mysql -h [server] -u [username] -p[password] -e "DROP DATABASE nextcloud"
mysql -h [server] -u [username] -p[password] -e "CREATE DATABASE nextcloud"
If you use UTF8 with multibyte support (e.g. for emojis in filenames), use:
mysql -h [server] -u [username] -p[password] -e "DROP DATABASE nextcloud"
mysql -h [server] -u [username] -p[password] -e "CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci"
PostgreSQL
PGPASSWORD="password" psql -h [server] -U [username] -d template1 -c "DROP DATABASE \"nextcloud\";"
PGPASSWORD="password" psql -h [server] -U [username] -d template1 -c "CREATE DATABASE \"nextcloud\";"
Restoring
提示
This guide assumes that your previous backup is called "nextcloud-sqlbkp.bak"
MariaDB
MariaDB is the recommended database engine. To restore MariaDB using the mariadb client:
mariadb -h [server] -u [username] -p[password] [db_name] < nextcloud-sqlbkp.bak
MySQL
To restore MySQL:
mysql -h [server] -u [username] -p[password] [db_name] < nextcloud-sqlbkp.bak
SQLite
rm data/owncloud.db
sqlite3 data/owncloud.db < nextcloud-sqlbkp.bak
PostgreSQL
PGPASSWORD="password" psql -h [server] -U [username] -d nextcloud -f nextcloud-sqlbkp.bak
Synchronising with clients after data recovery
By default the Nextcloud server is considered the authoritative source for the data. If the data on the server and the client differs clients will default to fetching the data from the server.
If the recovered backup is outdated the state of the clients may be more up to date than the state of the server. In this case also make sure to run the maintenance:data-fingerprint command afterwards. It changes the logic of the synchronisation algorithm to try and recover as much data as possible. Files missing on the server are therefore recovered from the clients and in case of different content the users will be asked.
This can also help in rare scenarios when the database is newer than the data directory. The server will restore the data from the clients and preserve the shares. Until then the files would be visible but not accessible. A files:scan is required afterwards to update the database.
提示
The usage of maintenance:data-fingerprint can cause conflict dialogues and difficulties deleting files on the client. Therefore it's only recommended to prevent dataloss if the backup was outdated. This command does not require the server to be in maintenance mode.
If you are running multiple application servers you will need to make sure the config files are synced between them so that the updated data-fingerprint is applied on all instances.
How to upgrade
Overview
The approach used to upgrade your Nextcloud Server depends on your installation type. This manual mainly focuses on the methods that apply to an Archive based installation. If you installed using Snap, Docker, a pre-built VM, or a package management tool then refer to the installation and update instructions for that installation method for the most accurate upgrading instructions (generally located at the distribution point for the install method you chose).
There are two ways to upgrade an Archive based Nextcloud Server deployment:
- With the Built-in Updater (via the web or command-line interfaces).
- Manually upgrading (using a downloaded Archive file)
The Built-in Updater, in either Web or command-line mode, is the easiest choice for most environments. However some environments require the manual approach. Both approaches are covered fully here.
说明
Before upgrading, especially between major versions (e.g. v27.y.z -> v28.y.z) please review critical changes first. These are highlights of changes that may be required in your environment to accommodate changes in Nextcloud Server. These notes are periodically revised as needed so it is also a good idea to revisit them periodically, such as when proceeding with maintenance upgrades.
When an update is available for your Nextcloud server, by default you will receive a notification. You can also check for available updates by visiting the Update section under Administration settings->Overview in the Web UI.
提示
It is best to keep your Nextcloud server upgraded regularly. This means installing all maintenance/point releases and upgrading to new major releases before your current one reaches end-of-life status. Examples of major releases are 27, 28, or 29. Maintenance releases are intermediate releases for each major release that address critical functionality or security bugs. For example 28.0.4 and 29.0.2 are maintenance releases.
Approaching Upgrades
Nextcloud must be upgraded step by step:
- Before you can upgrade to the next major release, you need to upgrade to the latest point release of your current major version.
- Then run the upgrade again to upgrade to the next major release's latest point release.
- You cannot skip major releases. Please re-run the upgrade until you have reached the highest available (or applicable) release.
- Example: 18.0.5 -> 18.0.11 -> 19.0.5 -> 20.0.2
Wait for background migrations to finish after major upgrades. After upgrading to a new major version, some migrations are scheduled to run as a background job. If you plan to upgrade directly to another major version (e.g. 24 -> 25 -> 26) you need to make sure these migrations were executed before starting the next upgrade. To do so you should run the cron.php file 2-3 times, for example:
$ sudo -E -u www-data php -f /var/www/nextcloud/cron.php
For more information about background jobs see Background jobs.
Upgrading is disruptive. Your Nextcloud server will be put into maintenance mode, so your users will be locked out until the upgrade is completed. Large installations may take several hours to complete the upgrade. Nevertheless usual upgrade times even for bigger installations are in the range of a few minutes.
注意
Downgrading is not supported and risks corrupting your data! If you want to revert to an older Nextcloud version, make a new, fresh installation and then restore your data from backup. Before doing this, file a support ticket (if you have paid support) or ask for help in the Nextcloud forums to see if your issue can be resolved without downgrading.
Update notifications
Nextcloud has an update notification app, that informs the administrator about the availability of an update. Then you decide which update method to use.
Figure 1: The top banner is the update notification that is shown on every page, and the Updates section can be found in the admin page
From there the web based updater can be used to fetch this new code. There is also an CLI based updater available, that does exactly the same as the web based updater but on the command line.
Prerequisites
另见
If you upgrade from a previous major version please see critical changes first.
You should always maintain regular backups and make a fresh backup before every upgrade.
Then review third-party apps, if you have any, for compatibility with the new Nextcloud release. Any apps that are not developed by Nextcloud show a 3rd party designation. Install unsupported apps at your own risk. Then, before the upgrade, all 3rd party apps must be disabled. After the upgrade is complete you may re-enable them.
Maintenance mode
You can put your Nextcloud server into maintenance mode before performing upgrades, or for performing troubleshooting or maintenance. Please see Using the occ command to learn how to put your server into the maintenance mode (maintenance:mode) or execute repair commands (maintenance:repair) with the occ command.
The built-in Updater does this for you before replacing the existing Nextcloud code with the code of the new Nextcloud version.
maintenance:mode locks the sessions of logged-in users and prevents new logins. This is the mode to use for upgrades. You must run occ as the HTTP user, like this example on Ubuntu Linux:
$ sudo -E -u www-data php occ maintenance:mode --on
You may also put your server into this mode by editing config/config.php. Change "maintenance" => false to "maintenance" => true:
<?php
"maintenance" => true,
Then change it back to false when you are finished.
Manual steps during upgrade
Some operation can be quite time consuming. Therefore we decided not to add them to the normal upgrade process. We recommend to run them manually after the upgrade was completed. Below you find a list of this commands.
Long running migration steps
From time to time we do some changes to the database layout that take a lot of time, but can be executed while Nextcloud stays online. Thus we moved them into a separate command that an administrator can execute on the CLI without the need to lock the instance into maintenance mode (at least for some of them). The instance will also work without those changes applied, but performance is improved significantly by them. There is also always an hint in the setup checks of the admin settings web interface.
Those include for example:
$ sudo -E -u www-data php occ db:add-missing-columns
$ sudo -E -u www-data php occ db:add-missing-indices
$ sudo -E -u www-data php occ db:add-missing-primary-keys
You can use the --dry-run option to output the SQL queries instead of executing them.
Upgrade via built-in updater
The built-in updater automates many of the steps of upgrading a Nextcloud installation. It is useful for installations that do not have root access, such as shared hosting, for installations with a smaller number of users and data, and it automates updating manual installations.
注意
Downgrading is not supported and risks corrupting your data! If you want to revert to an older Nextcloud version, install it from scratch and then restore your data from backup. Before doing this, file a support ticket if you have paid support or ask for help in the Nextcloud forums to see if your issue can be resolved without downgrading.
警告
You should maintain regular backups (see Backup), and make a backup before every update. The built-in updater does not backup your database or data directory.
What does the updater do?
提示
The built-in updater itself only replaces the existing files with the ones from the version it updates to. The migration phase, which upgrades your database and apps, needs to be executed afterwards. In command line mode, the updater offers to trigger this for you right after the code was successfully replaced by running
occ upgradefor you. In web mode, the updater finishes and then offers to send you back to your instance's main URL to trigger the migration phase's web UI.
The built-in updater performs these operations:
- Check for expected files: checks if only the expected files of a Nextcloud installation are present, because it turned out that some files that were left in the Nextcloud directory caused side effects that risked the update procedure.
- Check for write permissions: checks if all files that need to be writable during the update procedure are actually writable.
- Enable maintenance mode: enables the maintenance mode so that no other actions are executed while running the update of the code.
- Create backup: creates a backup of the existing code base in
/updater-INSTANCEID/backups/nextcloud-CURRENTVERSION/inside of the data directory (this does not contain the/datadirectory nor the database). - Downloading: downloads the code in the version it should update to. This is also shown in the web UI before the update is started. This archive is downloaded to
/updater-INSTANCEID/downloads/. - Extracting: extracts the archive to the same folder.
- Replace entry points: replaces all Nextcloud entry points with dummy files so that when those files are replaced all clients still get the proper maintenance mode response. Examples for those endpoints are
index.php,remote.phporocs/v1.php. - Delete old files: deletes all files except the above mentioned entry points, the data and config dir as well as non-shipped apps and themes. (And the updater itself of course)
- Move new files in place: moves the files from the extracted archive in place.
- Keep maintenance mode active?: asks you if the maintenance mode should be kept active. This allows the admin to use the web based updater but run the actual migration steps (
occ upgrade) on the command line. If the maintenance mode is kept active command line access is required. To use the web based upgrade page disable the maintenance mode and click the link to get to the upgrade page. (This step is only available in the web based updater.) - Done the update of the code is done and you either need to go to the linked page or to the command line to finish the upgrade by executing the migration steps.
Using the command line based updater
- You should see a notification at the top of any Nextcloud page when there is a new update available. Go to the admin settings page and scroll to the section "Version". This section has a button to open the updater. This section as well as the update notification is only available if the update notification app is enabled in the apps management.
- Instead of clicking that button you can now invoke the command line based updater by going into the updater/ directory in the Nextcloud directory and executing the updater.phar as the web server user. (i.e.
sudo -E -u www-data php /var/www/nextcloud/updater/updater.phar)
- Verify the information that is shown and enter "Y" to start the update.
- In case an error happens or the check failed the updater stops processing and gives feedback. You can now try to solve the problem and re-run the updater command. This will continue the update and re-run the failed step. It will not re-run the previous succeeded steps.
- Once all steps are executed the updater will ask you a final question: "Should the "occ upgrade" command be executed?". This allows you to directly execute the command line based upgrade procedure (
occ upgrade). If you select "No" then it will finish with Please now execute "./occ upgrade" to finish the upgrade..
- Once the
occ upgradeis done you get asked if the maintenance mode should be kept active.
Batch mode for command line based updater
It is possible to run the command line based updater in a non-interactive mode. The updater then doesn't ask any interactive questions. It is assumed that if an update is available it should be installed and the occ upgrade command is executed as well. After finishing the maintenance mode will be turned off except an error occurred during the occ upgrade or the replacement of the code.
To execute this, run the command with the --no-interaction option. (i.e. sudo -E -u www-data php /var/www/nextcloud/updater/updater.phar --no-interaction)
Using a custom download URL
The --url option lets you override the archive the updater downloads. Common use cases:
- Pinning a specific version — install an exact patch release rather than whatever the update check resolves to.
- Internal mirrors — serve the archive from a company mirror or proxy.
- Offline / air-gapped environments — stage the archive locally and supply it via a
file://URL.
注意
The normal update rules still apply when using
--url:
- Downgrading is not supported.
- Skipping major versions is not supported. You must update one major version at a time (e.g. 28 → 29 → 30, not 28 → 30).
Passing
--urldoes not bypass these constraints.
Point the updater at any HTTP/HTTPS URL:
sudo -u www-data php /var/www/nextcloud/updater/updater.phar \
--url https://download.nextcloud.com/server/releases/nextcloud-33.0.0.zip
New in version 34
For a locally staged archive, use a file:// URL:
sudo -u www-data php /var/www/nextcloud/updater/updater.phar \
--url file:///tmp/nextcloud-33.0.0.zip
Signature verification
When --url is used the updater cannot look up the official signature automatically. You have two options:
-
Provide the signature — pass the base64-encoded signature with
--signature. You can get the signature from https://nextcloud.com/changelog/ or from the same mirror that hosts the archive:sudo -u www-data php /var/www/nextcloud/updater/updater.phar \ --url file:///tmp/nextcloud-33.0.0.zip \ --signature "BASE64_SIGNATURE_HERE" -
Skip verification — pass
--no-verifyto disable integrity checking entirely. Only do this if you fully trust the source and transfer channel, or if you have already verified the archive yourself (e.g. by checking the SHA-512 checksum):sha512sum -c nextcloud-33.0.0.zip.sha512Then run the updater without signature checking:
sudo -u www-data php /var/www/nextcloud/updater/updater.phar \ --url file:///tmp/nextcloud-33.0.0.zip \ --no-verify注意
--no-verifyremoves the integrity check that protects against corrupted or tampered archives. Always verify the archive through an independent channel before using this option.
These options can be combined with --no-interaction for fully automated runs:
sudo -u www-data php /var/www/nextcloud/updater/updater.phar \
--url file:///tmp/nextcloud-33.0.0.zip \
--signature "BASE64_SIGNATURE_HERE" \
--no-interaction
Using the web based updater
The web based updater performs the same steps and checks as the command line based updater.
Using the built-in updater to update your Nextcloud installation is just a few steps:
- You should see a notification at the top of any Nextcloud page when there is a new update available. Go to the admin settings page and scroll to the section "Version". This section has a button to open the updater. This section as well as the update notification is only available if the update notification app is enabled in the apps management.
- Verify the information that is shown and click the button "Start update" to start the update.
- In case an error happens or the check failed the updater stops processing and gives feedback. You can now try to solve the problem and click the "Retry update" button. This will continue the update and re-run the failed step. It will not re-run the previous succeeded steps.
- In case you close the updater, before it finished you can just open the updater page again and proceed at the last succeeded step. Closing the web page will still execute the running step but will not continue with the next one, because this is triggered by the open updater page.
- Once all steps are executed the updater will ask you a final question: "Keep maintenance mode active?". This allows you to use either the web based upgrade page or the command line based upgrade procedure (
occ upgrade). Command line access is required if the maintenance mode is kept active.
- Done. You now can continue either to the web based upgrade page or run
occ upgrade. The two examples "Web based upgrade" and "Command line based upgrade" shows how the screens then look like.
Web based upgrade
This is how the web based update would continue:
Command line based upgrade
This is how the command line based update would continue:
$ sudo -u www-data php ./occ upgrade
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
Updated database
Updating <files_pdfviewer> ...
Updated <files_pdfviewer> to 1.1.1
Updating <gallery> ...
Updated <gallery> to 17.0.0
Updating <activity> ...
Updated <activity> to 2.5.2
Updating <comments> ...
Updated <comments> to 1.2.0
Updating <theming> ...
Updated <theming> to 1.3.0
Starting code integrity check...
Finished code integrity check
Update successful
Maintenance mode is kept active
Reset log level
Troubleshooting
- The built-in updater logs all of its actions to a dedicated log file called
updater.loglocated in your configureddatadirectory(e.g./var/www/html/data/updater.log). This file can be helpful in isolating where things are failing. It will also be needed if you reach out for assistance on the community help forum (https://help.nextcloud.com). - If you are having problems using the Updater in web-mode, you should try using command-line mode (if it's an option in your environment). Command-line avoids issues with web server timeouts, which can be problematic since sometimes the Updater can take a long time to complete certain steps.
- If the problem seems to be during the backup step, you can try disabling the backups the updater automatically creates of the installation files. Keep in mind these backups do not include your data (which you are already hopefully doing). The backup step can only be disabled while in command-line mode. Append the option
--no-backupto theupdater.pharcommand. - If you accidentally say no when the command-line mode of the updater asks if you'd like to run
occ upgrade, you can safely executeocc upgrademanually or simply visit the URL of your instance to complete the database migrations and app upgrade phase. - Reach out to the community help forum for assistance (https://help.nextcloud.com)
Upgrade manually
Overview
In some environments using the Built-in Updater in Web mode is not reliable (such as due to web server timeouts) and running it in command-line mode is not an option (such as in some shared hosting environments). In these cases a manual upgrade may be the best approach.
A manual upgrade consists of downloading and unpacking the Nextcloud Archive file either to your PC or host. Then deleting your existing Nextcloud Server installation files and folders, except data/ and config/, on your host. Then moving the new Nextcloud Server installation files into the appropriate place on your host, again preserving your existing data/ and config/ files. And doing a few other housekeeping items, such as making sure your installed apps are transferred into the new installation and adjusting permissions. That may sound like a lot, but detailed instructions are below.
说明
Before upgrading, especially between major versions (e.g. v27.y.z -> v28.y.z) please review critical changes first. These are highlights of changes that may be required in your environment to accommodate changes in Nextcloud Server. These notes are periodically revised as needed so it is a good idea to revisit them even when proceeding with minor and maintenance upgrades just in case.
注意
When upgrading manually, you must confirm your system meets the System requirements of the new version as well as that you are following the standard upgrade requirements (such as upgrading to the latest maintenance release before upgrading to a new major release).
Step-by-Step Manual Upgrade
说明
Always start by making a fresh backup and disabling all 3rd party apps.
-
Back up your existing Nextcloud Server database, data directory, and
config.phpfile. (See Backup, for restore information see Restoring backup) -
Choose a target Nextcloud Server release from https://nextcloud.com/changelog/ and download the Archive file (tarball or zip archive) into an empty directory outside of your current installation.
注意
You cannot jump more than one major version forward at a time (i.e. 27->28 is okay, but 27->29 is not).
-
Unpack the the downloaded tarball or zip archive - e.g.:
unzip nextcloud-[version].zip (or) tar -xjf nextcloud-[version].tar.bz2 -
Stop your Web server.
-
In case you are running a cron-job for nextcloud's house-keeping disable it by commenting the entry in the crontab file:
crontab -u www-data -e(Put a # at the beginning of the corresponding line.)
-
Rename your current Nextcloud directory, for example
nextcloud-old. -
Unpacking the new archive creates a new
nextclouddirectory populated with your new server files. Move this directory and its contents to the original location of your old server. For example/var/www/, so that once again you have/var/www/nextcloud. -
Copy the
config/config.phpfile from your old Nextcloud directory to your new Nextcloud directory. -
If you keep your
data/directory in yournextcloud/directory, move it from your old version of Nextcloud to your newnextcloud/. If you keep it outside ofnextcloud/then you don't have to do anything with it, because its location is configured in your originalconfig.php, and none of the upgrade steps touch it. -
If you are using 3rd party application, it may not always be available in your upgraded/new Nextcloud instance. To check this, compare a list of the apps in the new
nextcloud/apps/folder to a list of the of the apps in your backed-up/oldnextcloud/apps/folder. If you find 3rd party apps in the old folder that needs to be in the new/upgraded instance, simply copy them over and ensure the permissions are set up as shown below. -
If you have additional apps folders like for example
nextcloud/apps-extrasornextcloud/apps-external, make sure to also transfer/keep these in the upgraded folder. -
If you are using 3rd party theme make sure to copy it from your
themes/directory to your new one. It is possible you will have to make some modifications to it after the upgrade. -
Adjust file ownership and permissions:
chown -R www-data:www-data nextcloud find nextcloud/ -type d -exec chmod 750 {} \; find nextcloud/ -type f -exec chmod 640 {} \; -
Restart your Web server.
-
Now launch the upgrade from the command line using
occ, like this example on Ubuntu Linux:sudo -E -u www-data php occ upgrade(!) this MUST be executed from within your nextcloud installation directory
-
The upgrade operation takes a few minutes to a few hours, depending on the size of your installation. When it is finished you will see a success message, or an error message that will tell where it went wrong.
-
Re-enable the nextcloud cron-job. (See step 4 above.)
crontab -u www-data -e
(Delete the # at the beginning of the corresponding line in the crontab file.)
Login and take a look at the bottom of your Admin page to verify the version number. Check your other settings to make sure they're correct. Go to the Apps page and review the core apps to make sure the right ones are enabled. Re-enable your third-party apps.
Previous Nextcloud releases
You'll find previous Nextcloud releases in the Nextcloud Server Changelog.
Troubleshooting
Occasionally, files do not show up after an upgrade. A rescan of the files can help:
sudo -E -u www-data php console.php files:scan --all
See the nextcloud.com support page for further resources.
Sometimes, Nextcloud can get stuck in a upgrade if the web based upgrade process is used. This is usually due to the process taking too long and encountering a PHP time-out. Stop the upgrade process this way:
sudo -E -u www-data php occ maintenance:mode --off
Then start the manual process:
sudo -E -u www-data php occ upgrade
If this does not work properly, try the repair function:
sudo -E -u www-data php occ maintenance:repair
Upgrade via snap packages
Upgrade quickstart
Nextcloud snap is an unofficial Nextcloud designed to be easy to install and simple to maintain. The ideal Nextcloud snap is an "install and forget" Nextcloud instance that works on most architectures and updates itself without needing administrative skills. Combining Nextcloud with snapd makes it a perfect fit for IoT or scalable environments. Snapd is a secure and robust technology which the Nextcloud snap team has embraced.
However, the snap is opinionated.
- Nextcloud snap uses recommended Apache.
- Nextcloud snap uses recommended MySQL.
- Nextcloud snap uses recommended PHP.
Installation
On Ubuntu
- https://snapcraft.io/nextcloud
- Install Nextcloud
sudo snap install nextcloud
All other distros be warned
By default the latest stable Nextcloud snap release will be installed and it will automatically update to subsequent stable releases, but there are other releases available as well and you have full control of automatic updates.
After installation, Nextcloud will start automatically. Assuming you and the device on which it was installed are on the same network, you will reach the Nextcloud installation by visiting <hostname>.local or the IP address of the instance in your browser. If your hostname is localhost or localhost.localdomain, like on an Ubuntu Core device, nextcloud.local will be used instead.
1st login
Upon visiting the Nextcloud installation for the first time, you will be prompted to enter an admin username and password before Nextcloud is initialised. This may take a while depending on resources and the device. After you provide that information you will be logged in and able to install apps, create users, and upload files.
Upgrade tips
By default the Nextcloud snap will automatically update to subsequent stable releases. You may however upgrade manually too by issuing the command:
sudo snap refresh nextcloud
If the upgrade fails you can easily revert to the last working version by issuing the command:
sudo snap revert nextcloud
Further documentation, an extensive Wiki and FAQ's can be found on the developers GitHub.
Migrating to a different server
If the need arises Nextcloud can be migrated to a different server. A typical use case would be a hardware change or a migration from the virtual Appliance to a physical server. All migrations have to be performed with Nextcloud offline and no accesses being made. Online migration is supported by Nextcloud only when implementing industry standard clustering and HA solutions before Nextcloud is installed for the first time.
To start let us be specific about the use case. A configured Nextcloud instance runs reliably on one machine. For some reason (e.g. more powerful machine is available but a move to a clustered environment not yet needed) the instance needs to be moved to a new machine. Depending on the size of the Nextcloud instance the migration might take several hours. As a prerequisite it is assumed that the end users reach the Nextcloud instance via a virtual hostname (a CNAME record in DNS) which can be pointed at the new location. It is also assumed that the authentication method (e.g. LDAP) remains the same after the migration.
注意
At NO TIME any changes to the ORIGINAL system are required EXCEPT putting Nextcloud into maintenance mode.
This ensures, should anything unforeseen happen you can go back to your existing installation and provide your users with a running Nextcloud while debugging the problem.
-
Set up the new machine with the desired OS, install and configure the Web server as well as PHP for Nextcloud (e.g. permissions or file upload size limits) and make sure the PHP version matches Nextcloud supported configuration and all relevant PHP extensions are installed. Also set up the database and make sure it is a Nextcloud supported configuration. If your original machine was installed recently just copying that base configuration is a safe best practice.
说明
Before beginning the migration, check the ``config/config.php`` file on your ORIGINAL system to identify any optional services that are configured, such as:
- Redis or Memcached (for caching/sessions)
- External object storage (S3, etc.)
- LDAP
- Mail server settings
- Full-text search backends (Elasticsearch, etc.)
You must also install and configure these same services on the NEW machine before copying the Nextcloud files. Failure to do so may cause errors such as "Redis server went away" or connection failures during Nextcloud startup.
-
On the original machine then stop Nextcloud. First activate the maintenance mode. After waiting for 6-7 minutes for all sync clients to register the server is in maintenance mode stop the application and/or Web server that serves Nextcloud.
-
Create a dump from the database and copy it to the new machine. There import it in the database (See Backup and Restoring backup).
-
Copy all files from your Nextcloud instance, the Nextcloud program files, the data files, the log files and the configuration files, to the new machine (See Backup and Restoring backup). The data files should keep their original timestamp (can be done by using
rsyncwith-toption) otherwise the clients will re-download all the files after the migration. Depending on the original installation method and the OS the files are located in different locations. On the new system make sure to pick the appropriate locations. If you change any paths, make sure to adapt the paths in the Nextcloud config.php file.提示
This step might take several hours, depending on your installation.
注意
Changing the location of the data directory might cause a corruption of relations in the database and is not supported.
说明
After copying
config/config.phpto the new machine, review and update every server-specific value before starting Nextcloud. At minimum check:datadirectory— keep this path identical to the original server wherever possible. Changing the data directory path requires a database update and is strongly discouraged; see Troubleshooting data-directory if you have no choice.dbhost,dbname,dbuser,dbpassword— update if the new server uses a different database host or credentials.trusted_domains— add or replace the new server's hostname or IP address.overwrite.cli.url,overwritehost,overwriteprotocol,overwritewebroot— update to reflect the new server's URL and any reverse-proxy setup.memcache.local,memcache.distributed,memcache.lockingand the associated connection parameters — update if the cache/session backend address changed on the new machine. Depending on the backend in use, checkredisorredis.cluster(for Redis / Redis Cluster) ormemcached_servers(for Memcached).objectstore— if external object storage (S3, Swift, etc.) is configured, verify that the endpoint, bucket, and credentials are still valid and reachable from the new server.mail_smtphost,mail_smtpport— update if the SMTP relay differs on the new server.logfile— update if the log path differs on the new server.tempdirectory— if set to a custom path, make sure that path exists and is writable on the new server.serverid— if set, keep the same value. It identifies the server in multi-PHP-server setups and must not change. If you override it per server via theNC_serveridenvironment variable, configure the same override on the new server.
The
secretandinstanceidvalues are generated once at install time and tied to all encrypted data and user sessions. Do not change or regenerate them. They must be copied verbatim from the originalconfig.php.Leaving stale values (especially database credentials or
datadirectory) will cause startup errors or data corruption. -
Check the config.php file of the ORIGINAL system to see if it has the
data-fingerprintset to a non-empty value. If this is the case, make sure to also run themaintenance:data-fingerprintcommand on the NEW system, similarly to how it is required when performing a backup restoration (See Restoring backup for details). -
While still having Nextcloud in maintenance mode (confirm!) and BEFORE changing the
CNAMErecord in the DNS start up the database, Web server / application server on the new machine and point your web browser to the migrated Nextcloud instance. Confirm that you see the maintenance mode notice, that a logfile entry is written by both the Web server and Nextcloud and that no error messages occur. Then take Nextcloud out of maintenance mode and repeat. Log in as admin and confirm normal function of Nextcloud. -
Change the
CNAMEentry in the DNS to point your users to the new location.
Migrating from ownCloud
提示
Especially when migrating from ownCloud to Nextcloud you should create a backup of the config, database and the data directory, in case something goes wrong.
Currently migrating from ownCloud is like performing a manual update. So it is quite easy, to migrate from one ownCloud version to at least one Nextcloud version. However this does only work with versions that are sufficiently compatible in database schema and codebase. See the table below for a version map, where migrating is easily possible:
| ownCloud | Nextcloud |
|---|---|
| 10.13.x 10.14.x 10.15.x 10.16.x | 34.0.0 34.0.0 34.0.0 34.0.0 |
提示
Since ownCloud does not and will not support PHP 8.0 or higher, you need to upgrade your PHP instance first, after which, ownCloud won't be accessible anymore. See System requirements about PHP versions supported by Nextcloud. We urge you to migrate to Nextcloud since PHP versions prior PHP 8 are end of life, see https://www.php.net/supported-versions.php.
- First download the correct version of Nextcloud from our releases page,
- Make sure to have do a backup before migrating.
- Upgrade PHP to a version supported by the downloaded Nextcloud version.
- Follow the upgrade instructions described in the Upgrade manually manual.
- Run the following commands after
occ upgrade:
occ db:convert-filecache-bigintocc db:add-missing-columnsocc db:add-missing-indicesocc db:add-missing-primary-keys
- If system cron was used, please verify if crontab entry was using the command
occ system:cron. If yes, please adjust it to use thephpcommand instead according to the background jobs configuration documentation - In case, use the Nextcloud built-in updater to update your instance to the newest version. This must be done for every major version, since updates between multiple major versions are not supported.
- If multiple major version upgrades are done, it might be needed to upgrade PHP again in between.
- Make sure to also verify the "Security & setup warnings" in the "Overview" section on the settings page.
- In some cases, apps installed from the ownCloud Market might have been disabled as incompatible (ex: calendar and contacts), so you should reinstall the Nextcloud ones using
occ app:enable calendar,occ app:enable contacts, etc
Issues and troubleshooting
General troubleshooting
If you have trouble installing, configuring or maintaining Nextcloud, please refer to our community support channels:
- The Nextcloud Forums
The Nextcloud forums have a FAQ page where each topic corresponds to typical mistakes or frequently occurring issues
Please understand that all these channels essentially consist of users like you helping each other out. Consider helping others out where you can, to contribute back for the help you get. This is the only way to keep a community like Nextcloud healthy and sustainable!
If you are using Nextcloud in a business or otherwise large scale deployment, note that Nextcloud GmbH offers commercial support options.
Bugs
If you think you have found a bug in Nextcloud, please:
- Search for a solution (see the options above)
- Double-check your configuration
If you can't find a solution, please use our bugtracker. You can generate a configuration report with the occ config command, with passwords automatically obscured.
General troubleshooting
Check the Nextcloud System requirements, especially supported browser versions.
When you see warnings about code integrity, refer to Code signing.
Disable 3rdparty / non-shipped apps
It might be possible that 3rd party / non-shipped apps are causing various different issues. Always disable 3rd party apps before upgrades, and for troubleshooting. Please refer to the Apps commands on how to disable an app from command line.
Internal Server Errors
An Internal Server Error, sometimes called a "500 error", indicates that the web server encountered an unexpected condition that prevented it from fulfilling the request.
This error response is a generic "catch-all" response. To find out the source of the error you will need to check your Nextcloud log (located in data/nextcloud.log by default) and possibly your web server's error log (depending on where the failure is occurring).
提示
Whenever possible, Nextcloud will include the "Request id" in the error. This request ID can be searched for in your Nextcloud log file to find entries associated with the failing transaction.
Nextcloud log files
The Nextcloud log file is located in the data directory by default - e.g. data/nextcloud.log. If the Web UI is still reachable, it is also available via Administration settings->Logging.
提示
When asking for help, the entire raw log entry is generally required.
For some situations you may need to adjust the log level in your config.php file. Please see Logging for more information on these log levels.
Some logging - for example JavaScript console logging - needs debugging enabled. Edit config/config.php and change 'debug' => false, to 'debug' => true, Be sure to change it back when you are finished.
For JavaScript issues you will also need to view the javascript console. All major browsers have developer tools for viewing the console, and you usually access them by pressing F12.
PHP version and information
You will need to know the PHP version and configuration that is in-use on your Nextcloud server. This will not necessarily be the same version and configuration as can be reached from the command-line. The simplest way to gather this information is by using what's commonly referenced as phpinfo().
The most accurate - and easiest - way to access phpinfo is by checking it from within Nextcloud itself. Of course, this requires that Nextcloud is functioning enough that you can log in as an administrator and access the Administration settings -> System menu. If so, you can enable the exposure of phpinfo data by toggling it on via occ:
./occ config:app:set --value=yes serverinfo phpinfo
From then on a new button labeled Show phpinfo will be visible in the web interface under Administration settings -> System. Clicking it will expose just about everything you may want to know about your PHP environment.
If accessing the Nextcloud web interface is not an option, you may create a plain-text file named phpinfo.php and place it in your Web root, for example /var/www/html/phpinfo.php. (Your Web root may be in a different location; your Linux distribution documentation will tell you where.) This file contains just this line:
<?php phpinfo(); ?>
Open this file in a Web browser by pointing your browser to localhost/phpinfo.php:
Your PHP version is at the top, and the rest of the page contains abundant system information such as active modules, active .ini files, and much more. When you are finished reviewing your information you must delete phpinfo.php, or move it outside of your Web directory, because it is a security risk to expose such sensitive data.
Debugging sync issues
注意
The data directory on the server is exclusive to Nextcloud and must not be modified manually.
Disregarding this can lead to unwanted behaviors like:
- Problems with sync clients
- Undetected changes due to caching in the database
If you need to directly upload files from the same server please use a WebDAV command line client like cadaver to upload files to the WebDAV interface at:
https://example.com/nextcloud/remote.php/dav
Common problems / error messages
Some common problems / error messages found in your logfiles as described above:
SQLSTATE[HY000] [1040] Too many connections-> You need to increase the connection limit of your database, please refer to the manual of your database for more information.SQLSTATE[HY000]: General error: 5 database is locked-> You're usingSQLitewhich can't handle a lot of parallel requests. Please consider converting to another database like described in Converting database type.SQLSTATE[HY000]: General error: 2006 MySQL server has gone away-> Please refer to Troubleshooting for more information.SQLSTATE[HY000] [2002] No such file or directory-> There is a problem accessing your SQLite database file in your data directory (data/nextcloud.db). Please check the permissions of this folder/file or if it exists at all. If you're using MySQL please start your database.Connection closed / Operation cancelled-> This could be caused by wrongKeepAlivesettings within your Apache config. Make sure thatKeepAliveis set toOnand also try to raise the limits ofKeepAliveTimeoutandMaxKeepAliveRequests.No basic authentication headers were found-> This error is shown in yourdata/nextcloud.logfile. Some Apache modules likemod_fastcgi,mod_fcgidormod_proxy_fcgiare not passing the needed authentication headers to PHP and so the login to Nextcloud via WebDAV, CalDAV and CardDAV clients is failing.
Troubleshooting Web server and PHP problems
Logfiles
When having issues the first step is to check the logfiles provided by PHP, the Web server and Nextcloud itself.
提示
In the following the paths to the logfiles of a default Debian installation running Apache2 with mod_php is assumed. On other Web servers, Linux distros or operating systems they can differ.
- The logfile of Apache2 is located in
/var/log/apache2/error.log. - The logfile of PHP can be configured in your
/etc/php/8.3/apache2/php.ini. You need to set the directivelog_errorstoOnand choose the path to store the logfile in theerror_logdirective. After those changes you need to restart your Web server. - The logfile of Nextcloud is located in the data directory
/var/www/nextcloud/data/nextcloud.log.
Web server and PHP modules
提示
Lighttpd is not supported with Nextcloud, and some Nextcloud features may not work at all on Lighttpd.
There are some Web server or PHP modules which are known to cause various problems like broken uploads/downloads. The following shows a draft overview of these modules:
- Apache
- mod_pagespeed
- mod_evasive
- mod_security
- mod_reqtimeout
- mod_deflate
- mod_spdy
- mod_dav
- mod_xsendfile / X-Sendfile (causing broken downloads if not configured correctly)
- NginX
- ngx_pagespeed
- HttpDavModule
- X-Sendfile (causing broken downloads if not configured correctly)
- PHP
- Tideways
- eAccelerator
Troubleshooting WebDAV
Nextcloud uses SabreDAV, and the SabreDAV documentation is comprehensive and helpful.
See:
- SabreDAV FAQ
- Web servers (Lists lighttpd as not recommended)
- Working with large files (Shows a PHP bug in older SabreDAV versions and information for mod_security problems)
- 0 byte files (Reasons for empty files on the server)
- Clients (A comprehensive list of WebDAV clients, and possible problems with each one)
- Finder, OS X's built-in WebDAV client (Describes problems with Finder on various Web servers)
There is also a well maintained FAQ thread available at the ownCloud Forums which contains various additional information about WebDAV problems.
Service discovery
Some clients - especially on iOS/macOS - have problems finding the proper sync URL, even when explicitly configured to use it.
If you want to use CalDAV or CardDAV clients or other clients that require service discovery together with Nextcloud it is important to have a correct working setup of the following URLs:
https://example.com/.well-known/carddav
https://example.com/.well-known/caldav
Those need to be redirecting your clients to the correct endpoints. If Nextcloud is running at the DocumentRoot of your Web server the correct URL is https://example.com/remote.php/dav for CardDAV and CalDAV and if running in a subfolder like nextcloud, then the correct URL is https://example.com/nextcloud/remote.php/dav.
提示
On Debian/Ubuntu systems, the Apache
DocumentRootdefaults to/var/www/html. On other distributions, this path may differ. Adjust paths in the examples below accordingly.
For the first case, the .htaccess file shipped with Nextcloud should do this work for you when you're running Apache. You need to make sure that your Web server is using this file. Additionally, you need the mod_rewrite Apache module installed and AllowOverride All set in your apache2.conf or vHost-file to process these redirects. When running Nginx please refer to NGINX configuration.
For the second case, you need to add the following to /etc/apache2/apache2.conf, replacing /var/www/html with your actual DocumentRoot if it differs:
<Directory /var/www/html>
AllowOverride FileInfo
</Directory>
AllowOverride FileInfo is sufficient for the rewrite directives used by service discovery. If you already have AllowOverride All set for this directory, no change is needed. Next, create or edit the .htaccess file within the DocumentRoot of your Web server and add the following lines:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^\.well-known/carddav /nextcloud/remote.php/dav [R=301,L]
RewriteRule ^\.well-known/caldav /nextcloud/remote.php/dav [R=301,L]
RewriteRule ^\.well-known/webfinger /nextcloud/index.php/.well-known/webfinger [R=301,L]
RewriteRule ^\.well-known/nodeinfo /nextcloud/index.php/.well-known/nodeinfo [R=301,L]
</IfModule>
Make sure to change /nextcloud to the actual subfolder your Nextcloud instance is running in.
提示
If you put the above directives directly into an Apache configuration file (usually within
/etc/apache2/) instead of.htaccess, you need to prepend the first argument of eachRewriteRuleoption with a forward slash/, for example^/\.well-known/carddav. This is because Apache normalizes paths for the use in.htaccessfiles by dropping any number of leading slashes, but it does not do so for the use in its main configuration files.
If you are running NGINX, make sure location = /.well-known/carddav { and location = /.well-known/caldav { are properly configured as described in NGINX configuration, adapt to use a subfolder if necessary.
Now change the URL in the client settings to just use:
https://example.com
instead of e.g.
https://example.com/nextcloud/remote.php/dav/principals/username.
There are also several techniques to remedy this, which are described extensively at the Sabre DAV website.
Troubleshooting sharing
Users' Federated Cloud IDs not updated after a domain name change
- run Database query
DELETE FROM oc_cards_properties WHERE name = 'CLOUD' AND addressbookid = (select id from oc_addressbooks where principaluri = 'principals/system/system' AND uri = 'system');
- run occ commands
occ dav:sync-system-addressbook
occ federation:sync-addressbooks
Troubleshooting contacts & calendar
提示
Please also refer to the troubleshooting article in the groupware section: Troubleshooting.
Troubleshooting data-directory
Moving the data directory / changing the datadirectory path
For local storage, Nextcloud identifies storage by its absolute path on disk. Ideally, the location of the data directory should not change after deployment. If this is a new installation, consider reinstalling with your preferred directory location before moving into production.
警告
If you must change the
datadirectorypath -- unless the transition is handled carefully -- Nextcloud will treat its content as "new storage." This can trigger duplicate or orphaned files, lost file metadata, and the loss of previously shared links.
For safely moving the data directory, the recommended actions are:
- Make sure no cron jobs are running and, if using system cron, that the Nextcloud crontab entry is disabled.
- Stop web/app server(s).
- Move
/datato the new location (ensure you also move hidden/dot files such as.ncdata). - Create a symlink from the original location to the new location.
- Ensure permissions are still correct (including for any parent folders).
- Restart web/app server(s).
- Re-enable Nextcloud's system crontab entry (if applicable).
提示
You may need to configure your web server to support symlinks.
It is also possible to move the data directory without using symlinks, but this requires manually modifying the internal oc_storages database table:
- Make sure no cron jobs are running and, if using system cron, that the Nextcloud crontab entry is disabled.
- Stop web/app server(s).
- Move
/datato the new location (ensure you also move hidden/dot files such as.ncdata). - Update the value of
datadirectoryin yourconfig.php. - Edit the database: In the
oc_storagestable, update the path portion of theidfield of the entry beginning withlocal::/old-data-dir/(e.g., changelocal::/old-data-dir/tolocal::/new-data-dir/). - Ensure permissions are still correct (including for any parent folders).
- Restart web/app server(s).
- Re-enable Nextcloud's system crontab entry (if applicable).
注意
This method is not supported and you risk breaking your database. Always make sure you have up-to-date backups -- including your database -- and a working (tested) restore process before attempting this.
Troubleshooting quota or size issues
Sometimes it can happen that the used space reported in the web UI or with occ user:info $userId does not match the actual data stored in the user's data/$userId/files directory.
提示
Metadata, versions, trashbin and encryption keys are not counted in the used space above. Please refer to the quota documentation for details.
Running the following command can help fix the sizes and quota for a given user:
sudo -E -u www-data php occ files:scan -vvv <user-id>
If encryption was enabled earlier on the instance and disabled later on, it is likely that some size values in the database did not correctly get reset upon decrypting. You can run the following SQL query to reset those after backing up the database:
UPDATE oc_filecache SET unencrypted_size=0 WHERE encrypted=0;
Troubleshooting encrypted files
提示
Please also refer to the troubleshooting section in the encryption chapter: Server-side Encryption.
Fair Use Policy
Nextcloud is open source and you can host it for free on your own server or at a provider.
Nextcloud recommends Using Nextcloud Enterprise for deploying instances with more than 500 users. With that size, issues like a broken server or a data leak become very serious.
If there is an issue with the server, 500 people can't work. A data leak would risk the data of many users. In short, the server should be considered mission-critical. We believe you and your users would have a better experience with Nextcloud Enterprise.
Nextcloud Enterprise is pre-configured and optimised for the needs of professional organisations rather than home users. It comes with support, security and scaling benefits, compliance expertise, and access to our knowledge about running a successful Nextcloud, to get the best possible experience for users and admins. This also reduces the load on our home user forum http://help.nextcloud.com from issues unique to big deployments.
Nextcloud provides some infrastructure components needed for Nextcloud servers to run reliably. This includes notification, our app store and more. To ensure these resources do not get overloaded by administrators who run Nextcloud for thousands of users without providing financial resources to Nextcloud in return, these components are limited and will not work for more than 500 users.
We believe all organisations who run Nextcloud for hundreds of users should be officially supported. We know there can be financial restrictions for non-profit organisations and, as we want everybody to have a chance to get the most out of Nextcloud, we have special offers for NGOs, small schools and other non-profits. Please reach out to talk to us about what is possible through the contact form on our site or ask your system administrator to reach out.
Other issues
Some services like Cloudflare can cause issues by minimizing JavaScript and loading it only when needed. When having issues like a not working login button or creating new users make sure to disable such services first.
Patching Nextcloud
Obtaining a patch
If you found a related pull request on GitHub that solves your issue, or you want to help developers and verify a fix works, you can get a patch for the pull request.
- Using https://github.com/nextcloud/server/pull/26396 as an example.
- Append
.diffto the URL: https://github.com/nextcloud/server/pull/26396.diff - Download the patch to your server e.g. via
wget https://github.com/nextcloud/server/pull/26396.diff(this will place26396.diffin the local directory) - Follow the Applying a patch steps.
- If you are on an older Nextcloud version, you might first need to go to the correct backported patch for your version.
- You can find the appropriate version by looking for a link posted by
backportbot-nextcloudto the backport pull request for your release, or by checking for a developer comment with a manual backport link. Use the.diffURL of that backport PR.
Applying a patch
Patching server
Patching apps
Reverting a patch
Notes and troubleshooting
提示
You may see errors about files not being found, especially when applying patches from GitHub. Patches can include development or test files (for example, files under
build/ortests/) that are not present on your installation. These messages are expected and can be ignored if they refer only to such files.
Code signing
Nextcloud supports code signing for the core releases, and for Nextcloud applications. Code signing gives our users an additional layer of security by ensuring that nobody other than authorized persons can push updates.
It also ensures that all upgrades have been executed properly, so that no files are left behind, and all old files are properly replaced. In the past, invalid updates were a significant source of errors when updating Nextcloud.
FAQ
Why did Nextcloud add code signing?
By supporting Code Signing we add another layer of security by ensuring that nobody other than authorized persons can push updates for applications, and ensuring proper upgrades.
Do we lock down Nextcloud?
The Nextcloud project is open source and always will be. We do not want to make it more difficult for our users to run Nextcloud. Any code signing errors on upgrades will not prevent Nextcloud from running, but will display a warning on the Admin page. For applications that are not tagged "Official" the code signing process is optional.
Not open source anymore?
The Nextcloud project is open source and always will be. The code signing process is optional, though highly recommended. The code check for the core parts of Nextcloud is enabled when the Nextcloud release version branch has been set to stable.
For custom distributions of Nextcloud it is recommended to change the release version branch in version.php to something else than "stable".
Is code signing mandatory for apps?
Code signing is required for all applications on apps.nextcloud.com.
Fixing invalid code integrity messages
A code integrity error message ("Some files have not passed the integrity check…") appears on your Nextcloud admin page under "Overview", which provides the following options:
- Link to this documentation entry.
- Show a list of invalid files.
- Trigger a rescan.
To debug issues caused by the code integrity check click on "List of invalid files...", and you will be shown a text document listing the different issues. The content of the file will look similar to the following example:
Technical information
=====================
The following list covers which files have failed the integrity check. Please read
the previous linked documentation to learn more about the errors and how to fix
them.
Results
=======
- core
- INVALID_HASH
- /index.php
- /version.php
- EXTRA_FILE
- /test.php
- calendar
- EXCEPTION
- OC\IntegrityCheck\Exceptions\InvalidSignatureException
- Signature data not found.
Raw output
==========
Array
(
[core] => Array
(
[INVALID_HASH] => Array
(
[/index.php] => Array
(
[expected] =>
f1c5e2630d784bc9cb02d5a28f55d6f24d06dae2a0fee685f3
c2521b050955d9d452769f61454c9ddfa9c308146ade10546c
fa829794448eaffbc9a04a29d216
[current] =>
ce08bf30bcbb879a18b49239a9bec6b8702f52452f88a9d321
42cad8d2494d5735e6bfa0d8642b2762c62ca5be49f9bf4ec2
31d4a230559d4f3e2c471d3ea094
)
[/version.php] => Array
(
[expected] =>
c5a03bacae8dedf8b239997901ba1fffd2fe51271d13a00cc4
b34b09cca5176397a89fc27381cbb1f72855fa18b69b6f87d7
d5685c3b45aee373b09be54742ea
[current] =>
88a3a92c11db91dec1ac3be0e1c87f862c95ba6ffaaaa3f2c3
b8f682187c66f07af3a3b557a868342ef4a271218fe1c1e300
c478e6c156c5955ed53c40d06585
)
)
[EXTRA_FILE] => Array
(
[/test.php] => Array
(
[expected] =>
[current] =>
09563164f9904a837f9ca0b5f626db56c838e5098e0ccc1d8b
935f68fa03a25c5ec6f6b2d9e44a868e8b85764dafd1605522
b4af8db0ae269d73432e9a01e63a
)
)
)
[calendar] => Array
(
[EXCEPTION] => Array
(
[class] => OC\IntegrityCheck\Exceptions\InvalidSignature
Exception
[message] => Signature data not found.
)
)
)
In above error output it can be seen that:
- In the Nextcloud core (that is, the Nextcloud server itself) the files "index.php" and "version.php" do have the wrong version.
- In the Nextcloud core the unrequired extra file "/test.php" has been found.
- It was not possible to verify the signature of the calendar application.
The solution is to upload the correct "index.php" and "version.php" files, and delete the "test.php" file. For the calendar exception contact the developer of the application. For other means on how to receive support please take a look at https://nextcloud.com/support/. After fixing these problems verify by clicking "Rescan…".
提示
When using a FTP client to upload those files make sure it is using the
Binarytransfer mode instead of theASCIItransfer mode.
Rescans
Rescans are triggered at installation, and by updates. You may run scans manually with the occ command. The first command scans the Nextcloud server files, and the second command scans the named app. There is not yet a command to manually scan all apps:
occ integrity:check-core
occ integrity:check-app $appid
See Using the occ command to learn more about using occ.
Errors
注意
Please don't modify the mentioned
signature.jsonitself.
The following errors can be encountered when trying to verify a code signature.
INVALID_HASH- The file has a different hash than specified within
signature.json. This usually happens when the file has been modified after writing the signature data.
- The file has a different hash than specified within
MISSING_FILE- The file cannot be found but has been specified within
signature.json. Either a required file has been left out, orsignature.jsonneeds to be edited.
- The file cannot be found but has been specified within
EXTRA_FILE- The file does not exist in
signature.json. This usually happens when a file has been removed andsignature.jsonhas not been updated. It also happens if you have placed additional files in your Nextcloud installation folder.
- The file does not exist in
EXCEPTION- Another exception has prevented the code verification. There are currently these following exceptions:
Signature data not found.- The app has mandatory code signing enforced but no
signature.jsonfile has been found in itsappinfofolder.
- The app has mandatory code signing enforced but no
Certificate is not valid.- The certificate has not been issued by the official Nextcloud Code Signing Root Authority.
Certificate is not valid for required scope. (Requested: %s, current: %s)- The certificate is not valid for the defined application. Certificates are only valid for the defined app identifier and cannot be used for others.
Signature could not get verified.- There was a problem with verifying the signature of
signature.json.
- There was a problem with verifying the signature of
- Another exception has prevented the code verification. There are currently these following exceptions: