My Nextcloud is not working anymore

Hi-
My nextcloud account is not syncing any more with my laptop, I thought it’s a problem with the Nextcloud Ubuntu app, but in fact even on the browser the link to my instance is not opening any more, I am getting the message: The gateway did not receive a timely response from the upstream server or application.
I checked my instance host settings on gandi.net and everything is working well and up to date.

Could you help me to find a solution for this problem.

Thank you

Hi @wael87,

in order to help you, please provide some additional information as stated within issue template.

  • Latest nextcloud.log entries
  • Webserver and database logs, as well as which ones you actually use
  • Your Nextcloud config.php (anonymized).
    Or are you on hosted provider?

Can you access other pages (webserver default index.html) on your server?

Hi Michalng,

Thank you for your reply,

I apologise, I don’t have the technical capacity to provide you with what you asked for, and I simply can’t access my nextcloud account. This is turning to be so frustrating for me as I am planning to move to opensource alternatives in my daily work and stay away from Google and Apple, but it seems a long process of struggle and not a user friendly alternatives.

I can provide you with further explanation to make my case more clear as much as I can.

In fact, my nextcloud account is hosted by Gandi.net where I bought a domain and I created a cloud instance on this same domain. I installed Nextcloud and everything worked perfectly for a while. Recently, I figured out that Nextcloud suddenly stopped syncing on my laptop and my smartphone, I went to my nextcloud page (cloud.thenameofmydomaine.com/nextcloud) but it’s showing 504 Gateway Timeout error as if the page doesn’t exist any more. I checked my settings on the domain provider and everything seemed fine, then I went to Fliezilla account settings of my instance and everything is fine and in place as usual. I have no idea why my nextcloud account stopped existing suddenly and completely for no obvious explanation.

Wish this can make things more clear regarding my case,
Thank you.

You will need access to the command line of your cloud instance. You already seem to have ftp, sftp or scp acess through filezilla. When you access your instance, there should be a log named nextcloud.log - get it via filezilla and post the last lines.

Also, have you checked, that your cloud instance hasn’t run out of space? That would most likely kill you database and render your NC inoperable.

Ah okay, then getting webserver and database logs of course is a bid difficult, besides asking your provider for the logs related to your instance.

At least besides what budy suggested, please provide your /nextcloud/config/config.php file, so we can check for inconsistencies, even that the issue looks more like webserver/network configuration related.

Hi @MichaIng and @budy
Thank you so much for your reply and your instructions,
In fact, I did find these documents and I will share with you the last lines of these documents, hope this can give you a better idea of the type of problem am encountering.

These are the last lines of the nextcloud.log file:

“PHP”,“method”:“GET”,“url”:"/ocs/v2.php/apps/notifications/api/v2/notifications",“message”:“Doctrine\DBAL\Exception\DriverException: An exception occurred while executing ‘SELECT "uid", "displayname" FROM "oc_users" WHERE LOWER("uid") = LOWER(?)’ with params ["cloud.waeltahhan"]:\n\nSQLSTATE[HY000]: General error: 17 database schema has changed at /srv/data/web/vhosts/cloud.waeltahhan.com/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php#85”,“userAgent”:“Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0”,“version”:“13.0.0.14”}
{“reqId”:“9cKACz6gRwqDSsMznvZV”,“level”:3,“time”:“2018-03-05T15:11:26+00:00”,“remoteAddr”:“78.119.150.81”,“user”:“cloud.waeltahhan”,“app”:“index”,“method”:“GET”,“url”:"/index.php/settings/personal/authtokens",“message”:“Exception: “,“userAgent”:“Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0”,“version”:“13.0.0.14”} {“reqId”:“dL6ef4sK0P7eesoi27En”,“level”:3,“time”:“2018-03-05T15:11:52+00:00”,“remoteAddr”:“78.119.150.81”,“user”:“cloud.waeltahhan”,“app”:“index”,“method”:“GET”,“url”:”/index.php/settings/personal/authtokens”,“message”:“Exception: “,“userAgent”:“Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0”,“version”:“13.0.0.14”} {“reqId”:“AqjYC4bnUGibHvh1pyPV”,“level”:3,“time”:“2018-03-05T15:12:13+00:00”,“remoteAddr”:“78.119.150.81”,“user”:“cloud.waeltahhan”,“app”:“index”,“method”:“GET”,“url”:”/index.php/settings/personal/authtokens”,“message”:“Exception: “,“userAgent”:“Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0”,“version”:“13.0.0.14”} {“reqId”:“zcocuy3Y5FeDfEW4x3z6”,“level”:3,“time”:“2018-03-05T15:12:27+00:00”,“remoteAddr”:“78.119.150.81”,“user”:“cloud.waeltahhan”,“app”:“index”,“method”:“GET”,“url”:”/index.php/settings/personal/authtokens”,“message”:"Exception: ",“userAgent”:“Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0”,“version”:“13.0.0.14”}

And this is the contents of my config.php file:

<?php $CONFIG = array ( ‘instanceid’ => ‘oc0vpn1gzql1’, ‘passwordsalt’ => ‘xxxxxxxxxxx’, ‘secret’ => ‘xxxxxxxxxxxxxx’, ‘trusted_domains’ => array ( 0 => ‘cloud.xxxxx.com’, ), ‘datadirectory’ => ‘/srv/data/web/vhosts/cloud.xxxxxxxx.com/htdocs/data’, ‘overwrite.cli.url’ => ‘https://cloud.xxxxxx.com’, ‘dbtype’ => ‘sqlite3’, ‘version’ => ‘13.0.0.14’, ‘installed’ => true, ‘updater.release.channel’ => ‘stable’, ‘maintenance’ => false, ‘theme’ => ‘’, ‘loglevel’ => 2, );

Regarding the space left in my instance, I am sure that at least half of the space is still available.

I really appreciate your hep,
Thank you :slight_smile:

Damn, please remove sensitive information when you copy and paste your config.
I just edited your post and removed your password, salt and domain name, but while it was online for 5 hours, you should treat these values as compromised.

Regarding your issue:
Did you update Nextcloud lately which resulted in the sync to stop working?
The message

General error: 17 database schema has changed at /srv/data/web/vhosts/cloud.waeltahhan.com/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php#85”

Sounds a bit like a missing database migration, after the update.
If there was an update, how did you perform it?

Apart from that, do you have SSH access to the server? You would need to check if the database and other services are running. It’s possible that the PHP handler or something like that has stopped.
That’s the web server error telling: When forwarding a request the service in the background (upstream server) didn’t answer. So we need to find out, what upstream server is meant by that.

Hi @Schmu

Ohhh!!! Thank you very much for modifying my post, I was not aware of the content, I should absolutely give more attention to these details before publishing. I changed already my domain password and I will change Nextcloud password as soon as I get access to it. Hope this would be enough to prevent the risk of my last post.

Regarding your suggestion, I would kindly ask for further explanation because am not sure how to have access to SSH, I do have access to my PHP admin page in and my instance admin through my hosting account Gandi.net.

And to answer your question, I didn’t update my instance recently, the last one was Nextcloud version 13 and it all seemed fine after. I updated my payment method recently in my domain hosting website, but it went fine and I don’t have any payment due.

https://duckduckgo.com/?q=gandi+ssh
https://wiki.gandi.net/en/simple/console

Thanks a lot @linucksrox for the links, I finally created SSH key and added it to filezilla in order to access the server.
@Schmu what are the files that should be checked to know if the database is running fine ?

Thank you

I might start with

sudo -u www-data php /nextcloud/installation/root/occ check
and
sudo -u www-data php /nextcloud/installation/root/occ status

And see if anything stands out.

Me again, and the problem is not solved, I had the idea to delete my instance and start from zero, but I would prefer to fix this problem and learn from it so if for whatever reason happened again I can fix it instead of escaping every time from solutions.

The thing is I am connected to my instance through command line and I have SSH access to the server, however the command line that @linucksrox had mentioned are given a command not found result

> hosting-user@mycloud:/srv/data$  sudo -u www-data php /nextcloud/installation/root/occ status
> bash: sudo: command not found

I made some search on the help section of my hosting site Gandi, and I found that Gandi users have no root access by default. Here is the notice from their site:

Connection as root

By default, you do not have “root” access to your server when you use Gandi AI to create your server.

This being said, if during the course of using your server, you need access to your server as root, and if you are an experienced server administrator , you can permanently deactivate Gandi AI for your server and obtain root access.

I went to the control panel of my instance in the php logs I checked the fpm.log and I get this warning that keeps repeating hundred times:

[03-Apr-2018 12:08:46] WARNING: [pool www] child 533, script '/srv/data/web/vhosts/xxxxxxx.xxxxxxxxx.com/htdocs/status.php' (request: "GET /status.php") execution timed out (207.604728 sec), terminating

And in the error.log file I found this error dating from the same day in which my instance crashed:

[03-Apr-2018 12:53:01 UTC] PHP Fatal error:  Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred while executing 'PRAGMA journal_mode = WAL':

SQLSTATE[HY000]: General error: 5 database is locked in /srv/data/web/vhosts/xxxxxxxxxx.xxxxxxx.com/htdocs/lib/private/DB/Connection.php:64
Stack trace:
#0 /srv/data/web/vhosts/xxxxxxxxxx.xxxxxxx.com/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(992): OC\DB\Connection->connect()
#1 /srv/data/web/vhosts/xxxxxxxxxx.xxxxxxx.com/htdocs/lib/private/DB/Connection.php(216): Doctrine\DBAL\Connection->executeUpdate('PRAGMA read_unc...', Array, Array)
#2 /srv/data/web/vhosts/xxxxxxxxxx.xxxxxxx.com/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): OC\DB\Connection->executeUpdate('PRAGMA read_unc...')
#3 /srv/data/web/vhosts/xxxxxxxxxx.xxxxxxx.com/htdocs/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#4 /srv/data/web/vhosts/xxxxxxxxxx.xxxxxxx.com/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172):  in /srv/data/web/vhosts/xxxxxxxxxx.xxxxxxx.com/htdocs/lib/private/DB/Connection.php on line 64

While in the control panel appache error.log I found this message everywhere recently:

[Thu Apr 12 05:43:30.273181 2018] [mpm_event:error] [pid 158:tid 140*********] AH03490: scoreboard is full, not at MaxRequestWorkers.Increase ServerLimit.
[Thu Apr 12 05:43:30.491398 2018] [proxy_fcgi:error] [pid 5420:tid 140********]] (70007)The timeout specified has expired: [client xx.xxx.xxx.xx:44450] AH01075: Error dispatching request to : (polling)

Any chance you can reboot your server?