Unable to Login to website gui (resolved)

Support intro
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2022-11-25 14:55:07 EST; 2h 38min ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 747 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 901 (apache2)
      Tasks: 11 (limit: 9408)
     Memory: 226.9M
     CGroup: /system.slice/apache2.service
             ├─ 901 /usr/sbin/apache2 -k start
             ├─ 935 /usr/sbin/apache2 -k start
             ├─1156 /usr/sbin/apache2 -k start
             ├─1406 /usr/sbin/apache2 -k start
             ├─1436 /usr/sbin/apache2 -k start
             ├─1454 /usr/sbin/apache2 -k start
             ├─1601 /usr/sbin/apache2 -k start
             ├─1604 /usr/sbin/apache2 -k start
             ├─1605 /usr/sbin/apache2 -k start
             ├─1610 /usr/sbin/apache2 -k start
             └─1613 /usr/sbin/apache2 -k start

Nov 25 14:55:01 nextcloud systemd[1]: Starting The Apache HTTP Server...
Nov 25 14:55:07 nextcloud apachectl[780]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally t>
Nov 25 14:55:07 nextcloud systemd[1]: Started The Apache HTTP Server.



 504 Gateway Time-out openresty
sudo -u www-data php occ maintenance:mode --on
sudo -u www-data php occ maintenance:mode --off
sudo -u www-data php occ db:add-missing-columns
sudo -u www-data php occ maintenance:repair
sudo -u www-data php occ db:add-missing-indices
sudo -u www-data php occ db:add-missing-primary-keys

sudo -u www-data php /var/www/html/occ app:disable spreed

sudo -u www-data php /var/www/html/occ user:resetpassword {{user}}

sudo -u www-data php /var/www/html/occ status
sudo -u www-data php /var/www/html/occ integrity:check-core
sudo -u www-data php /var/www/html/occ integrity:check-app

$ sudo -u www-data php /var/www/html/occ user:info {{user}}
  - user_id: {{user}}
  - display_name: {{user}}
  - email: {{email}}
  - cloud_id: {{user}}@http://{{ip}}
  - enabled: true
  - groups:
    - admin
  - quota: none
  - storage:
    - free: 65830494208
    - used: 16809029286
    - total: 82639523494
    - relative: 20.34
    - quota: -3
  - last_seen: 2022-11-25T22:18:23+00:00
  - user_directory: /var/www/html/data/{{user}}
  - backend: Database

Nextcloud version (eg, 20.0.5): 25.0.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04.5 LTS
Apache or nginx version (eg, Apache 2.4.25): 2.4.41
PHP version (eg, 7.4): PHP 7.4.3

The issue you are facing:

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

Steps to replicate it:

  1. Try to log into web gui
  2. Nothing happens for a few seconds then the screen flickers (reload?) and sits there likes it is trying to load until I get the “504 Gateway Time-out - openresty” error.

I have been working on this for over 8 hours and have nothing left to check, hoping someone can point me in a direction to investigate as I’m out of ideas.

I have been using my Nextcloud with no issues, even after my vmware migration to my new server it was working but after I rebooted the host for some maintenance last night nextcloud web gui no long let’s me log in. It’s not password related because if I put in the wrong it it quickly comes back and says wrong password.

My mobile apps still work but very slowly.

systemctl status apache2.service - takes a while to respond, which is odd not sure why currently
Ran the following during troubleshooting no issues/errors found.

The output of your Nextcloud log in Admin > Logging:

can not log in

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

<?php
$CONFIG = array (
  'instanceid' => 'xxxxxx',
  'passwordsalt' => 'xxxxx',
  'secret' => 'xxxxxx',
  'trusted_domains' => 
  array (
    0 => 'xxxxxx',
    1 => 'xxxx.com',
    2 => 'nextcloud.xxxxx.com',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '25.0.1.1',
  'overwrite.cli.url' => 'http://xxxxxxxx/',
  'overwritehost' => 'nextcloud.xxxxxx.com',
  'overwriteprotocol' => 'https',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '',
  'installed' => true,
  'app_install_overwrite' => 
  array (
    0 => 'epubreader',
    1 => 'files_texteditor',
    2 => 'podcast',
    3 => 'files_markdown',
  ),
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
);

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

Apache
192.168.1.120 - - [25/Nov/2022:17:42:48 -0500] "GET /apps/richdocumentscode/proxy.php?req=/hosting/capabilities HTTP/1.1" 200 552 "-" "Nextcloud Server Crawler"
192.168.1.120 - {{user}} [25/Nov/2022:17:42:45 -0500] "GET /index.php/apps/passwords/api/1.0/session/keepalive HTTP/1.1" 200 2677 "-" "Official Passwords Client for Firefox on Linux"
192.168.1.120 - - [25/Nov/2022:17:43:15 -0500] "GET /apps/richdocumentscode/proxy.php?req=/hosting/capabilities HTTP/1.1" 200 552 "-" "Nextcloud Server Crawler"
192.168.1.120 - - [25/Nov/2022:17:43:15 -0500] "POST /index.php/login/v2/poll HTTP/1.1" 404 735 "-" "Mozilla/5.0 (Linux) mirall/3.5.82daily (build 20220828) (Nextcloud, arch-6.0.8-arch1-1 ClientArchitecture: x86_64 OsArchitecture: x86_64)"
192.168.1.120 - - [25/Nov/2022:17:43:45 -0500] "GET /apps/richdocumentscode/proxy.php?req=/hosting/capabilities HTTP/1.1" 200 552 "-" "Nextcloud Server Crawler"
192.168.1.120 - - [25/Nov/2022:17:43:45 -0500] "POST /index.php/login/v2/poll HTTP/1.1" 404 735 "-" "Mozilla/5.0 (Linux) mirall/3.5.82daily (build 20220828) (Nextcloud, arch-6.0.8-arch1-1 ClientArchitecture: x86_64 OsArchitecture: x86_64)"
192.168.1.120 - - [25/Nov/2022:17:43:47 -0500] "GET /apps/richdocumentscode/proxy.php?req=/hosting/capabilities HTTP/1.1" 200 552 "-" "Nextcloud Server Crawler"
192.168.1.120 - {{user}} [25/Nov/2022:17:43:44 -0500] "GET /index.php/apps/passwords/api/1.0/session/keepalive HTTP/1.1" 200 2677 "-" "Official Passwords Client for Firefox on Linux"
192.168.1.120 - - [25/Nov/2022:17:44:15 -0500] "GET /apps/richdocumentscode/proxy.php?req=/hosting/capabilities HTTP/1.1" 200 552 "-" "Nextcloud Server Crawler"
192.168.1.120 - - [25/Nov/2022:17:44:15 -0500] "POST /index.php/login/v2/poll HTTP/1.1" 404 735 "-" "Mozilla/5.0 (Linux) mirall/3.5.82daily (build 20220828) (Nextcloud, arch-6.0.8-arch1-1 ClientArchitecture: x86_64 OsArchitecture: x86_64)"
192.168.1.120 - - [25/Nov/2022:17:44:22 -0500] "GET /apps/richdocumentscode/proxy.php?req=/hosting/capabilities HTTP/1.1" 200 552 "-" "Nextcloud Server Crawler"
192.168.1.120 - - [25/Nov/2022:17:44:22 -0500] "POST /index.php/login/v2/poll HTTP/1.1" 404 735 "-" "Mozilla/5.0 (Linux) mirall/3.5.82daily (build 20220828) (Nextcloud, arch-6.0.8-arch1-1 ClientArchitecture: x86_64 OsArchitecture: x86_64)"
192.168.1.120 - - [25/Nov/2022:17:44:43 -0500] "GET /apps/richdocumentscode/proxy.php?req=/hosting/capabilities HTTP/1.1" 200 552 "-" "Nextcloud Server Crawler"
192.168.1.120 - {{user}} [25/Nov/2022:17:44:43 -0500] "GET /index.php/apps/passwords/api/1.0/session/keepalive HTTP/1.1" 200 2673 "-" "Official Passwords Client for Firefox on Linux"
192.168.1.120 - - [25/Nov/2022:17:45:01 -0500] "GET /apps/richdocumentscode/proxy.php?req=/hosting/capabilities HTTP/1.1" 200 552 "-" "Nextcloud Server Crawler"
192.168.1.188 - - [25/Nov/2022:17:45:03 -0500] "GET /apps/richdocumentscode/proxy.php?req=/hosting/capabilities HTTP/1.1" 200 533 "-" "Nextcloud Server Crawler"
192.168.1.120 - - [25/Nov/2022:17:41:10 -0500] "POST /index.php/login HTTP/1.1" 303 1467 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0"
192.168.1.188 - - [25/Nov/2022:17:45:44 -0500] "GET /apps/richdocumentscode/proxy.php?req=/hosting/capabilities HTTP/1.1" 200 533 "-" "Nextcloud Server Crawler"
192.168.1.120 - - [25/Nov/2022:17:45:47 -0500] "GET /apps/richdocumentscode/proxy.php?req=/hosting/capabilities HTTP/1.1" 200 552 "-" "Nextcloud Server Crawler"
192.168.1.120 - {{user}} [25/Nov/2022:17:45:42 -0500] "GET /index.php/apps/passwords/api/1.0/session/keepalive HTTP/1.1" 200 2677 "-" "Official Passwords Client for Firefox on Linux"
192.168.1.120 - - [25/Nov/2022:17:46:41 -0500] "GET /apps/richdocumentscode/proxy.php?req=/hosting/capabilities HTTP/1.1" 200 552 "-" "Nextcloud Server Crawler"
192.168.1.120 - {{user}} [25/Nov/2022:17:46:41 -0500] "GET /index.php/apps/passwords/api/1.0/session/keepalive HTTP/1.1" 200 2687 "-" "Official Passwords Client for Firefox on Linux"
192.168.1.120 - - [25/Nov/2022:17:46:48 -0500] "GET /apps/richdocumentscode/proxy.php?req=/hosting/capabilities HTTP/1.1" 200 552 "-" "Nextcloud Server Crawler"
192.168.1.120 - - [25/Nov/2022:17:46:48 -0500] "GET /apps/richdocumentscode/proxy.php?req=/hosting/capabilities HTTP/1.1" 200 552 "-" "Nextcloud Server Crawler"
192.168.1.120 - - [25/Nov/2022:17:46:48 -0500] "GET /apps/richdocumentscode/proxy.php?req=/hosting/capabilities HTTP/1.1" 200 552 "-" "Nextcloud Server Crawler"
192.168.1.120 - {{user}} [25/Nov/2022:17:46:46 -0500] "POST /index.php/apps/passwords/api/1.0/folder/list HTTP/1.1" 200 3319 "-" "Official Passwords Client for Firefox on Linux"
192.168.1.120 - {{user}} [25/Nov/2022:17:46:46 -0500] "POST /index.php/apps/passwords/api/1.0/tag/list HTTP/1.1" 200 2750 "-" "Official Passwords Client for Firefox on Linux"
192.168.1.120 - {{user}} [25/Nov/2022:17:46:46 -0500] "POST /index.php/apps/passwords/api/1.0/password/list HTTP/1.1" 200 7754 "-" "Official Passwords Client for Firefox on Linux"

System
Nov 25 17:20:01 nextcloud CRON[2337]: pam_unix(cron:session): session opened for user www-data by (uid=0)
Nov 25 17:20:01 nextcloud CRON[2338]: (www-data) CMD (php -f /var/www/html/cron.php)
Nov 25 17:23:39 nextcloud CRON[2337]: pam_unix(cron:session): session closed for user www-data
Nov 25 17:25:01 nextcloud CRON[2360]: pam_unix(cron:session): session opened for user www-data by (uid=0)
Nov 25 17:25:01 nextcloud CRON[2361]: (www-data) CMD (php -f /var/www/html/cron.php)
Nov 25 17:27:16 nextcloud sudo[2376]: pam_unix(sudo:auth): authentication failure; logname=nextcloud uid=1000 euid=0 tty=/dev/pts/0 ruser=nextcloud rhost= user=nextcloud
Nov 25 17:27:23 nextcloud sudo[2376]: nextcloud : TTY=pts/0 ; PWD=/var/www/html/dist ; USER=www-data ; COMMAND=/usr/bin/php /var/www/html/occ user:info {{user}}
Nov 25 17:27:23 nextcloud sudo[2376]: pam_unix(sudo:session): session opened for user www-data by nextcloud(uid=0)
Nov 25 17:27:26 nextcloud sudo[2376]: pam_unix(sudo:session): session closed for user www-data
Nov 25 17:29:28 nextcloud sudo[2390]: nextcloud : TTY=pts/0 ; PWD=/var/www/html/dist ; USER=www-data ; COMMAND=/usr/bin/php /var/www/html/occ log:tail
Nov 25 17:29:28 nextcloud sudo[2390]: pam_unix(sudo:session): session opened for user www-data by nextcloud(uid=0)
Nov 25 17:29:33 nextcloud sudo[2390]: pam_unix(sudo:session): session closed for user www-data
Nov 25 17:29:48 nextcloud sudo[2397]: nextcloud : TTY=pts/0 ; PWD=/var/www/html/dist ; USER=www-data ; COMMAND=/usr/bin/php /var/www/html/occ log:tail
Nov 25 17:29:48 nextcloud sudo[2397]: pam_unix(sudo:session): session opened for user www-data by nextcloud(uid=0)
Nov 25 17:29:50 nextcloud sudo[2397]: pam_unix(sudo:session): session closed for user www-data
Nov 25 17:29:50 nextcloud CRON[2360]: pam_unix(cron:session): session closed for user www-data
Nov 25 17:30:01 nextcloud CRON[2405]: pam_unix(cron:session): session opened for user root by (uid=0)
Nov 25 17:30:01 nextcloud CRON[2406]: pam_unix(cron:session): session opened for user www-data by (uid=0)
Nov 25 17:30:01 nextcloud CRON[2407]: (www-data) CMD (php -f /var/www/html/cron.php)
Nov 25 17:30:01 nextcloud CRON[2408]: (root) CMD ([ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /usr/sbin/invoke-rc.d anacron start >/dev/null; fi)
Nov 25 17:30:01 nextcloud CRON[2405]: pam_unix(cron:session): session closed for user root
Nov 25 17:32:00 nextcloud sudo[2421]: nextcloud : TTY=pts/0 ; PWD=/var/www/html/dist ; USER=www-data ; COMMAND=/usr/bin/php /var/www/html/occ list
Nov 25 17:32:00 nextcloud sudo[2421]: pam_unix(sudo:session): session opened for user www-data by nextcloud(uid=0)
Nov 25 17:32:06 nextcloud sudo[2421]: pam_unix(sudo:session): session closed for user www-data
Nov 25 17:33:07 nextcloud CRON[2406]: pam_unix(cron:session): session closed for user www-data
Nov 25 17:33:23 nextcloud sudo[2458]: nextcloud : TTY=pts/0 ; PWD=/var/www/html/dist ; USER=root ; COMMAND=/usr/bin/systemctl status apache2.service
Nov 25 17:33:23 nextcloud sudo[2458]: pam_unix(sudo:session): session opened for user root by nextcloud(uid=0)
Nov 25 17:34:19 nextcloud systemd[1]: Started Run anacron jobs.
Nov 25 17:34:19 nextcloud anacron[2464]: Anacron 2.3 started on 2022-11-25
Nov 25 17:34:19 nextcloud anacron[2464]: Normal exit (0 jobs run)
Nov 25 17:34:19 nextcloud systemd[1]: anacron.service: Succeeded.
Nov 25 17:35:01 nextcloud CRON[2470]: pam_unix(cron:session): session opened for user www-data by (uid=0)
Nov 25 17:35:01 nextcloud CRON[2471]: (www-data) CMD (php -f /var/www/html/cron.php)
Nov 25 17:36:04 nextcloud sudo[2458]: pam_unix(sudo:session): session closed for user root
Nov 25 17:38:03 nextcloud CRON[2470]: pam_unix(cron:session): session closed for user www-data
Nov 25 17:39:01 nextcloud CRON[2493]: pam_unix(cron:session): session opened for user root by (uid=0)
Nov 25 17:39:02 nextcloud CRON[2494]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Nov 25 17:39:02 nextcloud CRON[2493]: pam_unix(cron:session): session closed for user root
Nov 25 17:39:24 nextcloud systemd[1]: Starting Clean php session files…
Nov 25 17:39:25 nextcloud systemd[1]: phpsessionclean.service: Succeeded.
Nov 25 17:39:25 nextcloud systemd[1]: Finished Clean php session files.
Nov 25 17:40:01 nextcloud CRON[2552]: pam_unix(cron:session): session opened for user www-data by (uid=0)
Nov 25 17:40:01 nextcloud CRON[2553]: (www-data) CMD (php -f /var/www/html/cron.php)
Nov 25 17:43:53 nextcloud CRON[2552]: pam_unix(cron:session): session closed for user www-data
Nov 25 17:45:01 nextcloud CRON[2601]: pam_unix(cron:session): session opened for user www-data by (uid=0)
Nov 25 17:45:01 nextcloud CRON[2602]: (www-data) CMD (php -f /var/www/html/cron.php)
Nov 25 17:45:45 nextcloud sudo[2615]: nextcloud : TTY=pts/0 ; PWD=/var/www/html ; USER=root ; COMMAND=/usr/bin/less config/config.php
Nov 25 17:45:45 nextcloud sudo[2615]: pam_unix(sudo:session): session opened for user root by nextcloud(uid=0)
Nov 25 17:47:01 nextcloud sudo[2615]: pam_unix(sudo:session): session closed for user root


Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

No log by that name exists

How are the CPU and memory usage on your system?

Have you ever set up a memory cache (APCu, redis) on it?

Hi Karl,
The cpu/ram are idle as it’s not being used since nobody can log in.


  1  [                                                                                 0.0%]   Tasks: 73, 98 thr; 1 running
  2  [|                                                                                0.6%]   Load average: 3.78 3.67 3.68 
  3  [|                                                                                0.7%]   Uptime: 08:34:50
  4  [|                                                                                0.6%]
  5  [|||                                                                              2.6%]
  6  [                                                                                 0.0%]
  Mem[||||||||||||||||||||||||||                                                1.02G/7.73G]
  Swp[                                                                             0K/2.00G]

I “was” going to work on memory cache this weekend but since I can’t even log in I’m putting that on hold.

Regards,
Muddy

I’ll give an update here in case anyone else finds this.
I finally got back in after moving the vm between hosts a few times (however I doubt that had anything to do with it) and removing the second network adapter so there was only one. (again not sure that mattered)

Created a couple test users and was able to log in then…
Finally reset my password a few times and disable and enabled my account and finally got back in.

sudo -u www-data php /var/www/html/occ user:resetpassword {{user id}}
sudo -u www-data php /var/www/html/occ user:disable {{user id}}
sudo -u www-data php /var/www/html/occ user:enable{{user id}}

In the end I believe it was something in the database with my account but no amount of php fix jobs I ran did anything so not really sure what the issue was.

The main symptom if you have the same is I would get to the login screen put in my user/pass then it would flash or flicker then just hang there with the log in wheel spinning until the 504 timeout.

Hope this helps someone.

1 Like

I’m having the same issue (see my thread about it.) I’m glad if you could solve it, however, this seems too random to me, I’m afraid that you will face this later.

My setup is in docker, so moving the vm or having multiple network adapters wasn’t your problem. I also have a test user, I have tried resetting its password, disabling&enabling it, but it didn’t help as well.

I have also determined earlier that something takes a long time after the apache2 server passes the request to the php process, thus there is either a bug/misconfiguration in the php code, or the database responds really slowly.

I don’t know the exact queries that nextcloud uses, but for a simple select * from oc_users; my mysql shell responds in less than a millisecond.