Backup and Upgrade Nextcloud from 13.0.0 to 14.0.1 - Notes


Backup Prior to Updating

Enable Maintenance Mode

Navigate to the nextcloud directory and enable maintenance mode:

sudo -u www-data php occ maintenance:mode --on

Backup Filesystem

sudo rsync -Aax /var/www/nextcloud/ ~/nextcloud-dirbkp_`date +"%Y%m%d"`

Backup Database

mysqldump --single-transaction -u user -p nextcloud > ~/nextcloud-sqlbkp_`date +"%Y%m%d"`.bak

Upgrade Using the updater.phar Package

From the upgrade docs:

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.

https://docs.nextcloud.com/server/13/admin_manual/maintenance/update.html#using-the-command-line-based-updater

Error due to Presence of Let's Encrypt .well-known Directory

The Nextcloud CLI updater.phar routine does not like the presence of Let's Encrypt's .well-known directory. A simple strategy is to just move it out of the web root for the duration of the upgrade, and restoring it to it's original location when done. Alternatively it would be feasible to serve the .well-known directory from a different path via a web server config.

sudo -u www-data php updater.phar
Nextcloud Updater - version: v13.0.0beta1

Current version is 13.0.0.

Update to Nextcloud 14.0.1 available. (channel: "stable")
Following file will be downloaded automatically: https://download.nextcloud.com/server/releases/nextcloud-14.0.1.zip

Steps that will be executed:
[ ] Check for expected files
[ ] Check for write permissions
[ ] Enable maintenance mode
[ ] Create backup
[ ] Downloading
[ ] Verify integrity
[ ] Extracting
[ ] Replace entry points
[ ] Delete old files
[ ] Move new files in place
[ ] Done

Start update? [y/N] y

Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.

[✘] Check for expected files failed
The following extra files have been found:
    .well-known

Update failed. To resume or retry just execute the updater again.

The update went off without a hitch after temporarily moving the .well-known directory from the Nextcloud root:

sudo -u www-data php updater/updater.phar
Nextcloud Updater - version: v13.0.0beta1

Current version is 13.0.0.

Update to Nextcloud 14.0.1 available. (channel: "stable")
Following file will be downloaded automatically: https://download.nextcloud.com/server/releases/nextcloud-14.0.1.zip

Steps that will be executed:
[ ] Check for expected files
[ ] Check for write permissions
[ ] Enable maintenance mode
[ ] Create backup
[ ] Downloading
[ ] Verify integrity
[ ] Extracting
[ ] Replace entry points
[ ] Delete old files
[ ] Move new files in place
[ ] Done

Start update? [y/N] y

Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.

[✔] Check for expected files
[✔] Check for write permissions
[✔] Enable maintenance mode
[✔] Create backup
[✔] Downloading
[✔] Verify integrity
[✔] Extracting
[✔] Replace entry points
[✔] Delete old files
[✔] Move new files in place
[✔] Done

Update of code successful.

Should the "occ upgrade" command be executed? [Y/n] y
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
Disabled incompatible app: spreed
Updating  ...
Updated  to 1.4.0
Updating  ...
Updated  to 1.3.2
Updating  ...
Updated  to 2.6.0
Updating  ...
Updated  to 1.3.0
Updating  ...
Updated  to 18.1.0
Updating  ...
Updated  to 1.4.0
Updating  ...
Updated  to 1.4.0
Updating  ...
Updated  to 1.4.0
Updating  ...
Updated  to 1.2.0
Updating  ...
Updated  to 1.3.1
Updating  ...
Updated  to 1.4.1
Updating  ...
Updated  to 1.4.0
Updating  ...
Updated  to 1.2.0
Updating  ...
Updated  to 1.2.1
Updating  ...
Updated  to 1.9.0
Updating  ...
Updated  to 2.7.0
Updating  ...
Fix broken values of calendar objects

 Starting ...
     0/0 [>---------------------------]   0%
     Updated  to 1.6.0
     Updating  ...
     Updated  to 1.6.2
     Updating  ...
     Updated  to 1.4.1
     Updating  ...
     Updated  to 1.7.1
     Updating  ...
     Updated  to 1.4.0
     Updating  ...
     Updated  to 1.4.0
     Updating  ...
     Updated  to 1.4.0
     Updating  ...
     Updated  to 2.3.0
     Updating  ...
     Updated  to 1.3.0
     Updating  ...
     Updated  to 2.2.1
     Updating  ...
     Updated  to 1.4.0
     Updating  ...
     Updated  to 1.5.0
     Checking for update of app activity in appstore
     Checked for update of app "activity" in appstore
     Checking for update of app calendar in appstore
     Update app calendar from appstore
     Checked for update of app "calendar" in appstore
     Checking for update of app cloud_federation_api in appstore
     Checked for update of app "cloud_federation_api" in appstore
     Checking for update of app comments in appstore
     Checked for update of app "comments" in appstore
     Checking for update of app contacts in appstore
     Update app contacts from appstore
     Checked for update of app "contacts" in appstore
     Checking for update of app dav in appstore
     Checked for update of app "dav" in appstore
     Checking for update of app federatedfilesharing in appstore
     Checked for update of app "federatedfilesharing" in appstore
     Checking for update of app federation in appstore
     Checked for update of app "federation" in appstore
     Checking for update of app files in appstore
     Checked for update of app "files" in appstore
     Checking for update of app files_markdown in appstore
     Checked for update of app "files_markdown" in appstore
     Checking for update of app files_pdfviewer in appstore
     Checked for update of app "files_pdfviewer" in appstore
     Checking for update of app files_sharing in appstore
     Checked for update of app "files_sharing" in appstore
     Checking for update of app files_texteditor in appstore
     Checked for update of app "files_texteditor" in appstore
     Checking for update of app files_trashbin in appstore
     Checked for update of app "files_trashbin" in appstore
     Checking for update of app files_versions in appstore
     Checked for update of app "files_versions" in appstore
     Checking for update of app files_videoplayer in appstore
     Checked for update of app "files_videoplayer" in appstore
     Checking for update of app firstrunwizard in appstore
     Checked for update of app "firstrunwizard" in appstore
     Checking for update of app gallery in appstore
     Checked for update of app "gallery" in appstore
     Checking for update of app logreader in appstore
     Checked for update of app "logreader" in appstore
     Checking for update of app lookup_server_connector in appstore
     Checked for update of app "lookup_server_connector" in appstore
     Checking for update of app mail in appstore
     Update app mail from appstore
     Purify and migrate collected mail addresses
     
      Starting ...
       0/7 [>---------------------------]   0%
        Starting ...
         7/7 [============================] 100%
         Checked for update of app "mail" in appstore
         Checking for update of app nextcloud_announcements in appstore
         Checked for update of app "nextcloud_announcements" in appstore
         Checking for update of app notes in appstore
         Checked for update of app "notes" in appstore
         Checking for update of app notifications in appstore
         Checked for update of app "notifications" in appstore
         Checking for update of app oauth2 in appstore
         Checked for update of app "oauth2" in appstore
         Checking for update of app password_policy in appstore
         Checked for update of app "password_policy" in appstore
         Checking for update of app provisioning_api in appstore
         Checked for update of app "provisioning_api" in appstore
         Checking for update of app serverinfo in appstore
         Checked for update of app "serverinfo" in appstore
         Checking for update of app sharebymail in appstore
         Checked for update of app "sharebymail" in appstore
         Checking for update of app survey_client in appstore
         Checked for update of app "survey_client" in appstore
         Checking for update of app systemtags in appstore
         Checked for update of app "systemtags" in appstore
         Checking for update of app theming in appstore
         Checked for update of app "theming" in appstore
         Checking for update of app twofactor_backupcodes in appstore
         Checked for update of app "twofactor_backupcodes" in appstore
         Checking for update of app updatenotification in appstore
         Checked for update of app "updatenotification" in appstore
         Checking for update of app workflowengine in appstore
         Checked for update of app "workflowengine" in appstore
         Starting code integrity check...
         Finished code integrity check
         Update successful
         Maintenance mode is kept active
         Reset log level
         
         Keep maintenance mode active? [y/N] n
         
         Maintenance mode is disabled

Helpful Links

Further Upgrades

Version 14.0.1 to 14.0.3

Missing Indexes

The following message appeared in the admin dashboard:

The database is missing some indexes. Due to the fact that adding indexes on big tables could take some time they were not added automatically. By running "occ db:add-missing-indices" those missing indexes could be added manually while the instance keeps running. Once the indexes are added queries to those tables are usually much faster.

    Missing index "share_with_index" in table "oc_share".
    Missing index "parent_index" in table "oc_share".
    Missing index "fs_mtime" in table "oc_filecache".

I added the indices with the following command:

sudo -u www-data php occ db:add-missing-indices
Check indices of the share table.
Adding additional share_with index to the share table, this can take some time...
Share table updated successfully.
Adding additional parent index to the share table, this can take some time...
Share table updated successfully.
Adding additional mtime index to the filecache table, this can take some time...
Filecache table updated successfully.

Tags:  Nextcloud

Comments:


Gravatar of Kyle Jones

Knowledge Base is a repository for various notes, guides, and thoughts on a wide range of IT related topics. Read more...

Sponsored By:


Web development services by Say Web Solutions. Visit website.