# Nextcloud v211225439 cannot be installed from scratch

**URL:** <https://syncloud.discourse.group/t/nextcloud-v211225439-cannot-be-installed-from-scratch/139>\
**Category:** Existing Apps\
**Tags:** nextcloud\
**Created:** [26 December 2021 16:35 UTC](https://syncloud.discourse.group/t/nextcloud-v211225439-cannot-be-installed-from-scratch/139 "2021-12-26T16:35:53Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![SimoneBuralli](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@SimoneBuralli](https://syncloud.discourse.group/u/SimoneBuralli)\
**Post date:** [26 December 2021 16:35 UTC](https://syncloud.discourse.group/t/nextcloud-v211225439-cannot-be-installed-from-scratch/139/1 "2021-12-26T16:35:53Z")

</div>

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

```auto
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:~#

```

---

<div class="post-metadata">

**Author:** ![boris](https://avatars.discourse-cdn.com/v4/letter/b/74df32/32.png) [@boris](https://syncloud.discourse.group/u/boris)\
**Post date:** [27 December 2021 17:21 UTC](https://syncloud.discourse.group/t/nextcloud-v211225439-cannot-be-installed-from-scratch/139/2 "2021-12-27T17:21:24Z")

</div>

```auto
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?

---

<div class="post-metadata">

**Author:** ![SimoneBuralli](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@SimoneBuralli](https://syncloud.discourse.group/u/SimoneBuralli)\
**Post date:** [27 December 2021 17:24 UTC](https://syncloud.discourse.group/t/nextcloud-v211225439-cannot-be-installed-from-scratch/139/3 "2021-12-27T17:24:42Z")

</div>

```auto

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:~#

```

---

<div class="post-metadata">

**Author:** ![boris](https://avatars.discourse-cdn.com/v4/letter/b/74df32/32.png) [@boris](https://syncloud.discourse.group/u/boris)\
**Post date:** [27 December 2021 18:18 UTC](https://syncloud.discourse.group/t/nextcloud-v211225439-cannot-be-installed-from-scratch/139/4 "2021-12-27T18:18:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![boris](https://avatars.discourse-cdn.com/v4/letter/b/74df32/32.png) [@boris](https://syncloud.discourse.group/u/boris)\
**Post date:** [27 December 2021 18:42 UTC](https://syncloud.discourse.group/t/nextcloud-v211225439-cannot-be-installed-from-scratch/139/5 "2021-12-27T18:42:45Z")

</div>

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](https://github.com/syncloud/platform/issues/625)

---

<div class="post-metadata">

**Author:** ![SimoneBuralli](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@SimoneBuralli](https://syncloud.discourse.group/u/SimoneBuralli)\
**Post date:** [27 December 2021 23:46 UTC](https://syncloud.discourse.group/t/nextcloud-v211225439-cannot-be-installed-from-scratch/139/6 "2021-12-27T23:46:53Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![boris](https://avatars.discourse-cdn.com/v4/letter/b/74df32/32.png) [@boris](https://syncloud.discourse.group/u/boris)\
**Post date:** [28 December 2021 16:00 UTC](https://syncloud.discourse.group/t/nextcloud-v211225439-cannot-be-installed-from-scratch/139/7 "2021-12-28T16:00:16Z")

</div>

Could you try

```auto
snap install nextcloud --channel=master

```

---

<div class="post-metadata">

**Author:** ![SimoneBuralli](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@SimoneBuralli](https://syncloud.discourse.group/u/SimoneBuralli)\
**Post date:** [28 December 2021 23:19 UTC](https://syncloud.discourse.group/t/nextcloud-v211225439-cannot-be-installed-from-scratch/139/8 "2021-12-28T23:19:57Z")

</div>

Great job! It works fine. Thanks a lot 🍕 🍕 🍕

---

<div class="post-metadata">

**Author:** ![boris](https://avatars.discourse-cdn.com/v4/letter/b/74df32/32.png) [@boris](https://syncloud.discourse.group/u/boris)\
**Post date:** [29 December 2021 12:13 UTC](https://syncloud.discourse.group/t/nextcloud-v211225439-cannot-be-installed-from-scratch/139/9 "2021-12-29T12:13:03Z")

</div>

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

```auto
snap install nextcloud --channel=stable

```

---

<div class="post-metadata">

**Author:** ![SimoneBuralli](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@SimoneBuralli](https://syncloud.discourse.group/u/SimoneBuralli)\
**Post date:** [29 December 2021 19:07 UTC](https://syncloud.discourse.group/t/nextcloud-v211225439-cannot-be-installed-from-scratch/139/10 "2021-12-29T19:07:39Z")

</div>

> [@boris](#):
>
> `snap install nextcloud --channel=stable`

👍 successfully done
