Trouble with android app [SOLVED]

Hi!

I am on Nextcloud 12.0.5 now, but issue was started even at 12.0.3. At one moment authorization in the Android app became broken. I type my NC URL, type my credetials and type log in button and nothing happens. But I can connect to demo Nextcloud server. I’ll also tried the Dev application, it does not connecting too.

Few lines from my Apache access log:

192.168.10.172 - - [28/Jan/2018:09:24:06 +0000] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 974 "-" "Mozilla/5.0 (Linux; Android 7.1.2) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Focus/2.5 Chrome/63.0.3239.111 Mobile Safari/537.36"
192.168.10.172 - - [28/Jan/2018:09:24:36 +0000] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 3995 "-" "Mozilla/5.0 (Linux; Android 7.1.2) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Focus/2.5 Chrome/63.0.3239.111 Mobile Safari/537.36"
192.168.10.172 - - [28/Jan/2018:09:25:06 +0000] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 974 "-" "Mozilla/5.0 (Linux; Android 7.1.2) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Focus/2.5 Chrome/63.0.3239.111 Mobile Safari/537.36"
192.168.10.172 - - [28/Jan/2018:09:25:36 +0000] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 974 "-" "Mozilla/5.0 (Linux; Android 7.1.2) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Focus/2.5 Chrome/63.0.3239.111 Mobile Safari/537.36"
192.168.10.172 - - [28/Jan/2018:09:26:06 +0000] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 974 "-" "Mozilla/5.0 (Linux; Android 7.1.2) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Focus/2.5 Chrome/63.0.3239.111 Mobile Safari/537.36"
192.168.10.172 - - [28/Jan/2018:09:26:36 +0000] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 974 "-" "Mozilla/5.0 (Linux; Android 7.1.2) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Focus/2.5 Chrome/63.0.3239.111 Mobile Safari/537.36"
192.168.10.172 - - [28/Jan/2018:09:27:06 +0000] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 974 "-" "Mozilla/5.0 (Linux; Android 7.1.2) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Focus/2.5 Chrome/63.0.3239.111 Mobile Safari/537.36"
192.168.10.172 - - [28/Jan/2018:14:27:36 +0500] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 500 3606 "-" "Mozilla/5.0 (Linux; Android 7.1.2) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Focus/2.5 Chrome/63.0.3239.111 Mobile Safari/537.36"
192.168.10.172 - - [28/Jan/2018:14:28:34 +0500] "GET /status.php HTTP/1.1" 200 4581 "-" "Mozilla/5.0 (Android) ownCloud-android/2.0.1"
192.168.10.172 - - [28/Jan/2018:14:28:34 +0500] "HEAD /remote.php/webdav/ HTTP/1.1" 401 1146 "-" "Mozilla/5.0 (Android) ownCloud-android/2.0.1"
192.168.10.172 - - [28/Jan/2018:14:28:34 +0500] "GET /index.php/login/flow HTTP/1.1" 200 6599 "-" "Wileyfox Wileyfox Swift"
192.168.10.172 - - [28/Jan/2018:14:28:35 +0500] "GET /index.php/core/js/oc.js?v=67406780969603af115b1ae075ee6e83 HTTP/1.1" 200 5224 "-" "Wileyfox Wileyfox Swift"
192.168.10.172 - - [28/Jan/2018:14:28:36 +0500] "GET /cron.php HTTP/1.1" 200 1011 "-" "Wileyfox Wileyfox Swift"
192.168.10.172 - - [28/Jan/2018:14:28:43 +0500] "GET /index.php/login/flow/redirect?clientIdentifier=&stateToken=M1xudZZNBXQ547TjiJELzYv05UqtWGO4cUosQSetwWHeFZgfziARfh1JAAPwhGDH HTTP/1.1" 303 1148 "-" "Wileyfox Wileyfox Swift"
192.168.10.172 - - [28/Jan/2018:14:28:43 +0500] "GET /index.php/login?redirect_url=/index.php/login/flow/redirect%3FclientIdentifier%3D%26stateToken%3DM1xudZZNBXQ547TjiJELzYv05UqtWGO4cUosQSetwWHeFZgfziARfh1JAAPwhGDH HTTP/1.1" 200 3164 "-" "Wileyfox Wileyfox Swift"
192.168.10.172 - - [28/Jan/2018:14:28:44 +0500] "GET /index.php/core/js/oc.js?v=67406780969603af115b1ae075ee6e83 HTTP/1.1" 200 5224 "-" "Wileyfox Wileyfox Swift"
192.168.10.172 - - [28/Jan/2018:14:28:44 +0500] "GET /cron.php HTTP/1.1" 200 1011 "-" "Wileyfox Wileyfox Swift"
192.168.10.172 - - [28/Jan/2018:14:29:00 +0500] "POST /index.php/login?redirect_url=/index.php/login/flow/redirect%3FclientIdentifier%3D%26stateToken%3DM1xudZZNBXQ547TjiJELzYv05UqtWGO4cUosQSetwWHeFZgfziARfh1JAAPwhGDH HTTP/1.1" 303 1207 "-" "Wileyfox Wileyfox Swift"
192.168.10.172 - - [28/Jan/2018:14:29:01 +0500] "GET /index.php/login/flow/redirect?clientIdentifier=&stateToken=M1xudZZNBXQ547TjiJELzYv05UqtWGO4cUosQSetwWHeFZgfziARfh1JAAPwhGDH HTTP/1.1" 200 2624 "-" "Wileyfox Wileyfox Swift"
192.168.10.172 - - [28/Jan/2018:14:29:02 +0500] "GET /index.php/core/js/oc.js?v=67406780969603af115b1ae075ee6e83 HTTP/1.1" 200 5277 "-" "Wileyfox Wileyfox Swift"
192.168.10.172 - - [28/Jan/2018:14:29:03 +0500] "GET /cron.php HTTP/1.1" 200 1011 "-" "Wileyfox Wileyfox Swift"
192.168.10.172 - - [28/Jan/2018:14:29:03 +0500] "POST /index.php/login/flow HTTP/1.1" 303 1113 "-" "Wileyfox Wileyfox Swift"
192.168.10.172 - - [28/Jan/2018:14:29:04 +0500] "GET /status.php HTTP/1.1" 200 1751 "-" "Mozilla/5.0 (Android) ownCloud-android/2.0.1"
192.168.10.172 - - [28/Jan/2018:14:29:04 +0500] "HEAD /remote.php/webdav/ HTTP/1.1" 401 1138 "-" "Mozilla/5.0 (Android) ownCloud-android/2.0.1"
192.168.10.172 - bergentroll [28/Jan/2018:14:29:04 +0500] "HEAD /remote.php/webdav/ HTTP/1.1" 200 1168 "-" "Mozilla/5.0 (Android) ownCloud-android/2.0.1"
192.168.10.172 - bergentroll [28/Jan/2018:14:29:05 +0500] "GET /ocs/v1.php/cloud/user?format=json HTTP/1.1" 200 1647 "-" "Mozilla/5.0 (Android) ownCloud-android/2.0.1"

There is nothing related in NC log, also couple of times I get this in the error log:
[Sun Jan 28 14:27:36.874180 2018] [:error] [pid 12339] [client 192.168.10.172:45519] PHP Fatal error: Uncaught Doctrine\\DBAL\\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory in /var/www/nextcloud/lib/private/DB/Connection.php:61\nStack trace:\n#0 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\\DB\\Connection->connect()\n#1 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\\DBAL\\Connection->getDatabasePlatformVersion()\n#2 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\\DBAL\\Connection->detectDatabasePlatform()\n#3 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\\DBAL\\Connection->getDatabasePlatform()\n#4 /var/www/nextcloud/lib/private/DB/Connection.php(148): Doctrine\\DBAL\\Connection->setTransactionIsolation(2)\n#5 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\\DB\\Connection->__construct(Array, Object(Doctrine\\DBAL\\Driver\\PDOMySql\\Driver), Obj in /var/www/nextcloud/lib/private/DB/Connection.php on line 61

cc @MorrisJobke - since the demo server works I’d suspect it to be a server configuration issue

Looks like an issue with the database. Please check that the database is available and responds to queries.

So do I. But my config is very simple, and I have no idea, what can be wrong.
My Apache site config:

<VirtualHost *:80>
    ServerName grotten.ru
    Redirect permanent / https://grotten.ru/
</VirtualHost>

<IfModule mod_ssl.c>
    <VirtualHost *:443>
        ServerName grotten.ru
        ServerAdmin root@grotten.ru
        DocumentRoot /var/www/nextcloud
        ErrorLog ${APACHE_LOG_DIR}/nextcloud-error.log
        CustomLog ${APACHE_LOG_DIR}/nextcloud-access.log combined
        <IfModule mod_headers.c>
            Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
        </IfModule>

        <Directory /var/www/nextcloud>
            AllowOverride All
        </Directory>

        SSLCertificateFile /etc/letsencrypt/live/grotten.ru/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/grotten.ru/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

Cloud can not work at all without DB connection, is not it? But my works fine (except Android app…). May be it was a mysql restart.

Should some special application be activated?

Guys, I still have troubles with android Nextcloud and Nextcloud Dev, but I have no problems with android ownCloud client. Also it seems trouble is only with one account, with other accounts I can log in smoothly.

Solved. Trouble was with my phone. After factory reset NC finally works.

After server reboot android app became disconnected and issue have came back.

Did you find the answer, I am having troubles with this issue too.

Thanks!

Oh, yes!
I can not find proofs now, but it was issue with installing the Nextcloud app to outer memory (on your SD-card).
Now I always keep the app on internal storage and have no more that trouble.

@bergentroll thanks for info. I hoped it is related to a similar Login Issue in Browser. But it does not seem so.