The Hoof & Paw
DocsCategoriesTagsView the current conditions from the WolfspyreLabs WeatherstationToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

Updating Nextcloud through the CLI

Updating Nextcloud Server is a whole lot easier

I don’t like the k8s version of Nextcloud server. It simply feels like the wrong tool for the job.

Instead I run a VM and manage nextcloud as usual.

CLI Updating for the win


Check to see if there’s an update

root@bluebox:~# cd /var/www/nextcloud && sudo -u www-data /var/www/nextcloud/occ update:check && cd $OLDPWD

1
2
3
4
root@bluebox:~# cd /var/www/nextcloud && sudo -u www-data  /var/www/nextcloud/occ update:check && cd $OLDPWD

Nextcloud 23.0.6 is available. Get more information on how to update at https://docs.nextcloud.com/server/23/admin_manual/maintenance/upgrade.html.
1 update available

That’s pretty slick.


Update it for me

root@bluebox:~# cd /var/www/nextcloud && sudo -u www-data php --define apc.enable_cli=1 /var/www/nextcloud/updater/updater.phar && cd $OLDPWD

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
root@bluebox:~/# sudo -u www-data php --define apc.enable_cli=1 /var/www/nextcloud/updater/updater.phar
Nextcloud Updater - version: v20.0.0beta4-11-g68fa0d4

Current version is 23.0.5.

Update to Nextcloud 23.0.6 available. (channel: "stable")
Following file will be downloaded automatically: https://download.nextcloud.com/server/releases/nextcloud-23.0.6.zip
Open changelog โ†—

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

Start update? [y/N] 

At which point, you press….. (you guessed it) y:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20

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
[โœ”] Create backup
[โœ”] Downloading
[โœ”] Verify integrity
[โœ”] Extracting
[โœ”] Enable maintenance mode
[โœ”] 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]

At which point, you press….. (you guessed it) y:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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
Setting log level to debug
Repair step: Repair MySQL collation
Repair info: Not a mysql database -> nothing to do
Repair step: Repair SQLite autoincrement
Repair step: Copy data from accounts table when migrating from ownCloud
Repair step: Drop account terms table when migrating from ownCloud
Updating database schema
Updated database
Updating <circles> ...
Repair step: Upgrading Circles App
Updated <circles> to 23.1.2
Update app analytics from App Store
Update app calendar from App Store
Repair step: Update name of the stored view
Update app deck from App Store
Update app groupfolders from App Store
Update app mail from App Store
Repair step: Restore default tags that are missing
Repair info: Looking up default tags
Repair info: 0 accounts to check found
Restore default tags that are missing

 Starting ...
    0/0 [>---------------------------]   0%
Repair step: Add a generated message-id to all Mail messages that have none
Repair info: Looking up messages without a message-id
Repair step: Purify and migrate collected mail addresses
Purify and migrate collected mail addresses

 Starting ...
    0/0 [->--------------------------]   0%
Repair step: Insert background jobs for all accounts
Insert background jobs for all accounts

 Starting ...
    0/0 [--->------------------------]   0%
Repair step: Make Mail itinerary extractor executable
Repair step: Create or update provisioned Mail accounts
Repair info: 0 accounts provisioned
Repair step: Repair Broken Threads for all mail accounts
Repair info: Repaired threads, 0 messages updated
Repair step: Repair MySQL collation
Repair info: Not a mysql database -> nothing to do
Repair step: Repair mime types
Repair step: Clean tags and favorites
Repair info: 0 tags of deleted users have been removed.
Repair info: 0 tags for delete files have been removed.
Repair info: 0 tag entries for deleted tags have been removed.
Repair info: 0 tags with no entries have been removed.
Repair step: Repair invalid shares
Repair step: Move .step file of updater to backup location
Repair info: .step file exists
Repair info: .step-previous-update removed
Repair info: .step file moved to .step-previous-update
Repair step: Add move avatar background job
Repair info: Repair step already executed
Repair step: Add preview cleanup background jobs
Repair step: Migrate oauth2_clients table to nextcloud schema
Repair info: Update the oauth2_access_tokens table schema.
Repair info: Update the oauth2_clients table schema.
Repair step: Fix potential broken mount points
Repair info: No mounts updated
Repair step: Repair language codes
Repair step: Install new core bundle components
Repair step: Add log rotate job
Repair step: Clear frontend caches
Repair info: Image cache cleared
Repair info: SCSS cache cleared
Repair info: JS cache cleared
Repair step: Clear every generated avatar on major updates
Repair step: Add preview background cleanup job
Repair step: Queue a one-time job to cleanup old backups of the updater
Repair step: Cleanup invalid photocache files for carddav
Repair step: Add background job to cleanup login flow v2 tokens
Repair step: Remove potentially over exposing share links
Repair info: No need to remove link shares.
Repair step: Clear access cache of projects
Repair step: Reset generated avatar flag
Repair step: Keep legacy encryption enabled
Repair step: Check encryption key format
Repair step: Remove old dashboard app config data
Repair step: Add job to cleanup the bruteforce entries
Repair step: Queue a one-time job to check for user uploaded certificates
Repair step: Repair DAV shares
Repair step: Add background job to set the lookup server share state for users
Starting code integrity check...
Finished code integrity check
Update successful
Maintenance mode is kept active
Resetting log level

Keep maintenance mode active? [y/N]

I didn’t have an explicit need to keep maintenance mode on, so I just hit N here

1
2
3
4
5
6
7

Keep maintenance mode active? [y/N] n

Maintenance mode disabled

Maintenance mode is disabled
root@bluebox:~/#

Reboot


Perform the Major version update

root@bluebox:~# cd /var/www/nextcloud && sudo -u www-data php --define apc.enable_cli=1 /var/www/nextcloud/updater/updater.phar

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
root@bluebox:~# cd /var/www/nextcloud && sudo -u www-data php --define apc.enable_cli=1 /var/www/nextcloud/updater/updater.phar
Nextcloud Updater - version: v20.0.0beta4-11-g68fa0d4

Current version is 23.0.6.

Update to Nextcloud 24.0.2 available. (channel: "stable")
Following file will be downloaded automatically: https://download.nextcloud.com/server/releases/nextcloud-24.0.2.zip
Open changelog โ†—

Steps that will be executed:
[ ] Check for expected files
[ ] Check for write permissions
[ ] Create backup
[ ] Downloading
[ ] Verify integrity
[ ] Extracting
[ ] Enable maintenance mode
[ ] 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
[โœ”] Create backup
[โœ”] Downloading
[โœ”] Verify integrity
[โœ”] Extracting
[โœ”] Enable maintenance mode
[โœ”] 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]

No….. I’d rather you didn’t do anything. I like being out of date….

Press Y here

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236

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
[โœ”] Create backup
[โœ”] Downloading
[โœ”] Verify integrity
[โœ”] Extracting
[โœ”] Enable maintenance mode
[โœ”] 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
Setting log level to debug
Repair step: Repair MySQL collation
Repair info: Not a mysql database -> nothing to do
Repair step: Repair SQLite autoincrement
Repair step: Copy data from accounts table when migrating from ownCloud
Repair step: Drop account terms table when migrating from ownCloud
Updating database schema
Updated database
Disabled incompatible app: breezedark
Disabled incompatible app: deck
Disabled incompatible app: external
Disabled incompatible app: groupfolders
Disabled incompatible app: ocdownloader
Updating <federation> ...
Updated <federation> to 1.14.0
Updating <lookup_server_connector> ...
Updated <lookup_server_connector> to 1.12.0
Updating <oauth2> ...
Repair step: Update OAuth token expiration times
Updated <oauth2> to 1.12.0
Updating <password_policy> ...
Updated <password_policy> to 1.14.0
Updating <files> ...
Updated <files> to 1.19.0
Updating <activity> ...
Updated <activity> to 2.16.0
Updating <circles> ...
Repair step: Upgrading Circles App
Updated <circles> to 24.0.0
Updating <cloud_federation_api> ...
Updated <cloud_federation_api> to 1.7.0
Updating <dav> ...
Repair step: Fix component of birthday calendars
Repair info: 1 birthday calendars updated.
Repair step: Regenerating birthday calendars to use new icons and fix old birthday events without year
Repair info: Repair step already executed
Repair step: Fix broken values of calendar objects
Fix broken values of calendar objects

 Starting ...
    0/0 [>---------------------------]   0%
Repair step: Registering building of calendar search index as background job
Repair info: Repair step already executed
Repair step: Register building of social profile search index as background job
Repair step: Registering background jobs to update cache for webcal calendars
Repair info: Added 0 background jobs to update webcal calendars
Repair step: Registering building of calendar reminder index as background job
Repair info: Repair step already executed
Repair step: Clean up orphan event and contact data
Repair info: 0 events without a calendar have been cleaned up
Repair info: 0 properties without an events have been cleaned up
Repair info: 0 changes without a calendar have been cleaned up
Repair info: 0 cached events without a calendar subscription have been cleaned up
Repair info: 0 changes without a calendar subscription have been cleaned up
Repair info: 0 contacts without an addressbook have been cleaned up
Repair info: 0 properties without a contact have been cleaned up
Repair info: 0 changes without an addressbook have been cleaned up
Repair step: Remove activity entries of private events
Repair info: Removed 0 activity entries
Repair step: Clean up old calendar subscriptions from deleted users that were not cleaned-up
Clean up old calendar subscriptions from deleted users that were not cleaned-up

 Starting ...
    0/0 [->--------------------------]   0%
Repair info: 0 calendar subscriptions without an user have been cleaned up
Updated <dav> to 1.22.0
Updating <files_sharing> ...
Repair step: Fix the share type of guest shares when migrating from ownCloud
Repair step: Copy the share password into the dedicated column
Repair step: Set existing shares as accepted
Updated <files_sharing> to 1.16.2
Updating <files_trashbin> ...
Updated <files_trashbin> to 1.14.0
Updating <files_versions> ...
Updated <files_versions> to 1.17.0
Updating <sharebymail> ...
Updated <sharebymail> to 1.14.0
Updating <workflowengine> ...
Repair step: Populating added database structures for workflows
Updated <workflowengine> to 2.6.0
Updating <admin_audit> ...
Updated <admin_audit> to 1.14.0
Updating <comments> ...
Updated <comments> to 1.14.0
Updating <firstrunwizard> ...
Updated <firstrunwizard> to 2.13.0
Updating <nextcloud_announcements> ...
Updated <nextcloud_announcements> to 1.13.0
Updating <notifications> ...
Updated <notifications> to 2.12.0
Updating <systemtags> ...
Updated <systemtags> to 1.14.0
Updating <theming> ...
Updated <theming> to 1.15.0
Updating <accessibility> ...
Repair step: Migrate old user config
Migrate old user config

 Starting ...
    0/0 [--->------------------------]   0%
Updated <accessibility> to 1.10.0
Updating <contactsinteraction> ...
Updated <contactsinteraction> to 1.5.0
Updating <dashboard> ...
Updated <dashboard> to 7.4.0
Updating <federatedfilesharing> ...
Updated <federatedfilesharing> to 1.14.0
Updating <files_pdfviewer> ...
Updated <files_pdfviewer> to 2.5.0
Updating <files_rightclick> ...
Updated <files_rightclick> to 1.3.0
Updating <files_videoplayer> ...
Updated <files_videoplayer> to 1.13.0
Updating <logreader> ...
Updated <logreader> to 2.9.0
Updating <photos> ...
Updated <photos> to 1.6.0
Updating <privacy> ...
Updated <privacy> to 1.8.0
Updating <provisioning_api> ...
Updated <provisioning_api> to 1.14.0
Updating <recommendations> ...
Updated <recommendations> to 1.3.0
Updating <serverinfo> ...
Updated <serverinfo> to 1.14.0
Updating <settings> ...
Updated <settings> to 1.6.0
Updating <support> ...
Repair step: Switches from default updater server to the customer one if a valid subscription is available
Repair info: Repair step already executed
Updated <support> to 1.7.0
Updating <survey_client> ...
Repair step: Send an admin notification if monthly report is disabled
Updated <survey_client> to 1.12.0
Updating <text> ...
Updated <text> to 3.5.1
Updating <twofactor_backupcodes> ...
Repair step: Add background job to check for backup codes
Updated <twofactor_backupcodes> to 1.13.0
Updating <updatenotification> ...
Updated <updatenotification> to 1.14.0
Updating <user_status> ...
Updated <user_status> to 1.4.0
Updating <viewer> ...
Updated <viewer> to 1.8.0
Updating <weather_status> ...
Updated <weather_status> to 1.4.0
Update app breezedark from App Store
Update app deck from App Store
Update app external from App Store
Repair step: Copy default images to the app data directory
Repair info: Icon external.svg already exists
Repair info: Icon external-dark.svg already exists
Repair info: Icon settings.svg already exists
Repair step: Copy default images to the app data directory
Repair info: Icon external.svg already exists
Repair info: Icon external-dark.svg already exists
Repair info: Icon settings.svg already exists
Repair step: Copy default images to the app data directory
Repair info: Icon external.svg already exists
Repair info: Icon external-dark.svg already exists
Repair info: Icon settings.svg already exists
Update app groupfolders from App Store
Repair step: Repair MySQL collation
Repair info: Not a mysql database -> nothing to do
Repair step: Repair mime types
Repair step: Clean tags and favorites
Repair info: 0 tags of deleted users have been removed.
Repair info: 0 tags for delete files have been removed.
Repair info: 0 tag entries for deleted tags have been removed.
Repair info: 0 tags with no entries have been removed.
Repair step: Repair invalid shares
Repair step: Move .step file of updater to backup location
Repair info: .step file exists
Repair info: .step-previous-update removed
Repair info: .step file moved to .step-previous-update
Repair step: Add move avatar background job
Repair info: Repair step already executed
Repair step: Add preview cleanup background jobs
Repair step: Migrate oauth2_clients table to nextcloud schema
Repair info: Update the oauth2_access_tokens table schema.
Repair info: Update the oauth2_clients table schema.
Repair step: Fix potential broken mount points
Repair info: No mounts updated
Repair step: Repair language codes
Repair step: Install new core bundle components
Repair step: Add log rotate job
Repair step: Clear frontend caches
Repair info: Image cache cleared
Repair info: SCSS cache cleared
Repair info: JS cache cleared
Repair step: Clear every generated avatar on major updates
Repair step: Add preview background cleanup job
Repair step: Queue a one-time job to cleanup old backups of the updater
Repair step: Cleanup invalid photocache files for carddav
Repair step: Add background job to cleanup login flow v2 tokens
Repair step: Remove potentially over exposing share links
Repair info: No need to remove link shares.
Repair step: Clear access cache of projects
Repair step: Reset generated avatar flag
Repair step: Keep legacy encryption enabled
Repair step: Check encryption key format
Repair step: Remove old dashboard app config data
Repair step: Add job to cleanup the bruteforce entries
Repair step: Queue a one-time job to check for user uploaded certificates
Repair step: Repair DAV shares
Repair step: Add background job to set the lookup server share state for users
Starting code integrity check...
Finished code integrity check
Update successful
Maintenance mode is kept active
Resetting log level

Keep maintenance mode active? [y/N]

Press N

1
2
3
4
5
6
7

Keep maintenance mode active? [y/N] N

Maintenance mode disabled

Maintenance mode is disabled
root@bluebox:/var/www/nextcloud#

Validate everything’s Kosher

root@bluebox:/var/www/nextcloud# cd /var/www/nextcloud&& sudo -u www-data /var/www/nextcloud/occ update:check && sudo -u www-data /var/www/nextcloud/occ upgrade:

1
2
3
root@bluebox:/var/www/nextcloud# cd /var/www/nextcloud&& sudo -u www-data /var/www/nextcloud/occ update:check && sudo -u www-data  /var/www/nextcloud/occ upgrade
Everything up to date
Nextcloud is already latest version

Mischief Managed

Stupendously simple now.

Thanks Nextcloud team :)