Nextcloud stopped working, unable to open database file

Hi,

My Nextcloud stopped working, I can’t reach it via webbrowser.

My nextcloud runs on a raspberry pi 3 with an external usb drive. The config.php is:

<?php
$CONFIG = array (
  'instanceid' => 'xxxx',
  'passwordsalt' => 'xxxx',
  'secret' => 'xxxx',
  'trusted_domains' =>
  array (
    xxxx
  ),
  'datadirectory' => '/media/walter/nextcloud/data',
  'overwrite.cli.url' => 'xxxx',
  'dbtype' => 'sqlite3',
  'version' => '12.0.4.3',
  'installed' => true,
);

I am running php7 and apache2.

In /var/log/apache2/error.log if found this:

[Sun Mar 04 08:49:07.321923 2018] [:error] [pid 29053] [client 192.168.1.197:50186] PHP Fatal error:  Uncaught Doctrine\\DBAL\\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [14] unable to open database file in /var/www/html/nextcloud/lib/private/DB/Connection.php:61\nStack trace:\n#0 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(992): OC\\DB\\Connection->connect()\n#1 /var/www/html/nextcloud/lib/private/DB/Connection.php(213): Doctrine\\DBAL\\Connection->executeUpdate('PRAGMA read_unc...', Array, Array)\n#2 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): OC\\DB\\Connection->executeUpdate('PRAGMA read_unc...')\n#3 /var/www/html/nextcloud/lib/private/DB/Connection.php(148): Doctrine\\DBAL\\Connection->setTransactionIsolation(2)\n#4 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\\DB\\Connection->__construct(Array, Object(Doctrine\\DBAL\\Driver\\PDOSqlite\\Driver), Object(Doctrine\\DBAL\\Configuration), Object(Doctrine\\Common\\EventManager))\n#5 /var/www/html/nextcloud/lib in /var/www/html/nextcloud/lib/private/DB/Connection.php on line 61

I guess the permissions are ok, since I can connect to the database like this:
sudo -u www-data sqlite3 /media/pi/Walter/nextcloud/data/owncloud.db

Last action I did before it stopped workin: I logged in through the browser as admin and changed the password of another user. After committing the save i got http error 500 from then on.

Similiar topcis i found:

→ see above connection to database works as www-data

→ seems to be the exact same problem but without a solution

Please help. I am a noob user, so just reinstalling or migrating the db would be big steps for me.
Thanks!