Login loop upon fresh install

[/details]

Nextcloud version (eg, 20.0.5): 21.0.4.1
Operating system and version (eg, Ubuntu 20.04): Debian Bullseye
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.48
PHP version (eg, 7.4): 7.4

The issue you are facing:
Fresh 21.0 install of nextcloud. I could create an account and login. Then I’m trapped in a login loop. My guess is that this has something to do with the overwrite variables.

The url is something like /nextcloud/login?redirect_url=/nextcloud/apps/dashboard/ but the login page does not disappear.

Is this the first time you’ve seen this error? (Y/N): N

Steps to replicate it:

The output of your Nextcloud log in Admin > Logging:

{"reqId":"sDnpXFdgKWHWZFs88eh4","level":3,"time":"2021-09-29T13:59:15+00:00","remoteAddr":"SOME_IP","user":"--","app":"index","method":"GET","url":"/img/actions/confirm-white.svg?v=2","message":{"Exception":"Exception","Message":"The requested uri(/img/actions/confirm-white.svg) cannot be processed by the script '/nextcloud/index.php')","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/base.php","line":937,"function":"getRawPathInfo","class":"OC\\AppFramework\\Http\\Request","type":"->"},{"file":"/var/www/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/AppFramework/Http/Request.php","Line":784,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.4.1"}
{"reqId":"ea5svDTVwSJgAjkrqLqN","level":3,"time":"2021-09-29T13:59:19+00:00","remoteAddr":"SOME_IP","user":"--","app":"index","method":"GET","url":"/img/actions/confirm-white.svg?v=2","message":{"Exception":"Exception","Message":"The requested uri(/img/actions/confirm-white.svg) cannot be processed by the script '/nextcloud/index.php')","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/base.php","line":937,"function":"getRawPathInfo","class":"OC\\AppFramework\\Http\\Request","type":"->"},{"file":"/var/www/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/AppFramework/Http/Request.php","Line":784,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.4.1"}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'secret',
  'passwordsalt' => '',
  'secret' => ',
  'trusted_domains' => 
  array (
    0 => 'IP',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '21.0.4.1',
  'overwrite.cli.url' => 'http:/IP/nextcloud',
  'overwriteprotocol' => 'http',
  'overwritehost' => 'IP',
  'htaccess.RewriteBase' => '/nextcloud',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'dbuser',
  'dbpassword' => 'secret',
  'installed' => true,
);

The output of your Apache/nginx/system log in /var/log/____:


[Wed Sep 29 15:10:41.929284 2021] [proxy_fcgi:error] [pid 83724:tid 281472392999312] [client IP:47840] AH01071: Got error 'PHP message: {"reqId":"pyle3XijUB5tE4nis2ss","level":3,"time":"2021-09-29T13:10:41+00:00","remoteAddr":"IP","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php","message":{"Exception":"Error","Message":"touch(): Unable to create file /var/www/nextcloud/config/config.php because Permission denied at /var/www/nextcloud/lib/private/Config.php#247","Code":0,"Trace":[{"function":"onError","class":"OC\\\\Log\\\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Config.php","line":247,"function":"touch"},{"file":"/var/www/nextcloud/lib/private/Config.php","line":137,"function":"writeData","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Util.php","line":1173,"function":"setValue","class":"OC\\\\SystemConfig","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":413,"function":"getInstanceId","class":"OC_...PHP message: {"reqId":"pyle3XijUB5tE4nis2ss","level":3,"time":"2021-09-29T13:10:41+00:00","remoteAddr":"IP","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php","message":{"Exception":"Error","Message":"fopen(/var/www/nextcloud/config/config.php): failed to open stream: No such file or directory at /var/www/nextcloud/lib/private/Config.php#248","Code":0,"Trace":[{"function":"onError","class":"OC\\\\Log\\\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Config.php","line":248,"function":"fopen"},{"file":"/var/www/nextcloud/lib/private/Config.php","line":137,"function":"writeData","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy /OC_Util.php","line":1173,"function":"setValue","class":"OC\\\\SystemConfig","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":413,"function":"getInstanceId","class":"OC_...PHP message: {"reqId":"pyle3XijUB5tE4nis2ss","level":3,"time":"2021-09-29T13:10:41+00:00","remoteAddr":"IP","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php","message":{"Exception":"Error","Message":"chmod(): No such file or directory at /var/www/nextcloud/lib/private/Config.php#251","Code":0,"Trace":[{"function":"onError","class":"OC\\\\Log\\\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Config.php","line":251,"function":"chmod"},{"file":"/var/www/nextcloud/lib/private/Config.php","line":137,"function":"writeData","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Util.php","line":1173,"function":"setValue","class":"OC\\\\SystemConfig","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":413,"function":"getInstanceId","class":"OC_Util","type":"::"},{"file":"/var/www/nextcloud/lib/base.php...PHP message: {"reqId":"pyle3XijUB5tE4nis2ss","level":3,"time":"2021-09-29T13:10:41+00:00","remoteAddr":"IP","user":"--","app":"index","method":"GET","url":"/nextcloud/index.php","message":{"Exception":"OC\\\\HintException","Message":"Can't write into config directory!","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/Config.php","line":137,"function":"writeData","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Util.php","line":1173,"function":"setValue","class":"OC\\\\SystemConfig","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":413,"function":"getInstanceId","class":"OC_Util","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":639,"function":"initSession","class":"OC","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1076,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextc...PHP message: {"reqId":"pyle3XijUB5tE4nis2ss","level":3,"time":"2021-09-29T13:10:41+00:00","remoteAddr":"IP","user":"--","app":"index","method":"GET","url":"/nextcloud/index.php","message":{"Exception":"Doctrine\\\\DBAL\\\\Exception","Message":"Failed to connect to the database: An exception occurred in the driver: could not find driver","Code":0,"Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1486,"function":"connect","class":"OC\\\\DB\\\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1014,"function":"getWrappedConnection","class":"Doctrine\\\\DBAL\\\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":226,"function":"executeQuery","class":"Doctrine\\\\DBAL\\\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":210,"function":"executeQuery","class":"OC\\\\DB\\\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib...', referer: http://IP/nextcloud/

That message would suggest a problem with write permissions on the config.php - but you say it was already created fine by the installation?

Login not being successful can have multiple reasons unfortunately; the “trusted domains” entry for example could be one potential reason - is it the IP you use for accessing owncloud (i.e. do you really access your cloud via IP address, or do you use a hostname instead?).