Nextcloud version (eg, 18.0.2): 20.0.0.9
Operating system and version (eg, Ubuntu 20.04): Docker on Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.38 (Debian)
PHP version (eg, 7.1): PHP 7.4.11
The issue you are facing:
Hi,
I had been running Nextcloud on a docker container successfully for few years now. I occasionally had permission denied issues before as well, but they were fixed after running the chown
command like chown www-data:www-data -R nextcloud
. Recently, I upgraded to Nextcloud 20 from 19 and the automatic upgrade failed. When I logged into the container the permission were messed up, so I fixed them and ran ./occ upgrade
from inside the container. Then the upgrade finished successfully, but I am consistently seeing Permission denied
error in the logs.
Is this the first time you’ve seen this error? (Y/N): N
Here’s the contents config.php
file
<?php
$CONFIG = array (
'htaccess.RewriteBase' => '/',
'memcache.local' => '\\OC\\Memcache\\APCu',
'apps_paths' =>
array (
0 =>
array (
'path' => '/var/www/html/apps',
'url' => '/apps',
'writable' => false,
),
1 =>
array (
'path' => '/var/www/html/custom_apps',
'url' => '/custom_apps',
'writable' => true,
),
),
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => 'nextcloud-redis',
'password' => false,
'port' => 6379,
),
'overwritehost' => '*********',
'overwriteprotocol' => 'https',
'instanceid' => '*********',
'passwordsalt' => '************',
'secret' => '**************',
'trusted_domains' =>
array (
0 => '******************',
),
'datadirectory' => '/var/www/html/data',
'dbtype' => 'pgsql',
'version' => '20.0.0.9',
'overwrite.cli.url' => *************,
'dbname' => 'nextcloud',
'dbhost' => 'nextcloud-db',
'dbport' => '',
'dbtableprefix' => 'oc_',
'dbuser' => '*************',
'dbpassword' => '*************',
'installed' => true,
'maintenance' => false,
'loglevel' => 0,
'theme' => '',
);
Here’s the output from docker logs. Looks like it cannot create /usr/local/etc/php/conf.d/redis-session.ini
in the first place. I have tried removing the container and recreating it and I don’t have a volume mounted on this directory for docker. I have tried running chown
to www-data
on all directories chmod
to 755 as well, but nothing seems to work.
nextcloud_1 | Configuring Redis as session handler
nextcloud_1 | /entrypoint.sh: 56: /entrypoint.sh: cannot create /usr/local/etc/php/conf.d/redis-session.ini: Permission denied
nextcloud_1 | [Wed Oct 14 01:35:42.516375 2020] [php7:notice] [pid 29] [client 172.18.0.2:41692] {"reqId":"xgBm9y190lTwRip35VKq","level":3,"time":"2020-10-14T01:35:42+00:00","remoteAddr":"172.18.0.2","user":"--","app":"PHP","method":"GET","url":"/","message":{"Exception":"Error","Message":"fopen(/var/www/html/config/config.php): failed to open stream: Permission denied at /var/www/html/lib/private/Config.php#243","Code":0,"Trace":[{"function":"onError","class":"OC\\\\Log\\\\ErrorHandler","type":"::","args":[2,"fopen(/var/www/html/config/config.php): failed to open stream: Permission denied","/var/www/html/lib/private/Config.php",243,{"content":"<?php\\n$CONFIG = array (\\n 'htaccess.RewriteBase' => '/',\\n 'memcache.local' => '\\\\\\\\OC\\\\\\\\Memcache\\\\\\\\APCu',\\n 'apps_paths' => \\n array (\\n 0 => \\n array (\\n 'path' => '/var/www/html/apps',\\n 'url' => '/apps',\\n 'writable' => false,\\n ),\\n 1 => \\n array (\\n 'path' => '/var/www/html/custom_apps',\\n 'url' => '/custom_apps',\\n 'writable' => true,\\n ),\\n ),\\n 'memcache.distributed' => '\\\\\\\\OC\\\\\\\\Memcache\\\\\\\\Redis',\\n 'memcache.locking' => '\\\\\\\\OC\\\\\\\\Memcache\\\\\\\\Redis',\\n 'redis' => \\n array (\\n 'host' => 'nextcloud-redis',\\n 'password' => false,\\n 'port' => 6379,\\n ),\\n 'overwritehost' => 'nextcloud.shreedhan.com',\\n 'overwriteprotocol' => 'https',\\n 'instanceid' => 'ocmgpn3u7ome',\\n);\\n"}]},{"file":"/var/www/html/lib/private/Config.php","line":243,"function":"fopen","args":["/var/www/html/config/config.php","r+"]},{"file":"/var/www/html/lib/private/Config.php","line":134,"function":"writeData","class":"OC\\\\Config","type":"->","args":[]},{"file":"/var/www/html/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\\\Config","type":"->","args":["instanceid","ocmgpn3u7ome"]},{"file":"/var/www/html/lib/private/legacy/OC_Util.php","line":1167,"function":"setValue","class":"OC\\\\SystemConfig","type":"->","args":["instanceid","ocmgpn3u7ome"]},{"file":"/var/www/html/lib/base.php","line":421,"function":"getInstanceId","class":"OC_Util","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":650,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":1092,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/html/index.php","line":35,"args":["/var/www/html/lib/base.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/Log/ErrorHandler.php","Line":91,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36","version":""}
nextcloud_1 | [Wed Oct 14 01:35:42.516610 2020] [php7:notice] [pid 29] [client 172.18.0.2:41692] {"reqId":"xgBm9y190lTwRip35VKq","level":3,"time":"2020-10-14T01:35:42+00:00","remoteAddr":"172.18.0.2","user":"--","app":"PHP","method":"GET","url":"/","message":{"Exception":"Error","Message":"chmod(): Operation not permitted at /var/www/html/lib/private/Config.php#246","Code":0,"Trace":[{"function":"onError","class":"OC\\\\Log\\\\ErrorHandler","type":"::","args":[2,"chmod(): Operation not permitted","/var/www/html/lib/private/Config.php",246,{"content":"<?php\\n$CONFIG = array (\\n 'htaccess.RewriteBase' => '/',\\n 'memcache.local' => '\\\\\\\\OC\\\\\\\\Memcache\\\\\\\\APCu',\\n 'apps_paths' => \\n array (\\n 0 => \\n array (\\n 'path' => '/var/www/html/apps',\\n 'url' => '/apps',\\n 'writable' => false,\\n ),\\n 1 => \\n array (\\n 'path' => '/var/www/html/custom_apps',\\n 'url' => '/custom_apps',\\n 'writable' => true,\\n ),\\n ),\\n 'memcache.distributed' => '\\\\\\\\OC\\\\\\\\Memcache\\\\\\\\Redis',\\n 'memcache.locking' => '\\\\\\\\OC\\\\\\\\Memcache\\\\\\\\Redis',\\n 'redis' => \\n array (\\n 'host' => 'nextcloud-redis',\\n 'password' => false,\\n 'port' => 6379,\\n ),\\n 'overwritehost' => 'nextcloud.shreedhan.com',\\n 'overwriteprotocol' => 'https',\\n 'instanceid' => 'ocmgpn3u7ome',\\n);\\n","filePointer":false}]},{"file":"/var/www/html/lib/private/Config.php","line":246,"function":"chmod","args":["/var/www/html/config/config.php",416]},{"file":"/var/www/html/lib/private/Config.php","line":134,"function":"writeData","class":"OC\\\\Config","type":"->","args":[]},{"file":"/var/www/html/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\\\Config","type":"->","args":["instanceid","ocmgpn3u7ome"]},{"file":"/var/www/html/lib/private/legacy/OC_Util.php","line":1167,"function":"setValue","class":"OC\\\\SystemConfig","type":"->","args":["instanceid","ocmgpn3u7ome"]},{"file":"/var/www/html/lib/base.php","line":421,"function":"getInstanceId","class":"OC_Util","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":650,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":1092,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/html/index.php","line":35,"args":["/var/www/html/lib/base.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/Log/ErrorHandler.php","Line":91,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36","version":""}
nextcloud_1 | [Wed Oct 14 01:35:42.519562 2020] [php7:notice] [pid 29] [client 172.18.0.2:41692] {"reqId":"xgBm9y190lTwRip35VKq","level":3,"time":"2020-10-14T01:35:42+00:00","remoteAddr":"172.18.0.2","user":"--","app":"index","method":"GET","url":"/","message":{"Exception":"OC\\\\HintException","Message":"Can't write into config directory!","Code":0,"Trace":[{"file":"/var/www/html/lib/private/Config.php","line":134,"function":"writeData","class":"OC\\\\Config","type":"->","args":[]},{"file":"/var/www/html/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\\\Config","type":"->","args":["instanceid","ocmgpn3u7ome"]},{"file":"/var/www/html/lib/private/legacy/OC_Util.php","line":1167,"function":"setValue","class":"OC\\\\SystemConfig","type":"->","args":["instanceid","ocmgpn3u7ome"]},{"file":"/var/www/html/lib/base.php","line":421,"function":"getInstanceId","class":"OC_Util","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":650,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":1092,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/html/index.php","line":35,"args":["/var/www/html/lib/base.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/Config.php","Line":250,"Hint":"This can usually be fixed by giving the webserver write access to the config directory.","CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36","version":""}
nextcloud_1 | [Wed Oct 14 01:35:42.519745 2020] [php7:notice] [pid 29] [client 172.18.0.2:41692] {"reqId":"xgBm9y190lTwRip35VKq","level":3,"time":"2020-10-14T01:35:42+00:00","remoteAddr":"172.18.0.2","user":"--","app":"index","method":"GET","url":"/","message":{"Exception":"Doctrine\\\\DBAL\\\\DBALException","Message":"Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [14] unable to open database file","Code":0,"Trace":[{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php","line":1449,"function":"connect","class":"OC\\\\DB\\\\Connection","type":"->","args":[]},{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php","line":892,"function":"getWrappedConnection","class":"Doctrine\\\\DBAL\\\\Connection","type":"->","args":[]},{"file":"/var/www/html/lib/private/DB/Connection.php","line":194,"function":"executeQuery","class":"Doctrine\\\\DBAL\\\\Connection","type":"->","args":["SELECT * FROM \\"oc_appconfig\\"",[],[],null]},{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php","line":206,"function":"executeQuery","class":"OC\\\\DB\\\\Connection","type":"->","args":["SELECT * FROM \\"oc_appconfig\\"",[],[]]},{"file":"/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php","line":217,"function":"execute","class":"Doctrine\\\\DBAL\\\\Query\\\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":332,"function":"execute","class":"OC\\\\DB\\\\QueryBuilder\\\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":110,"function":"loadConfigValues","class":"OC\\\\AppConfig","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":288,"function":"getApps","class":"OC\\\\AppConfig","type":"->","args":[]},{"file":"/var/www/html/lib/private/App/AppManager.php","line":136,"function":"getValues","class":"OC\\\\AppConfig","type":"->","args":[false,"enabled"]},{"file":"/var/www/html/lib/private/App/AppManager.php","line":225,"function":"getInstalledAppsValues","class":"OC\\\\App\\\\AppManager","type":"->","args":[]},{"file":"/var/www/html/lib/private/legacy/OC_Template.php","line":284,"function":"isEnabledForUser","class":"OC\\\\App\\\\AppManager","type":"->","args":["theming"]},{"file":"/var/www/html/index.php","line":45,"function":"printErrorPage","class":"OC_Template","type":"::","args":["Can't write into config directory!","This can usually be fixed by giving the webserver write access to the config directory.",503]}],"File":"/var/www/html/lib/private/DB/Connection.php","Line":67,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36","version":""}
nextcloud_1 | [Wed Oct 14 01:35:42.523570 2020] [php7:notice] [pid 29] [client 172.18.0.2:41692] {"reqId":"xgBm9y190lTwRip35VKq","level":3,"time":"2020-10-14T01:35:42+00:00","remoteAddr":"172.18.0.2","user":"--","app":"PHP","method":"GET","url":"/","message":"fopen(/var/www/html/data/nextcloud.log): failed to open stream: Permission denied at /var/www/html/lib/private/Log/File.php#85","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36","version":""}
nextcloud_1 | 172.18.0.2 - - [14/Oct/2020:01:35:42 +0000] "GET / HTTP/1.1" 500 2666 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36"
I appreciate any help. Thanks.