Cannot connect on mobile app

Issue Overview

When I attempt to access my nextcloud on mobile apps, I get “Access forbidden. State token does not match.”

Steps to replicate it:

  1. Attempt to login to my server on mobile app.

Note that mobile browser works fine & desktop browser work fine & desktop app work fine. It’s only the mobile apps.

Mobile apps are from F-Droid store on stock Samsung phone if that matters.

NC Config

Nextcloud version (eg, 20.0.5): 21.0.0
Operating system and version (eg, Ubuntu 20.04): replace me
Apache or nginx version (eg, Apache 2.4.25): replace me
PHP version (eg, 7.4): replace me
Database: MariaDB

Log Overview

The output of your Nextcloud log in Admin > Logging:

I think the important line is here:
Base table or view not found: 1932 Table 'NC_v3b.oc_activity' doesn't exist in engine"

Full log here:
https://pastebin.com/qUtVNeXB

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

<?php $CONFIG = array ( 'instanceid' => '*redacted*', 'dbtableprefix' => 'oc_', 'passwordsalt' => '*redacted*', 'secret' => '*redacted*', 'trusted_domains' => array ( 0 => https://nextcloud.my.domain, 1 => https://www.nextcloud.my.domain, ), 'datadirectory' => '/home/server/nextcloud_data', 'dbtype' => 'mysql', 'version' => '21.0.0.18', #'overwriteprotocol' => 'https', 'overwrite.cli.url' => 'https://nextcloud.my.domain/', 'default_phone_region' => 'US', 'dbname' => '*redacted*', 'dbhost' => '*redacted*', 'dbport' => '', 'mysql.utf8mb4' => true, 'dbuser' => '*redacted*', 'dbpassword' => '*redacted*', 'installed' => true, 'ldapIgnoreNamingRules' => false, 'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory', 'maintenance' => false, 'mail_domain' => 'gmail.com', 'mail_from_address' => '*redacted*', 'mail_smtpmode' => 'smtp', 'mail_sendmailmode' => 'smtp', 'mail_smtpsecure' => 'ssl', 'mail_smtpauthtype' => 'LOGIN', 'mail_smtpname' => '*redacted*', 'mail_smtppassword' => '*redacted*', 'mail_smtpauth' => 1, 'mail_smtphost' => 'smtp.gmail.com', 'mail_smtpport' => '465', 'loglevel' => 2, 'log_type' => 'file', 'logfile' => 'nextcloud.log', 'theme' => '', 'filesystem_check_changes' => 1, ); **The output of your Apache/nginx/system log in `/var/log/____`:** `No log outputs related to this.

Have you seen this posting:

Despite coming across various other posts, I had not stumbled upon that one.

I will take a look this evening.

Alright, I took a look at the answer and as suggested deleted the database entry for oc_bruteforce_attempts However I am (now*) getting the “multiple invalid login attempts” & it’s adding a delay of 30 seconds to throttle.

  • I had previously gotten this before but it went away. But now it’s back.

To my untrained eye, the log looks similiar

php","Line":82}},"CustomMessage":"--"},"userAgent":"Samsung SM-G998U1 (Android)","version":"21.0.0.18"}
{"reqId":"W4POwmWLNhwodvydZ0KQ","level":2,"time":"2021-08-18T00:54:35+00:00","remoteAddr":"10.1.1.1","user":"--","app":"core","method":"GET","url":"/index.php/login/flow","message":"Renewing session token failed","userAgent":"Samsung SM-G998U1 (Android)","version":"21.0.0.18"}
{"reqId":"wtcAk9SFa4q4Y4YmPy9V","level":3,"time":"2021-08-18T00:56:23+00:00","remoteAddr":"10.1.1.1","user":"9c26c830-109a-103a-8f2b-4f22a77e4af7","app":"index","method":"POST","url":"/index.php/login/flow","message":{"Exception":"Doctrine\\DBAL\\Exception\\DriverException","Message":"An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1932 Table 'NC_v3b.oc_activity' doesn't exist in engine","Code":1932,"Trace":[{"file":"/var/www/nextcloud_21.0.0/3rdparty/doctrine/dbal/src/Connection.php","line":1728,"function":"convert","class":"Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter","type":"->"},{"file":"/var/www/nextcloud_21.0.0/3rdparty/doctrine/dbal/src/Connectio

Fun fact, both of the following tables exist in my NC database:

oc_activity
oc_activity_mq

Have you seen this:

Took a look at that one, but I’m not seeing a solution. Am I missing something?

I understood the problem in that way, that it isn’t a Nextcloud specific but a general database problem where a table cannot be accessed correctly. On Stackexchange different ways described how you can cope with that kind of problems on the database.

It seems unclear if it’s a database issue or a NC issue IMO. Did NC issue garbage data and the database recorded it correctly or did the database become corrupt?

Regardless, there doesn’t seem like a great solution is offered to fix it.

What about deleting a table? I also would be happy to turn off the black listing were that to fix the problem.

You were right, it was a corrupted table. The table was indeed there but trying to look at the table in question threw very telling errors:

MariaDB [(none)]> SELECT * FROM nextcloud.oc_activity;
ERROR 1030 (HY000): Got error 1877 "Unknown error 1877" from storage engine InnoDB

MariaDB [(none)]> SELECT COUNT(*) AS num_delete FROM nextcloud.oc_activity;
ERROR 1712 (HY000): Index oc_activity is corrupted

My solution was to delete the table (could not move it) as it was only a list of and recreate it with describe nextcloud.oc_activity; Actually, that didn’t work so I had to generate the command myself. In case anyone else needs to create this table (not unlikely as it’s easy to become a large table):

CREATE TABLE nextcloud.oc_activity (
`activity_id` bigint(20) NOT NULL AUTO_INCREMENT,
`timestamp` int(11) NOT NULL DEFAULT 0,
`priority` int(11) NOT NULL DEFAULT 0,
`type` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`user` varchar(64) COLLATE utf8mb4_bin NOT NULL,
`affecteduser` varchar(64) COLLATE utf8mb4_bin NOT NULL,
`app` varchar(32) NOT NULL COLLATE utf8mb4_bin NOT NULL,
`subject` varchar(255) NOT NULL COLLATE utf8mb4_bin NOT NULL,
`subjectparams` longtext COLLATE utf8mb4_bin DEFAULT NULL,
`message` varchar(255) NOT NULL COLLATE utf8mb4_bin NOT NULL,
`messageparams` longtext COLLATE utf8mb4_bin DEFAULT NULL,
`file` varchar(4000) NOT NULL COLLATE utf8mb4_bin NOT NULL,
`link` varchar(4000) NOT NULL COLLATE utf8mb4_bin NOT NULL,
`object_type` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
`object_id` bigint(20) NOT NULL DEFAULT 0,
PRIMARY KEY (`activity_id`),
KEY `affecteduser` (`affecteduser`),
KEY `object_type` (`object_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=COMPRESSED;
1 Like