Owncloud seems to ignore dbtype in config.php (using docker)

Hello,
I’m an Owncloud newbie and would like to deploy a containerized version of Owncloud on my NAS (QNAP) as a private alternative to Dropbox.
I can run a docker container of Owncloud without any problem using the default sqlite database: I access the GUI, create the admin user, browse the file structure, etc.
But I’d like to switch to Mysql and I was so far unable to do as Owncloud “seems” to ignore the settings in config.php.

I created a MySQL instance (MariaDB) in a separate container and added an empty owncloud-reserved database to it: I checked that from the Owncloud container I can successfully login into the MySQL’s via the command line, so the database is reachable.

Following some instructions I found online I edited file config.php and changed field “installed” in variable $CONFIG from “true” to “false”: this triggers the db configuration wizard upon login.
In the wizard I select “MySQL” and await the completion of the setup procedure.
When it’s done I checked that:

  1. Owncloud tables have been created in the MariaDB database (the db was empty before runnig the wizard)
  2. The config.php file has been modified and now I see all mysql db settings, particulary:
    'dbtype' => 'mysql', (the file showed before the sqlite settings)

Despite the above, if I go to the Settings page of my admin user, under General I still see the red warning: “SQLite is used as database…etc”.
For testing, I added a new user and indeed the data are still stored in the sqlite file rather than MySQL

So my conclusion is that Owncloud is ignoring config.php in my setup.

Things I tried to no avail:

  1. Recreating the Owncloud container multiple times
  2. Restart the container after the database change

What am I missing?
Thanks in advance
Regards

Steps to reproduce

  1. Trigger the database setup wizard by changing “installed” from “true” to “false” in config.php
  2. Run the db setup wizard
  3. Check that OC tables have been created in the new MYSQL database
  4. Go into Settings/General as Admin user
  5. The “SQLite is used as database” message is still displayed

Expected behaviour

Owncloud should use the new MySQL database and not display the warning message

Actual behaviour

Owncloud is still using the default sqlite database, apparently ignoring config.php

Server configuration

Operating system:
Linux

Web server:
apache

Database:
MySQL (MariaDB)

PHP version:
7.4.3

ownCloud version: (see ownCloud admin page)
10.6.0 (owncloud/server image on Docker Hub)

Updated from an older ownCloud or fresh install:
Fresh install

Where did you install ownCloud from:
Docker Hub

Signing status (ownCloud 9.0 and above):

Login as admin user into your ownCloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results into https://gist.github.com/ and puth the link here.

The content of config/config.php:

(sensitive information has been redacted)

$CONFIG = array (
‘apps_paths’ =>
array (
0 =>
array (
‘path’ => ‘/var/www/owncloud/apps’,
‘url’ => ‘/apps’,
‘writable’ => false,
),
1 =>
array (
‘path’ => ‘/var/www/owncloud/custom’,
‘url’ => ‘/custom’,
‘writable’ => true,
),
),
‘trusted_domains’ =>
array (
0 => ‘192...:’,
),
‘datadirectory’ => ‘/mnt/data/files’,
‘dbtype’ => ‘mysql’,
‘dbhost’ => '
.
.
.*’,
‘dbname’ => ‘REDACTED’,
‘dbuser’ => ‘REDACTED’
‘dbpassword’ => ‘REDACTED’
‘dbtableprefix’ => ‘oc_’,
‘log_type’ => ‘owncloud’,
‘supportedDatabases’ =>
array (
0 => ‘sqlite’,
1 => ‘mysql’,
2 => ‘pgsql’,
),
‘upgrade.disable-web’ => true,
‘default_language’ => ‘en’,
‘overwrite.cli.url’ => ‘REDACTED’,
‘htaccess.RewriteBase’ => ‘/’,
‘logfile’ => ‘/mnt/data/files/owncloud.log’,
‘loglevel’ => 2,
‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘filesystem_cache_readonly’ => false,
‘filelocking.enabled’ => true,
‘passwordsalt’ => ‘REDACTED’,
‘secret’ => ‘REDACTED’,
‘version’ => ‘10.6.0.5’,
‘logtimezone’ => ‘UTC’,
‘installed’ => true,
‘instanceid’ => ‘REDACTED’,
‘mysql.utf8mb4’ => true,
);

Log in to the web-UI with an administrator account and click on
'admin' -> 'Generate Config Report' -> 'Download ownCloud config report'
This report includes the config.php settings, the list of activated apps
and other details in a well sanitized form.

or 

If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your ownCloud installation folder

I get an error message;
    An unhandled exception has been thrown:
    OC\DatabaseException: Invalid database type in /var/www/owncloud/lib/private/Server.php:533
   

**Are you using external storage, if yes which one:** local/smb/sftp/...

**Are you using encryption:** yes/no
No

**Are you using an external user-backend, if yes which one:** LDAP/ActiveDirectory/Webdav/...


With access to your command line run e.g.:
sudo -u www-data php occ ldap:show-config
from within your ownCloud installation folder

Without access to your command line download the data/owncloud.db to your local
computer or access your SQL server remotely and run the select query:
SELECT * FROM oc_appconfig WHERE appid = ‘user_ldap’;

Eventually replace sensitive data as the name/IP-address of your LDAP server or groups.


### Client configuration
**Browser:**
Firefox 84

**Operating system:**
Linux

..

I would try to make sqlite unavailable before installing, and/or remove any existing sqlite-db files.

1 Like

Hi Alfred,
I did not remove any sqlite-db files (as far as I am aware) and what do you mean exactly by “making sqlite unavailable”?

Thanks
Regards
S.

I just generated the Config Report and in the database section I still see:

    "dbtype": "sqlite",

    "dbhost": "",

    "dbname": "owncloud",

    "dbuser": "***REMOVED SENSITIVE VALUE***",

    "dbpassword": "***REMOVED SENSITIVE VALUE***",

    "dbtableprefix": "oc_",

    "log_type": "owncloud",

    "supportedDatabases": [

        "sqlite",

        "mysql",

        "pgsql"

    ]...

So evidently ownCloud is ignoring the config.php file.
The plot thickens…

Hello,
I fixed it.
I just had to add a few more environmental variables with the appropriate values to the container, namely:
OWNCLOUD_DB_TYPE
OWNCLOUD_DB_HOST
OWNCLOUD_DB_NAME
OWNCLOUD_DB_USERNAME
OWNCLOUD_DB_PASSWORD

Hope this helps someone else.
Thanks
S.

2 Likes

Where did you add those values?