Problems installing nextcloud on RPI4 using docker/portainer due to 'www-data' permission

  • I'm attempting to install nextcloud on my Rasbperry Pi 4 using the Techno Dad Life guide "Easiest Nextcloud Installation with Docker", but using the portainer web GUI rather than through docker on the command line. I've got to the NextCloudPi activation stage and click the "activate" button, but it says "Something went wrong. Try refreshing the page". I then checked the docker logs with 'sudo docker logs -f nextcloudpi' and this is what I get:


    Code
    Initializing empty volume.. Making /usr/local/etc/ncp-config.d persistent ... Making /etc/services-enabled.d persistent ... Making /etc/letsencrypt persistent ... Making /etc/shadow persistent ... Making /etc/cron.d persistent ... Making /etc/cron.daily persistent ... Making /etc/cron.hourly persistent ... Making /etc/cron.weekly persistent ... Making /usr/local/bin persistent ... Making /etc/apache2 persistent ... Starting PHP-fpm Starting Apache Starting mariaDB 2020-07-13 15:46:38 0 [Note] mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as process 195 ... Starting Redis Starting Cron Starting Postfix Uninitialized instance, running nc-init... Running nc-init Setting up a clean Nextcloud instance... wait until message 'NC init done' Setting up database... Setting up Nextcloud... Console has to be executed with the user that owns the file config/config.php Current user: www-data Owner of config.php: root Try adding 'sudo -u root ' to the beginning of the command (without the single quotes) If running with 'docker exec' try adding the option '-u root' to the docker command (without the single quotes) Init done

    It seems to be a problem with user permissions. However, I don't know how to do what it suggests, as I can't find out how to run a portainer container as 'root'. Could someone point me in the right direction please?

  • teslabean

    Changed the title of the thread from “Problems installing nextcloud on RPI4 using docker/portainer due to 'www-data” to “Problems installing nextcloud on RPI4 using docker/portainer due to 'www-data' permission”.
  • You should not, never, ever run as root.


    Try running your nextcloud container with user-rights with PUID and PGID-settings.

    Chaos is found in greatest abundance wherever order is being sought.
    It always defeats order, because it is better organized.
    Terry Pratchett

  • Console has to be executed with the user that owns the file config/config.php

    That is the issue you're looking for. They currently belong to root. You can fix that by navigating to the path and executing chown www-data:users -r .

    You should not, never, ever run as root.


    Try running your nextcloud container with user-rights with PUID and PGID-settings.

    A big chunk of docker images run simply as root, by default. Mostly only those from LSIO offer the ability to run as a different user properly.


    Greetings

    David

    "Well... lately this forum has become support for everything except omv" [...] "And is like someone is banning Google from their browsers"


    Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.

    Upload Logfile via WebGUI/CLI
    #openmediavault on freenode IRC | German & English | GMT+1
    Absolutely no Support via PM!

  • I would suggest to delete the nextcloudpi folder and start fresh and stick to the guide and run it via the command line. You can manage the docker afterwards in portainer.

    I tried that, and I get the same problem.

    That is the issue you're looking for. They currently belong to root. You can fix that by navigating to the path and executing chown www-data:users -r .

    I also tried that, using the command chown www-data:users -R config/ but the directory remained as root ownership. After doing a bit more searching online I think the problem might be that the drive I'm trying to use is NTFS formatted, so there's no concept of unix users. I would rather not reformat to ext4 if I can avoid it. Is there a way to get this working with the on the NTFS filesystem?

  • I would rather not reformat to ext4 if I can avoid it. Is there a way to get this working with the on the NTFS filesystem?

    In the end I decided to reformat my external harddrive as ext4. However, having followed the guide again, using docker commands in the terminal, I still get issues. Here is the output from docker logs -f nextcloudpi:

    Code
    Initializing empty volume.. /run-parts.sh: line 47: /etc/services-enabled.d//etc/services-enabled.d: No such file or directory Init done
  • In the end I decided to reformat my external harddrive as ext4. However, having followed the guide again, using docker commands in the terminal, I still get issues. Here is the output from docker logs -f nextcloudpi:

    Code
    Initializing empty volume.. /run-parts.sh: line 47: /etc/services-enabled.d//etc/services-enabled.d: No such file or directory Init done

    I seem to have made progress by just deleting the docker container and re-running the docker command for creating the container (nextcloud is installed and initialised). I'll see if I can get through the nextcloud activation stage tomorrow and let you know how it goes. Thanks for the help so far!

  • teslabean

    Added the Label resolved

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!