NextCloud installation error

I’m setting up a Yunohost server on a fresh Debian 8.9.
I’ve successfully run the installation and post-installation.
I’ve installed Kanboard, Agendav and Baikal without any problems but when I try to install nextcloud it fails.
Here are the logs produced (I just replaced my domain name by domain.tld and the username by toto everywhere).

$ sudo yunohost app install --verbose nextcloud
Downloading...
Extracting...
Done
Checking required packages...
Available domains:
- domain.tld
- secretariat.domain.tld
Choose a domain for Nextcloud (default: domain.tld): 
Choose a path for Nextcloud (default: /nextcloud): 
Choose the Nextcloud administrator (must be an existing YunoHost user): toto
Access the users home folder from Nextcloud? [0 | 1] (default: 0): 1
Executing script '/var/cache/yunohost/from_file/nextcloud_ynh-8f98d512b17c12b3f6225414c8dd5546ea482307/scripts/install'...
+ set -eu
+ domain=domain.tld
+ path=/nextcloud
+ admin=toto
+ user_home=1
+ source ./_common.sh
++ APPNAME=nextcloud
+++ grep VERSION= upgrade.d/upgrade.last.sh
+++ cut -d= -f2
++ LAST_VERSION=12.0.2
++ DEPS_PKG_NAME=nextcloud-deps
+++ cd ../
+++ pwd
++ PKGDIR=/var/cache/yunohost/from_file/nextcloud_ynh-8f98d512b17c12b3f6225414c8dd5546ea482307
++ final_path=domain.tld
+ app=nextcloud
+ dbname=nextcloud
+ dbuser=nextcloud
+ source /usr/share/yunohost/helpers
+++ run-parts --list /usr/share/yunohost/helpers.d
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/backend ']'
++ . /usr/share/yunohost/helpers.d/backend
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/filesystem ']'
++ . /usr/share/yunohost/helpers.d/filesystem
+++ CAN_BIND=1
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/ip ']'
++ . /usr/share/yunohost/helpers.d/ip
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/mysql ']'
++ . /usr/share/yunohost/helpers.d/mysql
+++ MYSQL_ROOT_PWD_FILE=/etc/yunohost/mysql
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/network ']'
++ . /usr/share/yunohost/helpers.d/network
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/package ']'
++ . /usr/share/yunohost/helpers.d/package
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/print ']'
++ . /usr/share/yunohost/helpers.d/print
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/setting ']'
++ . /usr/share/yunohost/helpers.d/setting
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/string ']'
++ . /usr/share/yunohost/helpers.d/string
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/system ']'
++ . /usr/share/yunohost/helpers.d/system
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/user ']'
++ . /usr/share/yunohost/helpers.d/user
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/utils ']'
++ . /usr/share/yunohost/helpers.d/utils
+ '[' / '!=' / ']'
+ '[' d == / ']'
+ sudo yunohost app checkurl domain.tld/nextcloud -a nextcloud
Warning: 'yunohost app checkurl' is deprecated and will be removed in the future
+ ynh_user_exists toto
+ grep -q '"username": "toto"'
+ sudo yunohost user list --output-as json
+ ynh_app_setting_set nextcloud admin_user toto
+ sudo yunohost app setting nextcloud admin_user -v toto --quiet
+ DESTDIR=/var/www/nextcloud
+ [[ -d /var/www/nextcloud ]]
+ DATADIR=/home/yunohost.app/nextcloud/data
+ ynh_package_install_from_equivs ../conf/nextcloud-deps.control
+ controlfile=../conf/nextcloud-deps.control
+ ynh_package_is_installed equivs
+ grep -c 'ok installed'
+ dpkg-query -W -f '${Status}' equivs
++ grep '^Package: ' ../conf/nextcloud-deps.control
++ cut '-d ' -f 2
+ pkgname=nextcloud-deps
++ cut '-d ' -f 2
++ grep '^Version: ' ../conf/nextcloud-deps.control
+ pkgversion=11.0-1
+ [[ -z nextcloud-deps ]]
+ [[ -z 11.0-1 ]]
+ ynh_package_update
+ ynh_apt update
+ DEBIAN_FRONTEND=noninteractive
+ sudo apt-get -y -qq update
++ mktemp -d
+ TMPDIR=/tmp/tmp.6EkvXvGLiA
+ cp ../conf/nextcloud-deps.control /tmp/tmp.6EkvXvGLiA/control
+ cd /tmp/tmp.6EkvXvGLiA
+ equivs-build ./control
Warning: /usr/bin/fakeroot: line 178: debian/rules: Permission denied
Warning: Error in the build process: exit status 126
+ [[ -n /tmp/tmp.6EkvXvGLiA ]]
+ rm -rf /tmp/tmp.6EkvXvGLiA
+ ynh_package_is_installed nextcloud-deps
+ dpkg-query -W -f '${Status}' nextcloud-deps
+ grep -c 'ok installed'
+ ynh_die 'Unable to install dependencies'
Warning: Unable to install dependencies
+ echo 'Unable to install dependencies'
+ exit 1
Executing script '/var/cache/yunohost/from_file/nextcloud_ynh-8f98d512b17c12b3f6225414c8dd5546ea482307/scripts/remove'...
+ source ./_common.sh
++ APPNAME=nextcloud
+++ grep VERSION= upgrade.d/upgrade.last.sh
+++ cut -d= -f2
++ LAST_VERSION=12.0.2
++ DEPS_PKG_NAME=nextcloud-deps
+++ cd ../
+++ pwd
++ PKGDIR=/var/cache/yunohost/from_file/nextcloud_ynh-8f98d512b17c12b3f6225414c8dd5546ea482307
++ final_path=nextcloud
+ source /usr/share/yunohost/helpers
+++ run-parts --list /usr/share/yunohost/helpers.d
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/backend ']'
++ . /usr/share/yunohost/helpers.d/backend
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/filesystem ']'
++ . /usr/share/yunohost/helpers.d/filesystem
+++ CAN_BIND=1
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/ip ']'
++ . /usr/share/yunohost/helpers.d/ip
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/mysql ']'
++ . /usr/share/yunohost/helpers.d/mysql
+++ MYSQL_ROOT_PWD_FILE=/etc/yunohost/mysql
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/network ']'
++ . /usr/share/yunohost/helpers.d/network
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/package ']'
++ . /usr/share/yunohost/helpers.d/package
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/print ']'
++ . /usr/share/yunohost/helpers.d/print
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/setting ']'
++ . /usr/share/yunohost/helpers.d/setting
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/string ']'
++ . /usr/share/yunohost/helpers.d/string
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/system ']'
++ . /usr/share/yunohost/helpers.d/system
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/user ']'
++ . /usr/share/yunohost/helpers.d/user
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/utils ']'
++ . /usr/share/yunohost/helpers.d/utils
+ app=nextcloud
+ dbname=nextcloud
+ dbuser=nextcloud
+ sudo rm -f /etc/cron.d/nextcloud
+ ynh_mysql_drop_db nextcloud
+ ynh_mysql_execute_as_root 'DROP DATABASE nextcloud;'
++ sudo cat /etc/yunohost/mysql
+ ynh_mysql_connect_as root GVD9NhR7HN ''
+ mysql -u root --password=GVD9NhR7HN -B ''
Warning: ERROR 1008 (HY000) at line 1: Can't drop database 'nextcloud'; database doesn't exist
+ ynh_mysql_drop_user nextcloud
+ ynh_mysql_execute_as_root 'DROP USER '\''nextcloud'\''@'\''localhost'\'';'
++ sudo cat /etc/yunohost/mysql
+ ynh_mysql_connect_as root GVD9NhR7HN ''
+ mysql -u root --password=GVD9NhR7HN -B ''
Warning: ERROR 1396 (HY000) at line 1: Operation DROP USER failed for 'nextcloud'@'localhost'
++ ynh_app_setting_get nextcloud domain
++ sudo yunohost app setting nextcloud domain --output-as plain --quiet
+ domain=domain.tld
+ [[ /var/www =~ /var/www/nextcloud ]]
+ test -n nextcloud
+ sudo rm -r /var/www/nextcloud
Warning: rm: cannot remove ‘/var/www/nextcloud’: No such file or directory
+ sudo rm -f /etc/php5/fpm/pool.d/nextcloud.conf
+ [[ -n domain.tld ]]
+ sudo rm -f /etc/nginx/conf.d/domain.tld.d/nextcloud.conf
+ sudo service php5-fpm reload
+ sudo service nginx reload
+ ynh_package_autoremove nextcloud-deps
+ ynh_apt autoremove nextcloud-deps
+ DEBIAN_FRONTEND=noninteractive
+ sudo apt-get -y -qq autoremove nextcloud-deps
Warning: E: Unable to locate package nextcloud-deps
++ ls /home
+ for i in '$(ls /home)'
+ [[ ! admin == yunohost.* ]]
+ sudo setfacl -x g:nextcloud:rwx
+ for i in '$(ls /home)'
+ [[ ! carole == yunohost.* ]]
+ sudo setfacl -x g:nextcloud:rwx
+ for i in '$(ls /home)'
+ [[ ! toto == yunohost.* ]]
+ sudo setfacl -x g:nextcloud:rwx
+ for i in '$(ls /home)'
+ [[ ! lmcv == yunohost.* ]]
+ sudo setfacl -x g:nextcloud:rwx
+ for i in '$(ls /home)'
+ [[ ! lost+found == yunohost.* ]]
+ sudo setfacl -x g:nextcloud:rwx
+ for i in '$(ls /home)'
+ [[ ! vmail == yunohost.* ]]
+ sudo setfacl -x g:nextcloud:rwx
+ for i in '$(ls /home)'
+ [[ ! yunohost.app == yunohost.* ]]
+ for i in '$(ls /home)'
+ [[ ! yunohost.backup == yunohost.* ]]
+ for i in '$(ls /home)'
+ [[ ! yunohost.conf == yunohost.* ]]
+ id nextcloud
+ ynh_remove_logrotate
+ '[' -e /etc/logrotate.d/nextcloud ']'
Success! The SSOwat configuration has been generated
Error: Installation failed

It appears that at some point it tries to do a fakeroot and is not allowed to do so.

Here is the output of the diagnostic command also

{
    "host": "Debian 8.9",
    "kernel": "3.16.0-4-amd64",
    "packages": {
        "yunohost": "2.7.2",
        "yunohost-admin": "2.7.2",
        "moulinette": "2.7.2",
        "ssowat": "2.7.2"
    },
    "system": {
        "disks": {
            "sda1": "Mounted on /boot, 87.0MiB (53.8MiB free)",
            "dm-6": "Mounted on /home, 397.7GiB (397.7GiB free)",
            "dm-4": "Mounted on /tmp, 9.0GiB (9.0GiB free)",
            "dm-2": "Mounted on /var, 10.9GiB (10.3GiB free)",
            "dm-3": "Mounted on /var/mail, 18.2GiB (18.2GiB free)",
            "dm-1": "Mounted on /, 18.2GiB (17.0GiB free)"
        },
        "memory": {
            "ram": "3.6GiB (3.3GiB free)",
            "swap": "3.7GiB (3.7GiB free)"
        }
    },
    "services": {
        "glances": "running (enabled)",
        "nslcd": "running (enabled)",
        "metronome": "running (enabled)",
        "postfix": "running (enabled)",
        "rspamd": "running (enabled)",
        "yunohost-firewall": "running (disabled)",
        "nginx": "running (enabled)",
        "rmilter": "running (enabled)",
        "slapd": "running (enabled)",
        "dnsmasq": "running (enabled)",
        "fail2ban": "running (enabled)",
        "yunohost-api": "running (enabled)",
        "mysql": "running (enabled)",
        "avahi-daemon": "running (enabled)",
        "dovecot": "running (enabled)",
        "redis-server": "running (enabled)",
        "php5-fpm": "running (enabled)",
        "ssh": "running (enabled)"
    },
    "applications": {
        "agendav": "AgenDAV",
        "kanboard": "Kanboard",
        "baikal": "Baikal"
    }
}

If someone can help me figuring out what is happening I would be grateful.

Hello @cricriiiiii,

With what user are you launching the installation?
Can you try running it directly with root user?

sudo su -
yunohost app install --verbose nextcloud

Hi @JimboJoe,

I was running the installation as the admin user.

I justed tried installing as the root user, and I get exactly the same thing (same log up to temporary directory names).

What’s the version of your fakeroot package?

I have version 1.20.2 for fakeroot.

Can you try reinstalling with: `sudo apt-get install --reinstall fakeroot``` ?

Yes, reinstalled fakeroot, and still the same with both admin and root.

What about equivs package?

I have version 2.0.9 of equivs.
I’ve just tried reinstalling it and it doesn’t solve the problem.

I found the problem !
I had forgotten that I mount my /tmp directory with option noexec.
This was preventing the installation.
I can remove it to install stuff.

Great you found that out! :thumbsup: