Docker-NC16 on Asustor NAS, "Can’t create or write into the data directory"

Hi guys,
i would like to use the dockerized Nextcloud 16 (https://www.asustor.com/en/app_central/app_detail?id=941&type=&model=) on my Asustor NAS.
I followed this tutorial: https://forum.asustor.com/viewtopic.php?f=49&t=1835
which is made for owncloud, but it reportedly also worked for nextcloud-users.
When i want to finish the initial setup-page, i get the error “Can’t create or write into the data directory […]”. It also made no difference, if i used the default destination folder or another one with rw-permission for every user listed in the user-management-GUI of the NAS.
Taking a look at /volume1/Docker/nextcloud/nextcloud.log i found, for every try i did, an entry like this:
{“reqId”:“Nt7iFXqVil4vC2XNfak5”,“level”:3,“time”:“2019-09-04T14:28:05+00:00”,“remoteAddr”:“192.168.178.123”,“user”:"–",“app”:“PHP”,“method”:“POST”,“url”:"/index.php",“message”:“mkdir(): No such file or directory at /var/www/html/lib/private/Setup.php#302”,“userAgent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0”,“version”:“16.0.4.1”} .
I’m not sure if this is a user permission issue or if there is some other kind of problem?

I don’t know your environment, but in general all files and directories usually need to be owned by the user under which the web server is running, e.g. “www-data”. You have to make sure that this user is allowed to access the desired file location.
To be on the save site, I recommend to switch the user on the console and try to access the desired directory path, one by one, and try to create a file, like

su - www-data -s /bin/sh

cd /data
touch test-file-1.txt

cd /data/more-data/
touch test-file-2.txt

cd /data/more-data/lot-more-data/
touch test-file-2.txt

The system on the NAS is called ADM and the graphical interface is so limited, that i don’t even have a console there. But I managed to open an ssh connection and it tells me that the user www-data is unknown. Furthermore, getting a list of all users with “getent password” there is also nothing similar, so i’m not sure under which user the server is running.

You can try to use the following command to check the web server processes:

# ps -ef | grep -E "apache|http"

This command gives me a rather long list with the users root, admin and 33, and I’m wondering about last one, as it is not in the list of all users.

2259 root 0:00 /usr/sbin/lighttpd -f /usr/etc/lighttpd/lighttpd.conf
2260 root 0:05 /usr/sbin/lighttpd -f /usr/etc/lighttpd/lighttpd.conf
2261 root 0:04 /usr/sbin/lighttpd -f /usr/etc/lighttpd/lighttpd.conf
2263 root 0:04 /usr/sbin/lighttpd -f /usr/etc/lighttpd/lighttpd.conf
2264 root 0:04 /usr/sbin/lighttpd -f /usr/etc/lighttpd/lighttpd.conf
2265 root 0:05 /usr/sbin/lighttpd -f /usr/etc/lighttpd/lighttpd.conf
2266 root 0:05 /usr/sbin/lighttpd -f /usr/etc/lighttpd/lighttpd.conf
2267 root 0:06 /usr/sbin/lighttpd -f /usr/etc/lighttpd/lighttpd.conf
2268 root 0:06 /usr/sbin/lighttpd -f /usr/etc/lighttpd/lighttpd.conf
2269 root 0:08 /usr/sbin/lighttpd -f /usr/etc/lighttpd/lighttpd.conf
2270 root 0:09 /usr/sbin/lighttpd -f /usr/etc/lighttpd/lighttpd.conf
2271 root 0:13 /usr/sbin/lighttpd -f /usr/etc/lighttpd/lighttpd.conf
2272 root 1:34 /usr/sbin/lighttpd -f /usr/etc/lighttpd/lighttpd.conf
2273 root 0:36 /usr/sbin/lighttpd -f /usr/etc/lighttpd/lighttpd.conf
2274 root 0:19 /usr/sbin/lighttpd -f /usr/etc/lighttpd/lighttpd.conf
2275 root 1:00 /usr/sbin/lighttpd -f /usr/etc/lighttpd/lighttpd.conf
2276 root 2:40 /usr/sbin/lighttpd -f /usr/etc/lighttpd/lighttpd.conf
3730 root 0:06 /usr/builtin/sbin/apache2 -k start
10579 admin 1:26 /usr/builtin/sbin/apache2 -k start
10580 admin 1:07 /usr/builtin/sbin/apache2 -k start
10582 admin 1:04 /usr/builtin/sbin/apache2 -k start
10583 admin 0:35 /usr/builtin/sbin/apache2 -k start
10658 admin 1:30 /usr/builtin/sbin/apache2 -k start
10733 admin 0:57 /usr/builtin/sbin/apache2 -k start
10734 admin 1:01 /usr/builtin/sbin/apache2 -k start
11758 admin 0:00 /usr/builtin/sbin/apache2 -k start
11830 admin 0:12 /usr/builtin/sbin/apache2 -k start
12662 33 0:00 apache2 -DFOREGROUND
13021 root 0:00 /usr/local/AppCentral/looksgood/bin/looksgood-stream-lighttpd -f /usr/local/AppCentral/looksgood/conf/lighttpd/lighttpd.conf
13022 root 0:02 /usr/local/AppCentral/looksgood/bin/looksgood-stream-lighttpd -f /usr/local/AppCentral/looksgood/conf/lighttpd/lighttpd.conf
13023 root 0:02 /usr/local/AppCentral/looksgood/bin/looksgood-stream-lighttpd -f /usr/local/AppCentral/looksgood/conf/lighttpd/lighttpd.conf
13024 root 0:02 /usr/local/AppCentral/looksgood/bin/looksgood-stream-lighttpd -f /usr/local/AppCentral/looksgood/conf/lighttpd/lighttpd.conf
13025 root 0:02 /usr/local/AppCentral/looksgood/bin/looksgood-stream-lighttpd -f /usr/local/AppCentral/looksgood/conf/lighttpd/lighttpd.conf
13026 root 0:02 /usr/local/AppCentral/looksgood/bin/looksgood-stream-lighttpd -f /usr/local/AppCentral/looksgood/conf/lighttpd/lighttpd.conf
13027 root 0:02 /usr/local/AppCentral/looksgood/bin/looksgood-stream-lighttpd -f /usr/local/AppCentral/looksgood/conf/lighttpd/lighttpd.conf
13028 root 0:02 /usr/local/AppCentral/looksgood/bin/looksgood-stream-lighttpd -f /usr/local/AppCentral/looksgood/conf/lighttpd/lighttpd.conf
13029 root 0:02 /usr/local/AppCentral/looksgood/bin/looksgood-stream-lighttpd -f /usr/local/AppCentral/looksgood/conf/lighttpd/lighttpd.conf
13030 root 0:02 /usr/local/AppCentral/looksgood/bin/looksgood-stream-lighttpd -f /usr/local/AppCentral/looksgood/conf/lighttpd/lighttpd.conf
13031 root 0:02 /usr/local/AppCentral/looksgood/bin/looksgood-stream-lighttpd -f /usr/local/AppCentral/looksgood/conf/lighttpd/lighttpd.conf
13032 root 0:02 /usr/local/AppCentral/looksgood/bin/looksgood-stream-lighttpd -f /usr/local/AppCentral/looksgood/conf/lighttpd/lighttpd.conf
13033 root 0:02 /usr/local/AppCentral/looksgood/bin/looksgood-stream-lighttpd -f /usr/local/AppCentral/looksgood/conf/lighttpd/lighttpd.conf
13034 root 0:02 /usr/local/AppCentral/looksgood/bin/looksgood-stream-lighttpd -f /usr/local/AppCentral/looksgood/conf/lighttpd/lighttpd.conf
13036 root 0:02 /usr/local/AppCentral/looksgood/bin/looksgood-stream-lighttpd -f /usr/local/AppCentral/looksgood/conf/lighttpd/lighttpd.conf
13037 root 0:02 /usr/local/AppCentral/looksgood/bin/looksgood-stream-lighttpd -f /usr/local/AppCentral/looksgood/conf/lighttpd/lighttpd.conf
13038 root 0:02 /usr/local/AppCentral/looksgood/bin/looksgood-stream-lighttpd -f /usr/local/AppCentral/looksgood/conf/lighttpd/lighttpd.conf
17421 root 0:05 apache2 -DFOREGROUND
18116 33 0:00 apache2 -DFOREGROUND
18117 33 0:00 apache2 -DFOREGROUND
18120 33 0:00 apache2 -DFOREGROUND
18121 33 0:00 apache2 -DFOREGROUND
21103 admin 0:53 /usr/builtin/sbin/apache2 -k start
21318 33 0:00 apache2 -DFOREGROUND
21548 33 0:00 apache2 -DFOREGROUND
21615 33 0:00 apache2 -DFOREGROUND
21616 33 0:00 apache2 -DFOREGROUND
24284 admin 1:11 /usr/builtin/sbin/apache2 -k start
29005 33 0:00 apache2 -DFOREGROUND
29023 root 0:00 grep -E apache|http

I assume that the lighttpd instances are used for the GUI and your web server is most lightly Apache2, you can see that the relevant processes are running under the user “admin” on your NAS.

The admin has full rw-privileges in the data-folder (and i also tested it like you suggested), so do you have any other ideas?
Besides, i tried to find out the actual owners and groups of my data-folder and found this:

admin@AS5102T:/volume1/Docker/Nextcloud/data $ ls -lt
total 20
drwsrwsrwt    3 admin    administ      4096 Oct  9 17:45 moredata/
-rw-r--r--    1 admin    administ         0 Oct  9 17:44 test-file-1b.txt
-rw-r--r--    1 33       33               0 Oct  9 17:36 index.html
-rw-r--r--    1 root     root             0 Oct  9 12:30 test-file-1.txt
-rw-r-----    1 33       33           13335 Sep  5 15:41 nextcloud.log

and

admin@AS5102T:/volume1/Docker/Nextcloud $ ls -lt
total 148
drwxr-xr-x    3 33       root          4096 Oct  9 17:44 data/
...

Maybe that helps to find out what’s going on…