[SOLVED] Nextcloud can’t login – Internal Server Error

In this short guide I would like to help you if you are in the same frustrating situation as me. In particular I spent a lot of time trying to understand what was going wrong on my Nextcloud installation and now I want to give you (I hope) a solution.

The situation we want to solve is the following one: you were successfully running a Nextcloud installation with a Sqlite database (maybe you should upgrade to a MariaDB with InnoDB if possible…) but now you cannot login.

At the moment, your login page looks like this one:

The first thing to do is to backup the nextcloud.log file that you can find in the /data directory. Then, to understand better what’s going on, delete the log file and try again to login: a new and easy-to-read log file will be created. Open and inspect it if you can find some useful information.

Usually the error are misconfigurations in the /config/config.php file in particular if you have just finished the installation.

In my case the problem was about the Sqlite database.

First thing to do is to backup the database /data/owncloud.db .

Second step is to import the database into a Sqlite browser. If you found something interesting in the log file previously, you can now browse the db and find out the problem. Alternatively follow the next step.

What happens if you try to edit or delete a record of the database? In my case, the log was saying “General error: 11 database disk image is malformed” and in fact the Sqlite browser didn’t allow me to remove or edit any record of the db.

What’s happened so? Nextcloud autonomously broke the indices of the db getting it absolutely unusable. So how to fix a broken db image?

At the end I found a solution running the following command on Ubuntu:

$ sqlite3 broken.db ".dump" | sqlite3 owncloud.db

and replacing the broken db with the dumped new one.

You can find out more about broken Sqlite db at this link.

I hope I helped you


This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

2 thoughts on “[SOLVED] Nextcloud can’t login – Internal Server Error”

  1. Hello Edoardo!
    How are you?

    I have the same issue about nextcloud 21 on OpenSUSE 15.2 15.3 with nginx, postgresql and php-fpm. After first login, its shows the same error screen.

    Please, can you tell me what the commad I use with postgresql from this case?

    I am trying to install Nextcloud about 2 months and ever same problem.

    Thank you for attention


    1. Hi Douglas and thank you very much for your comment 🙂

      What about the logs? The causes (and solutions) may be very different depending on the error. First of all, try to understand what’s inside the logs. Anyway, a fresh installation must work without any problem if the os requirements and the libraries/dependencies are satisfied.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.