syncloud / platform

Run popular services on your device with one click
https://syncloud.org
GNU General Public License v3.0
400 stars 40 forks source link

Update from older Nextcloud fails #475

Closed chegeiser closed 4 years ago

chegeiser commented 4 years ago

I have Nextcloud version 19102646 installed. When I try to upgrade to 200109121 it fails - I get a 502 error when I go to the Nextcloud login page after it installs. From Issue #448 I tried to upgrade incrementally after a fresh install of 19102646 using snap. I can install 19102646 using

wget apps.syncloud.org/apps/nextcloud_19102646_$(dpkg --print-architecture).snap
snap install nextcloud_19102646_$(dpkg --print-architecture).snap --devmode

But when I try the next incremental upgrade it fails. I used

wget apps.syncloud.org/apps/nextcloud_19111297_$(dpkg --print-architecture).snap
snap install nextcloud_19111297_$(dpkg --print-architecture).snap --devmode

And got this error

error: cannot perform the following tasks:
- Run pre-refresh hook of "nextcloud" snap if present (run hook "pre-refresh":
-----
2020-02-21 00:35:11,816 - pg_dumpall - INFO - executing: snap run nextcloud.pgdumpall -f /var/snap/nextcloud/x1/database.dump
pg_dumpall.bin: could not open the output file "/var/snap/nextcloud/x1/database.dump": Permission denied
Traceback (most recent call last):
  File "/snap/nextcloud/x1/meta/hooks/pre-refresh", line 7, in <module>
    Installer().pre_refresh()
  File "/snap/nextcloud/x1/hooks/installer.py", line 98, in pre_refresh
    db.dumpall(join(self.snap_data_dir, 'database.dump'))
  File "/snap/nextcloud/x1/hooks/postgres.py", line 21, in dumpall
    log.info(check_output(cmd, shell=True))
  File "/snap/nextcloud/current/python/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command 'snap run nextcloud.pgdumpall -f /var/snap/nextcl

Any ideas how to get this upgrade to work? Thank you!

chegeiser commented 4 years ago

One additional note. I have a backup of my settings, but if I try to load the backup directly to 200109121 I get the 502 error. The backup loads fine in version 19102646 .

cyberb commented 4 years ago

Could you try without backup restore to see if that works:

  1. Remove Nextcloud
  2. Install v15:
    snap install nextcloud_19102646_$(dpkg --print-architecture).snap --devmode
  3. Install v16
    snap install nextcloud_19111297_$(dpkg --print-architecture).snap --devmode
chegeiser commented 4 years ago

Doing it this way I am able to upgrade to v16, but when I try to install the backup I get the 502 error again. So I tried to install through v16 an then use the built-in upgrade feature to upgrade to the latest build - and that gives me "Error: cannot perform operation on local snap". So stuck at v16 with no way to load from the backup. Logs sent.

cyberb commented 4 years ago

Can you install v15 then run this command:

ls -la /var/snap/nextcloud/x1/database.dump

Then restore backup and run this command again and post the output from both runs before and after tge backup restore.

chegeiser commented 4 years ago

After installing v15 I get this:

root@syncloud:~# ls -la /var/snap/nextcloud/x1/database.dump
ls: cannot access /var/snap/nextcloud/x1/database.dump: No such file or directory

Then I did the restore and this:

root@syncloud:~# ls -la /var/snap/nextcloud/x1/database.dump
ls: cannot access /var/snap/nextcloud/x1/database.dump: No such file or directory

After the restore from backup my data is available - so the restore works. Still not sure how to upgrade since the upgrade seems to break the install.

cyberb commented 4 years ago

Ok, if you run v16 now, what error do you get:

snap install nextcloud_19111297_$(dpkg --print-architecture).snap --devmode
chegeiser commented 4 years ago

This is what I get

root@syncloud:~# snap install nextcloud_19111297_$(dpkg --print-architecture).snap --devmode
error: cannot perform the following tasks:
- Run pre-refresh hook of "nextcloud" snap if present (run hook "pre-refresh":
-----
2020-02-22 16:11:44,243 - pg_dumpall - INFO - executing: snap run nextcloud.pgdumpall -f /var/snap/nextcloud/x1/database.dump
pg_dumpall.bin: could not open the output file "/var/snap/nextcloud/x1/database.dump": Permission denied
Traceback (most recent call last):
  File "/snap/nextcloud/x1/meta/hooks/pre-refresh", line 7, in <module>
    Installer().pre_refresh()
  File "/snap/nextcloud/x1/hooks/installer.py", line 98, in pre_refresh
    db.dumpall(join(self.snap_data_dir, 'database.dump'))
  File "/snap/nextcloud/x1/hooks/postgres.py", line 21, in dumpall
    log.info(check_output(cmd, shell=True))
  File "/snap/nextcloud/current/python/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command 'snap run nextcloud.pgdumpall -f /var/snap/nextcloud/x1/database.dump' returned non-zero exit status 1
-----)
chegeiser commented 4 years ago

and

root@syncloud:~# ls -la /var/snap/nextcloud/x1/database.dump
ls: cannot access /var/snap/nextcloud/x1/database.dump: No such file or directory
cyberb commented 4 years ago

What about:

ls -la /var/snap/nextcloud/x1

And

ls -la /var/snap/nextcloud
chegeiser commented 4 years ago
root@syncloud:~# ls -la /var/snap/nextcloud/x1
total 8
drwxr-xr-x 2 root root 4096 Apr  9  2019 .
drwxr-xr-x 4 root root 4096 Feb 22 04:37 ..

And

root@syncloud:~# ls -la /var/snap/nextcloud
total 16
drwxr-xr-x 4 root      root      4096 Feb 22 04:37 .
drwxr-xr-x 5 root      root      4096 Feb 22 04:55 ..
drwxr-xr-x 8 nextcloud nextcloud 4096 Feb 22 04:48 common
lrwxrwxrwx 1 root      root         2 Feb 22 04:37 current -> x1
drwxr-xr-x 2 root      root      4096 Apr  9  2019 x1
cyberb commented 4 years ago

Can you run this:

chown nextcloud. /var/snap/nextcloud/x1

And then v16 upgrade

chegeiser commented 4 years ago

It seemed like the install went further, but eventually errorred out with

  There are no commands defined in the "ldap" namespace.

2020-02-22 22:54:10,251 - nextcloud_occ - ERROR - occ error: 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
Traceback (most recent call last):
  File "/snap/nextcloud/x2/meta/hooks/configure", line 7, in <module>
    Installer().configure()
  File "/snap/nextcloud/x2/hooks/installer.py", line 112, in configure
    self.occ.run('ldap:set-config s01 ldapEmailAttribute mail')
  File "/snap/nextcloud/x2/hooks/octools.py", line 19, in run
    raise e
subprocess.CalledProcessError: Command '/snap/nextcloud/current/bin/occ-runner ldap:set-config s01 ldapEmailAttribute mail' returned non-zero exit status 1
-----)
cyberb commented 4 years ago

Try opening browser to continue the upgrade.

chegeiser commented 4 years ago

After the above error I checked my nextcloud account and the login screen requested I click an update button. I did, and it ran some more processes and upgraded. The Nextcloud settings page shows v15 is installed, however the Syncloud dashboard says it's version 19102646 and when I use Syncloud to try and upgrade to 200109121 it fails with this cannot perform operation on local snap.

cyberb commented 4 years ago

Could you run:

snap install nextcloud_19111297_$(dpkg --print-architecture).snap --devmode
chegeiser commented 4 years ago

That got me to version 16.0.5. Syncloud says I’m on 19111297 and that version 200109121 is available but using the upgrade button fails with the error cannot perform operation on local snap

cyberb commented 4 years ago

This should get you back to stable channel:

snap refresh nextcloud --amend
chegeiser commented 4 years ago

That worked! Thank you.