Nextcloud v211225439 cannot be installed from scratch

Hi team,
after a complete removal of Nextcloud I cannot install it anymore. I have renamed the data folder (as /opt/disk/external/nextcloud_old) but there still remains something old in the DB that conflicts. See below.
Thanks in advance
Simone

root@syncloud:~# sudo snap install nextcloud
error: cannot perform the following tasks:
- Run configure hook of "nextcloud" snap if present (run hook "configure":
-----
2021-12-26 16:22:30,173 - nextcloud_config - INFO - setting value: datadirectory = /opt/disk/external/nextcloud
2021-12-26 16:22:31,846 - database - INFO - postgres executing: snap run nextcloud.psql -U nextcloud -d postgres -c "ALTER USER nextcloud WITH PASSWORD 'nextcloud';"
2021-12-26 16:22:32,086 - database - INFO - ALTER ROLE
2021-12-26 16:23:44,158 - nextcloud_occ - INFO - Nextcloud was successfully installed
2021-12-26 16:23:51,325 - nextcloud_occ - INFO - user_ldap 1.13.0 enabled
2021-12-26 16:23:53,240 - nextcloud_occ - INFO - Created new configuration with configID s01
2021-12-26 16:23:55,134 - nextcloud_occ - INFO - Created new configuration with configID s02
2021-12-26 16:24:36,630 - nextcloud_occ - INFO - All tables already up to date!
2021-12-26 16:24:36,631 - cron - INFO - running: /usr/bin/snap run nextcloud.cron
Fontconfig error: Cannot load default config file
2021-12-26 16:24:43,602 - cron - INFO - b''
2021-12-26 16:24:43,603 - database - INFO - postgres executing: snap run nextcloud.psql -U nextcloud -d nextcloud -c "update oc_ldap_group_mapping set owncloud_name = 'admin';"
ERROR:  duplicate key value violates unique constraint "owncloud_name_groups"
DETAIL:  Key (owncloud_name)=(admin) already exists.
2021-12-26 16:24:43,706 - database - ERROR - postgres error:
Traceback (most recent call last):
  File "/snap/nextcloud/211225439/meta/hooks/configure", line 7, in <module>
    Installer().configure()
  File "/snap/nextcloud/211225439/hooks/installer.py", line 110, in configure
    self.initialize(app_storage_dir)
  File "/snap/nextcloud/211225439/hooks/installer.py", line 241, in initialize
    self.db.execute(DB_NAME, DB_USER, "update oc_ldap_group_mapping set owncloud_name = 'admin';")
  File "/snap/nextcloud/211225439/hooks/postgres.py", line 46, in execute
    self.run('snap run nextcloud.psql -U {0} -d {1} -c "{2}"'.format(user, database, sql))
  File "/snap/nextcloud/211225439/hooks/postgres.py", line 62, in run
    raise e
  File "/snap/nextcloud/211225439/hooks/postgres.py", line 58, in run
    output = check_output(cmd, shell=True).decode()
  File "/snap/nextcloud/current/python/usr/local/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/snap/nextcloud/current/python/usr/local/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'snap run nextcloud.psql -U nextcloud -d nextcloud -c "update oc_ldap_group_mapping set owncloud_name = 'admin';"' returned non-zero exit status 1.
-----)
root@syncloud:~#
snap run nextcloud.psql -U nextcloud -d nextcloud -c "select * from oc_ldap_group_mapping;"

Are you sure it is not installed, can you run this?


root@syncloud:~# snap run nextcloud.psql -U nextcloud -d nextcloud -c "select * from oc_ldap_group_mapping;"
error: cannot find current revision for snap nextcloud: readlink /snap/nextcloud/current: no such file or directory
root@syncloud:~#

Do you use Users app, if yes how many users/groups do you have?
Do you have admin user/group?

ok, I was able to reproduce it, if you create users and then install Nextcloud it fails, please follow this issue: Unable to install Nextcloud, multiple lda group mappings · Issue #625 · syncloud/platform · GitHub

1 Like

Do you use Users app, if yes how many users/groups do you have?

Yes, I had one group and 3 users.

Do you have admin user/group?

As far as I remember the only admin-like was the user with the same credentials of Syncloud. With that user you can create/delete users, groups, install/remove plugins, etc. Thanks

Could you try

snap install nextcloud --channel=master

Great job! It works fine. Thanks a lot :pizza: :pizza: :pizza:

The fix is released to stable channel, please run this to switch back to stable

snap install nextcloud --channel=stable

:+1: successfully done