Nextcloud login has stopped working since OS update

Nextcloud version (eg, 20.0.5): 21.0.0
Operating system and version (eg, Ubuntu 20.04): Centos 7
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.6 (CentOS
PHP version (eg, 7.4): PHP 7.4.28

The issue you are facing: After a yum update at the instigation of the Cloud Provider, the NextCloud login interface has stopped working (silent fail) but the ssl_error_log has lines:

[Fri Mar 04 03:54:53.574864 2022] [core:error] [pid 14430] [client 45.146.165.37:55950] AH00126: Invalid URI in request POST /cgi-bin/.%2e/.%2e/.%2e/.%2e/bin/sh HTTP/1.1
[Sat Mar 05 03:25:35.068149 2022] [php7:error] [pid 14071] [client 20.203.156.151:57579] script '/var/www/html/nextcloud/xmlrpc.php' not found or unable to stat
[Sat Mar 05 06:40:32.239179 2022] [php7:error] [pid 16772] [client 52.226.37.54:59854] script '/var/www/html/nextcloud/wp-login.php' not found or unable to stat
[Sat Mar 05 11:26:38.644417 2022] [php7:error] [pid 14074] [client 52.226.37.54:57308] script '/var/www/html/nextcloud/xmlrpc.php' not found or unable to stat

These files do not exist nor do these errors appear in logs pre-update

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

Steps to replicate it:

  1. Log in to NextCloud web server front page and type in username and password
  2. Fail to log in

The output of your Nextcloud log in Admin > Logging:

{"reqId":"Ye81CoA7vzRp4aCs@oTx4gAAAAE","level":3,"time":"2022-01-24T23:23:54+00:00","remoteAddr":"xxx.xx.xx.x","user":"XXXXXXXX","app":"PHP","method":"PUT","url":"/index.php/apps/text/session/create","message":{"Exception":"Error","Message":"fopen(/var/www/html/nextcloud/data/appdata_oc6wwhxo7ntd/text/documents/379): failed to open stream: No such file or directory at /var/www/html/nextcloud/lib/private/Files/Storage/Local.php#357","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/html/nextcloud/lib/private/Files/Storage/Local.php","line":357,"function":"fopen"},{"file":"/var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":302,"function":"fopen","class":"OC\\Files\\Storage\\Local","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Files/View.php","line":679,"function":"fopen","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Files/Node/Folder.php","line":189,"function":"file_put_contents","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Files/SimpleFS/NewSimpleFile.php","line":134,"function":"newFile","class":"OC\\Files\\Node\\Folder","type":"->"},{"file":"/var/www/html/nextcloud/apps/text/lib/Service/DocumentService.php","line":164,"function":"putContent","class":"OC\\Files\\SimpleFS\\NewSimpleFile","type":"->"},{"file":"/var/www/html/nextcloud/apps/text/lib/Service/ApiService.php","line":96,"function":"createDocument","class":"OCA\\Text\\Service\\DocumentService","type":"->"},{"file":"/var/www/html/nextcloud/apps/text/lib/Controller/SessionController.php","line":50,"function":"create","class":"OCA\\Text\\Service\\ApiService","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":218,"function":"create","class":"OCA\\Text\\Controller\\SessionController","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":127,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/html/nextcloud/lib/base.php","line":993,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/html/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36","version":"21.0.0.18"}

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

<?php
$CONFIG = array (
  'instanceid' => 'oc6wwhxo7ntd',
  'passwordsalt' => 'XXXXXXXXXXX',
  'secret' => 'XXXXXXXXXX',
  'trusted_domains' => 
  array (
    0 => 'xxx.xxx.xxx.xx',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '21.0.0.18',
  'overwrite.cli.url' => 'https://xxx.xxx.xxx.xx/nextcloud',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'XXXXXXXXXX',
  'dbpassword' => 'XXXXXXXXXX',
  'installed' => true,
  'log_type' => 'file',
  'logfile' => '/var/log/nextcloud.log',
  'logtimezone' => 'Australia/Sydney',
  'log_query' => true, 
  'loglevel' => 2,
);

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

nothing useful. See above for ssl_error_log. Have also looked at access_log, error_log, ssl_access_log, ssl_request_log

The things in the ssl-error log are unrelated. And the line of your nextcloud logs is from January.

When you say the login interface has stopped working, you are still seeing the interface itself? You just can’t login?

This was released in Februrary last year, it’s really recommended to do the minor updates (within the NC 21.0.x branch) rather quicly, to fix known bugs and security issues. NC 21 just went out of support, so you should probably plan to upgrade to NC 22 soon. (Upgrades to new major versions are more critical because new features are added, new dependencies for software versions might apply etc.)

1 Like

Fair enough - they did look unrelated but they were the only errors in the logs.
I am seeing the login interface. I type in name and password but don’t get further. Sometimes there is a flash as though it has gone to the next page and then booted straight back out. I managed to dig up my Sandbox and the NextCloud interface still works on that. The main difference is the yum update.
Your comment on NC22 is noted. Trouble is this isn’t really my job. I set it up as a favour for a not so techie friend (who has been using it to great effect) so have only very limited time to work on this.
ATM I am trying to restore a snapshot and worst case scenario is transfer her external storage and configuration to my working Sandbox.

OK, so it looks like I have fixed it though I am not sure what is going on. It seems that someone had monkeyed around with the security groups on the cloud and crippled the mysql port: 3306 hence the silent fail (I’m not sure where that even gets logged and I am not a cloud admin). It may not even have been connected with the yum update (I don’t know when it happened - it wasn’t me) but may have manifested from the resulting reboot.
In a moment of desperation I did try a NC23 install with PHP8.0 on Centos 7 and something went wrong (I forget what now - I was trying lots of stuff) if someone wants to check those instructions but for the moment I can consider this solved.

1 Like

Apologies Centos. Apologies OpenSSL. Apologies Nextcloud. It wasn’t you. It was me.
After the security group red herring I have finally worked out what happened.
On re-enabling login through the interface I mounted the external storage and got straight back to where I started. Then the penny dropped. The external storage is petabytes of gene sequencing data from the supercomputer that is owned by a “service user” for security reasons. This means that I have to run apache as that service user, which means chown/chgrp all apache owned files to that user. The yum update reset all those file ownerships.
Obvious really in hindsight.
Case closed (really this time).

1 Like