Have trouble on nextcloud docker

I tried to deploy nextcloud container in docker using linuxserver.io’s image. And I got errors like this after the container started:

[22-Apr-2022 01:02:59] ERROR: [pool www] please specify user and group other than root
[22-Apr-2022 01:02:59] ERROR: FPM initialization failed

And if I add:

user = nginx
group = nginx

in /config/php/www2.conf, then restart the container, I’ll got this:

And nothing output in the container logs. I found error log in /config/log/nginx/error.log:

2022/04/22 01:21:10 [error] 431#431: *3 FastCGI sent in stderr: "PHP message: {"reqId":"Wz2YQErwW7uTwXqcIsxQ","level":3,"time":"2022-04-21T17:21:09+00:00","remoteAddr":"192.168.1.2","user":"--","app":"PHP","method":"GET","url":"/","message":"touch(): Utime failed: Permission denied at /config/www/nextcloud/lib/private/Config.php#248","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 Edg/100.0.1185.44","version":"","exception":{"Exception":"Error","Message":"touch(): Utime failed: Permission denied at /config/www/nextcloud/lib/private/Config.php#248","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/config/www/nextcloud/lib/private/Config.php","line":248,"function":"touch"},{"file":"/config/www/nextcloud/lib/private/Config.php","line":138,"function":"writeData","class":"OC\\Config","type":"->"},{"file":"/config/www/nextcloud/lib/private/SystemConfig.php","line":142,"function":"setValue","class":"OC\\Config","type":"->"},{"file":"/config/ww...PHP message: {"reqId":"Wz2YQErwW7uTwXqcIsxQ","level":3,"time":"2022-04-21T17:21:09+00:00","remoteAddr":"192.168.1.2","user":"--","app":"PHP","method":"GET","url":"/","message":"fopen(/config/www/nextcloud/config/config.php): Failed to open stream: Permission denied at /config/www/nextcloud/lib/private/Config.php#249","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 Edg/100.0.1185.44","version":"","exception":{"Exception":"Error","Message":"fopen(/config/www/nextcloud/config/config.php): Failed to open stream: Permission denied at /config/www/nextcloud/lib/private/Config.php#249","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/config/www/nextcloud/lib/private/Config.php","line":249,"function":"fopen"},{"file":"/config/www/nextcloud/lib/private/Config.php","line":138,"function":"writeData","class":"OC\\Config","type":"->"},{"file
2022/04/22 01:21:10 [error] 431#431: *3 FastCGI sent in stderr: "ErwW7uTwXqcIsxQ","level":3,"time":"2022-04-21T17:21:10+00:00","remoteAddr":"192.168.1.2","user":"--","app":"index","method":"GET","url":"/","message":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [14] unable to open database file","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 Edg/100.0.1185.44","version":"","exception":{"Exception":"Doctrine\\DBAL\\Exception","Message":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [14] unable to open database file","Code":14,"Trace":[{"file":"/config/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1519,"function":"connect","class":"OC\\DB\\Connection","type":"->"},{"file":"/config/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1041,"function":"getWrappedConnection","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/config/www/ne" while reading response header from upstream, client: 192.168.1.2, server: _, request: "GET / HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.1.82:20775"
2022/04/22 01:21:10 [error] 431#431: *3 FastCGI sent in stderr: "PHP message: {"reqId":"Wz2YQErwW7uTwXqcIsxQ","level":3,"time":"2022-04-21T17:21:10+00:00","remoteAddr":"192.168.1.2","user":"--","app":"PHP","method":"GET","url":"/","message":"chmod(): Operation not permitted at /config/www/nextcloud/lib/private/Log/File.php#86","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 Edg/100.0.1185.44","version":""}" while reading upstream, client: 192.168.1.2, server: _, request: "GET / HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.1.82:20775"
2022/04/22 01:21:23 [error] 431#431: *3 FastCGI sent in stderr: "PHP message: {"reqId":"bZkIb8sxa9uEvVEIdW7I","level":3,"time":"2022-04-21T17:21:23+00:00","remoteAddr":"192.168.1.2","user":"--","app":"PHP","method":"GET","url":"/","message":"touch(): Utime failed: Permission denied at /config/www/nextcloud/lib/private/Config.php#248","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 Edg/100.0.1185.44","version":"","exception":{"Exception":"Error","Message":"touch(): Utime failed: Permission denied at /config/www/nextcloud/lib/private/Config.php#248","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/config/www/nextcloud/lib/private/Config.php","line":248,"function":"touch"},{"file":"/config/www/nextcloud/lib/private/Config.php","line":138,"function":"writeData","class":"OC\\Config","type":"->"},{"file":"/config/www/nextcloud/lib/private/SystemConfig.php","line":142,"function":"setValue","class":"OC\\Config","type":"->"},{"file":"/config/ww...PHP message: {"reqId":"bZkIb8sxa9uEvVEIdW7I","level":3,"time":"2022-04-21T17:21:23+00:00","remoteAddr":"192.168.1.2","user":"--","app":"PHP","method":"GET","url":"/","message":"fopen(/config/www/nextcloud/config/config.php): Failed to open stream: Permission denied at /config/www/nextcloud/lib/private/Config.php#249","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 Edg/100.0.1185.44","version":"","exception":{"Exception":"Error","Message":"fopen(/config/www/nextcloud/config/config.php): Failed to open stream: Permission denied at /config/www/nextcloud/lib/private/Config.php#249","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/config/www/nextcloud/lib/private/Config.php","line":249,"function":"fopen"},{"file":"/config/www/nextcloud/lib/private/Config.php","line":138,"function":"writeData","class":"OC\\Config","type":"->"},{"file
2022/04/22 01:21:23 [error] 431#431: *3 FastCGI sent in stderr: "8sxa9uEvVEIdW7I","level":3,"time":"2022-04-21T17:21:23+00:00","remoteAddr":"192.168.1.2","user":"--","app":"index","method":"GET","url":"/","message":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [14] unable to open database file","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 Edg/100.0.1185.44","version":"","exception":{"Exception":"Doctrine\\DBAL\\Exception","Message":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [14] unable to open database file","Code":14,"Trace":[{"file":"/config/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1519,"function":"connect","class":"OC\\DB\\Connection","type":"->"},{"file":"/config/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1041,"function":"getWrappedConnection","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/config/www/ne" while reading response header from upstream, client: 192.168.1.2, server: _, request: "GET / HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.1.82:20775"
2022/04/22 01:21:23 [error] 431#431: *3 FastCGI sent in stderr: "PHP message: {"reqId":"bZkIb8sxa9uEvVEIdW7I","level":3,"time":"2022-04-21T17:21:23+00:00","remoteAddr":"192.168.1.2","user":"--","app":"PHP","method":"GET","url":"/","message":"chmod(): Operation not permitted at /config/www/nextcloud/lib/private/Log/File.php#86","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 Edg/100.0.1185.44","version":""}" while reading upstream, client: 192.168.1.2, server: _, request: "GET / HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.1.82:20775"

I change PUID & PGID to “0” according to this and nothing changed else in the container env.

Could anyone help me? Thanks!

By the way, I was using php8 tag. And here is my configuration:

Don’t set the puid to 0 (root) and don’t change the user group in www2.conf

It’s designed to work out of the box running as an unprivileged user

1 Like

Yes the reason is the puid. I can’t go to sleep on that day, and finally I fixed it by that re-mount my smb server using another user, and then change the puid to that user.
Thank you @aptalca so much anyway. If I had post my question here earlier, maybe I wouldn’t have lost sleep and stayed up late.