Error updating metadata: attempt to write a readonly database

Nextcloud version (eg, 20.0.5): 27.0.0
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04.1
Linux version 5.15.0-75-generic (buildd@bos03-amd64-059) (gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #82-Ubuntu SMP Tue Jun 6 23:10:23 UTC 2023

Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.52 (Ubuntu)
PHP version (eg, 7.4): 8.1.2
Memory limit: 4.3 GB
Max execution time: 3600
Upload max size: 536.9 MB
Extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, Reflection, SPL, session, standard, sodium, apache2handler, dom, mysqlnd, PDO, xml, apcu, bcmath, bz2, calendar, ctype, curl, mbstring, FFI, fileinfo, ftp, gd, gettext, gmp, iconv, imagick, imap, intl, ldap, exif, mysqli, pdo_mysql, Phar, posix, readline, shmop, SimpleXML, soap, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlrpc, xmlwriter, xsl, zip, Zend OPcache

The issue you are facing:

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

Steps to replicate it:

  1. Create a file.

The output of your Nextcloud log in Admin > Logging:

https://pastebin.com/A9t1fi08

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

<?php
$CONFIG = array (
  'instanceid' => 'xxxxxxxx',
  'passwordsalt' => 'xxxxxxxxxxxxxxx',
  'secret' => 'xxxxxxxxxxxxxxxxxxxxxx',
  'trusted_domains' =>
  array (
    0 => 'nextcloud.moo.com',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '27.0.0.8',
  'overwrite.cli.url' => 'https://nextcloud.moo.com',
  'dbname' => 'nextclouddb',
  'dbhost' => 'localhost:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'xxxxxxxxxxxxxxxxx',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_smtphost' => 'xxxxxxxxxxxxxxxxx',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'xxxxxxxxxxxxx',
  'mail_domain' => 'moo.com',
  'mail_smtpport' => '465',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'moo@moo.com',
  'mail_smtppassword' => 'xxxxxxxxxxxxxxxxxxxx',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'default_phone_region' => 'US',
  'allow_local_remote_servers' => true,
  0 =>
  array (
    0 => 'quicknotes',
  ),
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
);

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

cat nextcloud.error.log
[Sat Jul 08 15:45:39.978236 2023] [access_compat:error] [pid 345788] [client 89.187.164.248:29838] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata
[Sat Jul 08 15:49:15.157072 2023] [access_compat:error] [pid 346046] [client 89.187.164.248:35339] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata
[Sat Jul 08 16:04:41.831673 2023] [access_compat:error] [pid 345788] [client 89.187.164.248:60430] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata

cat nextcloud.error.log
[Sat Jul 08 15:45:39.978236 2023] [access_compat:error] [pid 345788] [client 89.187.164.248:29838] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata
[Sat Jul 08 15:49:15.157072 2023] [access_compat:error] [pid 346046] [client 89.187.164.248:35339] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata
[Sat Jul 08 16:04:41.831673 2023] [access_compat:error] [pid 345788] [client 89.187.164.248:60430] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata
hernan@mail:/var/log/apache2$ cat error.log
PHP Warning:  PHP Startup: Unable to load dynamic library 'mysqli.so' (tried: /usr/lib/php/20210902/mysqli.so (/usr/lib/php/20210902/mysqli.so: undefined symbol: mysqlnd_global_stats), /usr/lib/php/20210902/mysqli.so.so (/usr/lib/php/20210902/mysqli.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  Module "dom" is already loaded in Unknown on line 0
[Sat Jul 08 00:00:03.110542 2023] [mpm_prefork:notice] [pid 31674] AH00163: Apache/2.4.52 (Ubuntu) OpenSSL/3.0.2 configured -- resuming normal operations
[Sat Jul 08 00:00:03.110574 2023] [core:notice] [pid 31674] AH00094: Command line: '/usr/sbin/apache2'
[Sat Jul 08 15:09:41.710688 2023] [core:error] [pid 345591] [client 185.180.143.49:52372] AH10244: invalid URI path (/dana-na/../dana/html5acc/guacamole/../../../../../../../etc/services?/dana/html5acc/guacamole/)

Extension mysqli is missing.

Since you are on an old Ubuntu: What are your php sources?

Extension mysqli is missing.

if I do: sudo apt-get install php-mysql
I get php-mysql is already the newest version (2:8.1+92ubuntu1)..

Then i looked in /etc/php/8.1/apache2/php.ini.
The following extensions are enabled:
extension=dom.so extension=mysqli.so

Since you are on an old Ubuntu: What are your php sources?

I’m using the LTS latest version of Ubuntu server. I was hoping to minimize upgrading.

I’m new to Linux so I don’t really know what you mean by php sources. I recall installing it using sudo apt install php, or something like that.

Thanks for your help.

It’s a mystery to me too, but the mysqli module is definitely not found according to the log-echoes.
Did you try:

sudo apt-get install --reinstall php8.1-mysql

O yes I see, excuse me, I had read 20.04, but that was from the template, my fault, sorry :wink:

sudo apt-get install --reinstall php8.1-mysql

Will this be destructive to the database? The website is being used actively with documents.

No, not at all.

So if the site is otherwise working normally, then the error will probably be somewhere else anyway.