I accidentally skipped multiple major releases while executing snap refresh nextcloud so occ upgrade couldn’t run because it is not supported.
But what do you do if you accidentally skipped major releases?
I Figured out that you can change the symbolic links to the previous versions in /snap/nextcloud and /var/snap/nextcloud and then restart the nextcloud snap. I was able to get Nextcloud 16 back online with this. It is working exactly like before except for one thing. Snap list still lists Nextcloud as the upgraded 19 Version, so I think this is why I get the following error if I try to do:
snap refresh nextcloud --channel=16/stable
error: cannot perform the following tasks:
- Run pre-refresh hook of “nextcloud” snap if present (run hook “pre-refresh”: error: cannot find hook “pre-refresh” in “nextcloud”)
Here is some additional info on what I did exactly after that accident of upgrading from 16 to 19.
cd /snap/nextcloud
ll
total 8
drwxr-xr-x 4 root root 4096 Jun 29 16:54 ./
drwxr-xr-x 6 root root 4096 Jun 28 18:52 …/
drwxr-xr-x 25 root root 1101 Oct 25 2019 16739/
drwxr-xr-x 26 root root 502 Jun 24 03:05 21796/
lrwxrwxrwx 1 root root 5 Jun 29 16:54 current → 21796/rm current
ln -s 16739 current
ll
total 8
drwxr-xr-x 4 root root 4096 Jun 29 16:54 ./
drwxr-xr-x 6 root root 4096 Jun 28 18:52 …/
drwxr-xr-x 25 root root 1101 Oct 25 2019 16739/
drwxr-xr-x 26 root root 502 Jun 24 03:05 21796/
lrwxrwxrwx 1 root root 5 Jun 29 16:54 current → 16739/snap stop nextcloud
Stopped.snap start nextcloud
Started.cd /snap/nextcloud/current/bin/
sudo -i nextcloud.occ upgrade
Nextcloud is already latest versioncd /var/snap/nextcloud/
ll
total 20
drwxr-xr-x 5 root root 4096 Jun 29 17:11 ./
drwxr-xr-x 5 root root 4096 Jun 28 18:52 …/
drwxr-xr-x 8 root root 4096 Nov 7 2019 16739/
drwxr-xr-x 8 root root 4096 Nov 7 2019 21796/
drwxr-xr-x 3 root root 4096 Nov 7 2019 common/
lrwxrwxrwx 1 root root 5 Jun 29 17:11 current → 21796/rm current
ln -s 16739 current
ll
total 20
drwxr-xr-x 5 root root 4096 Jun 29 17:18 ./
drwxr-xr-x 5 root root 4096 Jun 28 18:52 …/
drwxr-xr-x 8 root root 4096 Nov 7 2019 16739/
drwxr-xr-x 8 root root 4096 Nov 7 2019 21796/
drwxr-xr-x 3 root root 4096 Nov 7 2019 common/
lrwxrwxrwx 1 root root 5 Jun 29 17:18 current → 16739/snap stop nextcloud
Stopped.snap start nextcloud
Started.cd /snap/nextcloud/current/bin/
sudo -i nextcloud.occ upgrade
Nextcloud is already latest versionsnap list
Name Version Rev Tracking Publisher Notes
core 16-2.45.1 9436 latest/stable canonicalâś“ core
core18 20200427 1754 latest/stable canonicalâś“ base
nextcloud 19.0.0snap1 21796 latest/stable nextcloudâś“ -snap refresh nextcloud --channel=16/stable
error: cannot perform the following tasks:
- Run pre-refresh hook of “nextcloud” snap if present (run hook “pre-refresh”: error: cannot find hook “pre-refresh” in “nextcloud”)
So how do I get snap to list Nextcloud as V16 again as if nothing had happened, so I can try to run the Update incrementally, again, hopefully, like described below?
Update Nextcloud Snap
For updating snaps, use …
cd /snap/nextcloud/current/bin
snap refresh nextcloud --channel=16/stable
sudo -i nextcloud.occ upgrade
(or whatever version you’re on)
Then just keep incrementing the version…
when you’re up to the latest, use
snap refresh nextcloud --channel=stable