Server: Nextcloud 17.0.1 Login Loop

Created on 16 Nov 2019  路  17Comments  路  Source: nextcloud/server

Steps to reproduce

  1. Fresh install of NC 17 with php-7.3 amd Apache 2.4.41 on Ubuntu 18.04
  2. Intial setup worked
  3. Logging in today resulted in the login loop
sudo -u www-data php occ app:list

Enabled:
  - accessibility: 1.3.0
  - activity: 2.10.1
  - apporder: 0.8.0
  - calendar: 1.7.1
  - cloud_federation_api: 1.0.0
  - comments: 1.7.0
  - contacts: 3.1.6
  - dav: 1.13.0
  - federatedfilesharing: 1.7.0
  - federation: 1.7.0
  - files: 1.12.0
  - files_pdfviewer: 1.6.0
  - files_rightclick: 0.15.1
  - files_sharing: 1.9.0
  - files_trashbin: 1.7.0
  - files_versions: 1.10.0
  - files_videoplayer: 1.6.0
  - firstrunwizard: 2.6.0
  - gallery: 18.4.0
  - logreader: 2.2.0
  - lookup_server_connector: 1.5.0
  - maps: 0.1.2
  - nextcloud_announcements: 1.6.0
  - notifications: 2.5.0
  - oauth2: 1.5.0
  - password_policy: 1.7.0
  - privacy: 1.1.0
  - provisioning_api: 1.7.0
  - recommendations: 0.5.0
  - serverinfo: 1.7.0
  - sharebymail: 1.7.0
  - support: 1.0.1
  - survey_client: 1.5.0
  - systemtags: 1.7.0
  - text: 1.1.1
  - theming: 1.8.0
  - twofactor_backupcodes: 1.6.0
  - unsplash: 1.1.4
  - updatenotification: 1.7.0
  - viewer: 1.2.0
  - workflowengine: 1.7.0
Disabled:
  - admin_audit
  - encryption
  - files_external
  - user_ldap

Nextcloud configuration:


Config report

"system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "192.168.178.68:880"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "17.0.1.1",
        "overwritehost": "192.168.178.68:880",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "maintenance": false,
        "filelocking.enabled": "true",
        "htaccess.RewriteBase": "\/",
        "integrity.check.disabled": false,
        "knowledgebaseenabled": false,
        "logfile": "\/var\/nc_data\/nextcloud.log",
        "loglevel": 2,
        "logtimezone": "Europe\/Berlin",
        "log_rotate_size": 104857600,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "overwriteprotocol": "http",
        "preview_max_x": 1024,
        "preview_max_y": 768,
        "preview_max_scale_factor": 1,
        "quota_include_external_storage": false,
        "share_folder": "\/Shares",
        "skeletondirectory": "",
        "theme": "",
        "trashbin_retention_obligation": "auto, 7",
        "updater.release.channel": "stable"

Client configuration

Browser:
Firefox 70.0.1
Operating system:
Windows 10

0. Needs triage bug needs info

Most helpful comment

I would assume that the problem is most likely caused by a configuration issue. Have you checked the Nextcloud help forum for any solution? Similar problems have been addressed and answered there in the past:

https://help.nextcloud.com/search?q=login%20loop

All 17 comments

Logs? Is your session directory writeable?

Strangely, my nextcloud.log is completely empty.

ls -fl /var/www/nextcloud/
total 164
-rw-r--r--  1 www-data www-data 12063 Nov  7 12:04 AUTHORS
-rw-r--r--  1 www-data www-data   362 Nov  7 12:08 version.php
-rw-r--r--  1 www-data www-data  5139 Nov  7 12:04 remote.php
-rw-r--r--  1 www-data www-data   156 Nov  7 12:04 index.html
-rw-r--r--  1 www-data www-data   101 Nov  7 12:04 .user.ini
drwxr-xr-x 15 www-data www-data  4096 Nov 16 21:43 .
drwxr-xr-x 33 www-data www-data  4096 Nov  7 12:08 3rdparty
drwxr-xr-x 23 www-data www-data  4096 Nov  7 12:08 core
-rw-r--r--  1 www-data www-data   283 Nov  7 12:04 occ
-rw-r--r--  1 www-data www-data  2951 Nov  7 12:04 public.php
drwxr-xr-x  4 root     root      4096 Nov 10 20:49 ..
-rw-r--r--  1 www-data www-data  2287 Nov  7 12:04 status.php
drwxr-xr-x 13 www-data www-data  4096 Nov  7 12:08 settings
drwxr-xr-x  2 www-data www-data  4096 Nov  7 12:04 ocm-provider
drwxr-xr-x  4 www-data www-data  4096 Nov  7 12:04 resources
drwxr-xr-x  6 www-data www-data  4096 Nov  7 12:04 lib
drwxr-xr-x  2 www-data www-data  4096 Nov 16 22:12 data
drwxr-xr-x  2 www-data www-data  4096 Nov  7 12:04 ocs
-rw-r--r--  1 www-data www-data 34520 Nov  7 12:04 COPYING
-rw-r--r--  1 www-data www-data    26 Nov  7 12:04 robots.txt
-rw-r--r--  1 www-data www-data  3805 Nov  7 12:04 console.php
drwxr-xr-x 47 www-data www-data  4096 Nov 11 13:14 apps
drwxr-xr-x  2 www-data www-data  4096 Nov 16 22:08 config
drwxr-xr-x  2 www-data www-data  4096 Nov  7 12:04 ocs-provider
drwxr-xr-x  2 www-data www-data  4096 Nov  7 12:05 updater
-rw-r--r--  1 www-data www-data  3737 Nov 11 20:04 .htaccess
drwxr-xr-x  3 www-data www-data  4096 Nov  7 12:04 themes
-rw-r--r--  1 www-data www-data  3172 Nov  7 12:04 index.php
-rw-r--r--  1 www-data www-data  4993 Nov  7 12:04 cron.php

hope this helps.

Have you tried to enable the debug logging by setting "'loglevel' => 0,"?

No, I haven't. I'll give it a look as soon as I can.

This doesn麓t produces any output. Any ideas where to look else for debug?

Steps to reproduce

No steps to reproduce

Behaviour

Login to webclient results in login loop.

Server configuration

Operating system: CentOS 7

Web server: nginx/1.16.1

Database: psql (PostgreSQL) 10.11

PHP version: PHP 7.2.24

Nextcloud version: 17.0.1.1

Updated from an older Nextcloud/ownCloud or fresh install: Updated from v16 to v17

Where did you install Nextcloud from: Installed manual from archive file.

Signing status:


Signing status

Can't provide this information, since i can not login

List of activated apps:


App list

Enabled:                                                                                                                                                                                      
  - accessibility: 1.3.0                                                                                                                                                                      
  - activity: 2.10.1                                                                                                                                                                          
  - admin_audit: 1.7.0                                                                                                                                                                        
  - bruteforcesettings: 1.4.0                                                                                                                                                                 
  - calendar: 1.7.1 
  - circles: 0.17.10
  - cloud_federation_api: 1.0.0
  - comments: 1.7.0
  - contacts: 3.1.6
  - dav: 1.13.0
  - federatedfilesharing: 1.7.0
  - federation: 1.7.0
  - files: 1.12.0
  - files_markdown: 2.1.0
  - files_pdfviewer: 1.6.0
  - files_rightclick: 0.15.1
  - files_sharing: 1.9.0
  - files_trashbin: 1.7.0
  - files_versions: 1.10.0
  - files_videoplayer: 1.6.0
  - firstrunwizard: 2.6.0
  - gallery: 18.4.0
  - logreader: 2.2.0
  - lookup_server_connector: 1.5.0
  - nextcloud_announcements: 1.6.0
  - notifications: 2.5.0
  - oauth2: 1.5.0
  - password_policy: 1.7.0
  - polls: 0.10.4
  - privacy: 1.1.0
  - provisioning_api: 1.7.0
  - recommendations: 0.5.0
  - serverinfo: 1.7.0
  - sharebymail: 1.7.0
  - support: 1.0.1
  - survey_client: 1.5.0
  - systemtags: 1.7.0
  - tasks: 0.11.3
  - text: 1.1.1
  - theming: 1.8.0
  - twofactor_backupcodes: 1.6.0
  - updatenotification: 1.7.0
  - viewer: 1.2.0
  - workflowengine: 1.7.0
Disabled:
  - encryption
  - files_external
  - user_ldap

Nextcloud configuration:


Config report

{                                                                                                                                                                                             
    "system": {                                                                                                                                                                               
        "instanceid": "***REMOVED SENSITIVE VALUE***",                                                                                                                                        
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",                                                                                                                                      
        "secret": "***REMOVED SENSITIVE VALUE***",                                                                                                                                            
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***"
        ],

        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "17.0.1.1",
        "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "twofactor_enforced": "false",
        "twofactor_enforced_groups": [],
        "twofactor_enforced_excluded_groups": [],
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "tls",
        "mail_sendmailmode": "smtp",
        "mail_smtpauthtype": "PLAIN",
        "mail_smtpauth": 1,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "theme": "",
        "log_type": "file",
        "logfile": "\/var\/www\/nextcloud\/log\/nextcloud.log",
        "loglevel": "0",
        "logdateformat": "F d, Y H:i:s",
        "app_install_overwrite": [
            "calendar",
            "circles"
        ],
        "updater.secret": "***REMOVED SENSITIVE VALUE***"
    }
}

Are you using external storage, if yes which one: no

Are you using encryption: no

Are you using an external user-backend, if yes which one: no

Client configuration

Browser: Firefox 70.0.

Operating system: Fedora 31

Logs

Web server error log

Nothing logged to nginx error log.

Nextcloud log (data/nextcloud.log)


Nextcloud log

After a login attempt, these 3 lines appear in the NC log. (Loglevel=0)

{"reqId":"6WAboQ4jVR7Z0roWP20q","level":0,"time":"November 28, 2019 16:30:45","remoteAddr":"94.134.88.123","user":"--","app":"core","method":"GET","url":"\/apps\/files\/","message":{"Exception":"OC\\AppFramework\\Middleware\\Security\\Exceptions\\NotLoggedInException","Message":"Current user is not logged in","Code":401,"Trace":[{"file":"\/var\/www\/nextcloud\/html\/lib\/private\/AppFramework\/Middleware\/MiddlewareDispatcher.php","line":95,"function":"beforeController","class":"OC\\AppFramework\\Middleware\\Security\\SecurityMiddleware","type":"->","args":[{"__class__":"OCA\\Files\\Controller\\ViewController"},"index"]},{"file":"\/var\/www\/nextcloud\/html\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":98,"function":"beforeController","class":"OC\\AppFramework\\Middleware\\MiddlewareDispatcher","type":"->","args":[{"__class__":"OCA\\Files\\Controller\\ViewController"},"index"]},{"file":"\/var\/www\/nextcloud\/html\/lib\/private\/AppFramework\/App.php","line":126,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Files\\Controller\\ViewController"},"index"]},{"file":"\/var\/www\/nextcloud\/html\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Files\\Controller\\ViewController","index",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"files.view.index"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"_route":"files.view.index"}]},{"file":"\/var\/www\/nextcloud\/html\/lib\/private\/Route\/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"_route":"files.view.index"}]},{"file":"\/var\/www\/nextcloud\/html\/lib\/base.php","line":1000,"function":"match","class":"OC\\Route\\Router","type":"->","args":["\/apps\/files\/"]},{"file":"\/var\/www\/nextcloud\/html\/index.php","line":42,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"\/var\/www\/nextcloud\/html\/lib\/private\/AppFramework\/Middleware\/Security\/SecurityMiddleware.php","Line":135,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (X11; Fedora; Linux x86_64; rv:70.0) Gecko\/20100101 Firefox\/70.0","version":"17.0.1.1"}
{"reqId":"DSGDYwHSYkaHuCm5aOuU","level":0,"time":"November 28, 2019 16:30:45","remoteAddr":"94.134.88.123","user":"--","app":"cron","method":"GET","url":"\/cron.php","message":"Run OCA\\DAV\\BackgroundJob\\UploadCleanup job with ID 936","userAgent":"Mozilla\/5.0 (X11; Fedora; Linux x86_64; rv:70.0) Gecko\/20100101 Firefox\/70.0","version":"17.0.1.1"}
{"reqId":"DSGDYwHSYkaHuCm5aOuU","level":0,"time":"November 28, 2019 16:30:46","remoteAddr":"94.134.88.123","user":"--","app":"cron","method":"GET","url":"\/cron.php","message":"Finished OCA\\DAV\\BackgroundJob\\UploadCleanup job with ID 936 in 1 seconds","userAgent":"Mozilla\/5.0 (X11; Fedora; Linux x86_64; rv:70.0) Gecko\/20100101 Firefox\/70.0","version":"17.0.1.1"}

Browser log


Browser log

JQMIGRATE: Migrate is installed, version 1.4.1 (jquery-migrate.min.js:2:551)
Could not find initial state loginErrors of core (initialstate.js:31:10)
Could not find initial state loginMessages of core (initialstate.js:31:10)
Could not find initial state resetPasswordTarget of core (initialstate.js:31:10)
Could not find initial state resetPasswordUser of core (initialstate.js:31:10)

Sorry didn't see this nice little template, I've updated my post.

I would assume that the problem is most likely caused by a configuration issue. Have you checked the Nextcloud help forum for any solution? Similar problems have been addressed and answered there in the past:

https://help.nextcloud.com/search?q=login%20loop

Hi @j-ed ,
thanks for the link, this post solved my issue. After php upgrade some folders had group set to apache rather than nginx.
I figured out this directories by firing up a find to the whole system:
find / -group apache -type d -name "*"

In my case, the group on /var/opt/rh/rh-php72/lib/php/session was incorrectly assigned.

Thanks again! =)

@A1pen Fine, please don't forget to close this issue ticket 馃槈

I can't close this issue, the original author was @CountOmega.
Maybe this will also solve the problem for @CountOmega?

BR

For me, the command had to be altered to `find / -group www-data -type d -name "*". What permission do the php directories need?

If you are using Apache the directories should have the group www-data, for nginx it should be nginx

Sorry if if didn't express this right. The command above shows me the desired directories. The question is which need www-data ownership and which not.

Maybe this should also be included in the nextcloud docs for better debugging.

Is your session directory writeable?

This one needs to be writeable by the webserver / php user. Check session.save_path with your php configuration (php.ini most likely).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ChristophWurst picture ChristophWurst  路  3Comments

Django-BOfH picture Django-BOfH  路  3Comments

MorrisJobke picture MorrisJobke  路  3Comments

arno01 picture arno01  路  3Comments

blackcrack picture blackcrack  路  3Comments