Cannot start nextcloud - nothing written to logfile

Nextcloud version (eg, 20.0.5): 27.0.0
Operating system and version (eg, Ubuntu 20.04): Synology DSM 7.2 - Docker
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.56
PHP version (eg, 7.4): 8.2.7

The issue you are facing:

Can’t see web interface. Instead I see

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

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

Steps to replicate it:

  1. Start nextcloud docker container
  2. Visit web interrface

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

<?php
$CONFIG = array (
  'filesystem_check_change' => 1,
  'instanceid' => '***',
  'passwordsalt' => '***',
  'secret' => '***+',
  'trusted_domains' => 
  array (
    0 => 'cloud.defariahome.com',
    1 => 'defaria.synology.me',
    2 => 'jupiter',
    3 => '192.168.86.31',
  ),
  'default_phone_region' => 'US',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '25.0.0.18',
  'overwrite.cli.url' => 'https://cloud.defariahome.com',
  'overwritehost' => 'cloud.defariahome.com',
  'overwriteprotocol' => 'https',
  'dbname' => 'nextcloud',
  'dbhost' => '192.168.86.31',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '***',
  'installed' => true,
  'mail_from_address' => '***',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'DeFaria.com',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'defaria.com',
  'mail_smtpport' => '465',
  'mail_smtpname' => 'andrew',
  'mail_smtppassword' => '***',
  'maintenance' => false,
  'enable_previews' => true,
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\Movie',
    1 => 'OC\\Preview\\PNG',
    2 => 'OC\\Preview\\JPEG',
    3 => 'OC\\Preview\\GIF',
    4 => 'OC\\Preview\\BMP',
    5 => 'OC\\Preview\\XBitmap',
    6 => 'OC\\Preview\\MP3',
    7 => 'OC\\Preview\\MP4',
    8 => 'OC\\Preview\\TXT',
    9 => 'OC\\Preview\\MarkDown',
    10 => 'OC\\Preview\\PDF',
    11 => 'OC\\Preview\\SVG',
  ),
  'theme' => '',
  'log_type' => 'file',
  'logfile' => '/var/www/html/data/nextcloud.log',
  'loglevel' => 1,
  'logdataformat' => 'F d, Y H:i:s',
  'debug' => true,
  'mail_smtpsecure' => 'ssl',
  'app_install_overwrite' => 
  array (
    0 => 'files_markdown',
    1 => 'impersonate',
  ),
  'updater.secret' => '***',
);

The problem is that nothing gets written to nextcloud.log so i cannot debug further. Since I’m running a Docker container I cannot dump the logs, except to use docker logs nextcloud:

Jupiter:docker logs nextcloud
Initializing nextcloud 27.0.0.8 ...
New nextcloud instance
Initializing finished
=> Searching for scripts (*.sh) to run, located in the folder: /docker-entrypoint-hooks.d/before-starting
==> but the hook folder "before-starting" is empty, so nothing to do
[Sun Jul 02 19:40:00.530294 2023] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.56 (Debian) PHP/8.2.7 configured -- resuming normal operations
[Sun Jul 02 19:40:00.530367 2023] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
172.18.0.1 - - [02/Jul/2023:19:40:18 +0000] "GET /remote.php/webdav/ HTTP/1.1" 500 701 "-" "-"
172.18.0.1 - - [02/Jul/2023:19:40:19 +0000] "GET /remote.php/webdav/ HTTP/1.1" 500 701 "-" "-"
172.18.0.1 - - [02/Jul/2023:19:40:36 +0000] "GET / HTTP/1.1" 500 701 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
172.18.0.1 - - [02/Jul/2023:19:41:50 +0000] "GET /index.php/apps/theming/icon?v=5 HTTP/1.1" 500 701 "https://help.nextcloud.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
172.18.0.1 - - [02/Jul/2023:19:41:50 +0000] "GET /index.php/apps/theming/favicon?v=5 HTTP/1.1" 500 701 "https://help.nextcloud.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
Jupiter:

I checked to ensure that nothing is being written to the logfile thusly:

Jupiter:grep logfile /docker/nextcloud/config.php 
  'logfile' => '/var/www/html/data/nextcloud.log',
Jupiter:docker exec -it nextcloud ls -l /var/www/html/data/nextcloud.log
-rw-rw-rw- 1 www-data www-data 0 Jul  2 19:02 /var/www/html/data/nextcloud.log
Jupiter:

Is this an upgrade or a new installation?

Can you post your Docker Compose file? (redact passwords/etc)

Oh… wait! Your config says you’re running NC25. You definitely can’t be running nor upgrade directly to NC27.

What was going on when this problem first cropped up? Were you attempting an upgrade?

I installed NC before. Then, for unknown reasons, I was not able to log in again as my user. Well, I could log in but the reverse proxy would mess up after logging in and it would display a “that didn’t work” kind of web page. I created an admin user, which I could log into and then impersonate my regular user. Eventually, I decided to recreate the NC instance and reinstalled it. Remember I’m on Synology and NC is running in a container. After reinstalling and moving all the files I had before into place (and running a complete file scan) everything was back and working for a few months.

Then Synology updated DSM to 7.2. I was excited about this because it included a new Container Manager that was supposed to help keep your Docker images up to date. After the DSM 7.2 upgrade however, it said that several of my Docker images were out of date which was strange because many of my Docker containers squawk when they sense an update is available and yet none of them mentioned an update. So I clicked on the Update available button in the new Container Manager and it updated the image but the Docker containers did not work! Looking into this I had to recreate the containers by hand. Seems it wanted to add some new syntax to the container definition. You see Synology has an “export” feature that exports a JSON file with your container settings. This can be later imported in to recreate the container. I’m not using Docker compose. I had to re-create my Docker containers by hand and had did so for all of my containers that needed updating. However I have not been able to run the NextCloud container and as I said, nothing is output to the log file.

I know the config file says 25 but in updating my NextCloud Docker image I’m pretty sure I have 27 now. If I start the docker container I cannot get into the web UI but I can do a docker exec -it nextcloud bash and if I cat the version.php it says it’s 27.

Are you saying I cannot upgrade from 25 → 27? How can I solve this? docker pull nextcloud:25 and see if I can get in? How then to get to the latest? docker pull nextcloud:26 followed by a 27 pull?

Another thing that may be the problem is that I also had MariaDB in a docker container and that one would not update nicely. I could not simply re-import from my export file and have it come up. I had to remove the container and image and re-pull the MariaDB image. Somewhere around there I’m afraid my nextcloud database disappeared! I was able to to docker exec -it mariadb mariadb and did a create database nextcloud; but I’m not sure how to initialize it.

I’ve tried for hours to get NC to initialize mariadb. Got a lot of errors. Seems clear to me that even if I get the DB reinitialized it will not know of any of the users or customizations I had before right? I did manage to get it up using sqllite. I’m gonna try a scan of the files to see if that at least finds the files I currently have.

I managed to get NC reset such that when I go to the web page it’s in installation mode - SOLVED - How to reset / reinitialize nextcloud - NC-17. I tried many times to get it to use MariaDB and all I got was various different errors. So I decided to default to SQLite and created an admin user. I then tried to create my normal user (andrew) and it said there were already files for andrew. So I moved <nextcloud>/andrew aside and created the andrew user then put <nextcloud>/andrew back into place. Next, I ran an occ scan and it found all my old files. Great.

But I’d like to be using MariaDB instead of SQLite (though my usage is small). So I tried to convert the SQLite to MariaDB as described Converting database type — Nextcloud latest Administration Manual latest documentation. I’ve tried it with an empty database (create database nextcloud), with a nextcloud user 'create user nextcloud@localhost identified by '****' and grant all privileges on nextcloud.* to nextcloud@localhost identified by '****') as well as without the nextcloud database or nextcloud user.

With password protected by an envvar here’s what I get when I try it with an empty nextcloud database and a nextcould user:

Jupiter:docker exec -itu www-data nextcloud php occ db:convert-type --password $password -- mysql nextcloud 127.0.0.1 nextcloud
Creating schema in new database

In Connection.php line 140:
                                                                               
  Failed to connect to the database: An exception occurred in the driver: SQL  
  STATE[HY000] [2002] Connection refused                                       
                                                                               

db:convert-type [--port PORT] [--password PASSWORD] [--clear-schema] [--all-apps] [--chunk-size CHUNK-SIZE] [--] <type> <username> <hostname> <database>

Jupiter:

I don’t know why I’m getting connection refused. My MariaDB is running in it’s own container and I can verify that the nextcloud user with the $password can access the database. Using the same username password I can show databases:

Jupiter:docker exec -it mariadb mariadb -unextcloud -p$password -e "show databases"
+--------------------+
| Database           |
+--------------------+
| information_schema |
| nextcloud          |
+--------------------+
Jupiter: