Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exception occurred while executing 'PRAGMA journal_mode = WAL' #25663

Closed
TrapperPhD opened this issue Jul 31, 2016 · 6 comments
Closed

exception occurred while executing 'PRAGMA journal_mode = WAL' #25663

TrapperPhD opened this issue Jul 31, 2016 · 6 comments

Comments

@TrapperPhD
Copy link

TrapperPhD commented Jul 31, 2016

Dear all,

This is the follow-up of #25590.

Steps to reproduce

  1. There had been an automatic update via http://download.opensuse.org/repositories/isv:/ownCloud:/community/xUbuntu_14.04/ .
  2. In the same run of Ubuntu upgrade with the automatic owncloud update also mysql and php might have been updated.
  3. I do not think that the database has been corrupted, as I get the same failure scenario with owncloud.db backups which had been saved one month earlier (when owncloud was running fine). But somehow the connection between OC and the database could be lost.
  4. I checked /etc/php/php5.6/mods-available/pdo_sqlite.ini and sqlite3.ini, and both point to valid copies of their corresponding .so-files. Also, both are linked/activated in apache2/conf.d.

Expected behaviour

OC starting and accessing its database.

Actual behaviour

  1. OC wants to update himself without me having initiated an update. Update fails with error message:

    Interner Serverfehler

    Der Server hat einen internen Fehler und konnte Ihre Anfrage nicht vervollständigen.

    Bitte wende Dich an den Serveradministrator, sollte dieser Fehler mehrfach auftreten, und füge Deiner Anfrage die unten stehenden technischen Details bei.

    Weitere Details können im Serverprotokoll gefunden werden.

    Technische Details

    Entfernte Adresse: 192.168.1.22
    Anforderungskennung: 6RVAhYb8UueVP44tC2A8
    Typ: Doctrine\DBAL\DBALException
    Code: 0
    Nachricht: Failed to connect to the database: An exception occurred while executing 'PRAGMA journal_mode = WAL': SQLSTATE[HY000]: General error: 11 database disk image is malformed
    Datei: /var/www/owncloud2/lib/private/db/connection.php
    Zeile: 50
    

    Spur

    0 /var/www/owncloud2/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(973): OC\DB\Connection->connect()

    1 /var/www/owncloud2/lib/private/db/connection.php(151): Doctrine\DBAL\Connection->executeUpdate('PRAGMA read_unc...', Array, Array)

    2 /var/www/owncloud2/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(621): OC\DB\Connection->executeUpdate('PRAGMA read_unc...')

    3 /var/www/owncloud2/lib/private/db/connection.php(83): Doctrine\DBAL\Connection->setTransactionIsolation(2)

    4 /var/www/owncloud2/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))

    5 /var/www/owncloud2/lib/private/db/connectionfactory.php(124): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))

    6 /var/www/owncloud2/lib/private/server.php(302): OC\DB\ConnectionFactory->getConnection('sqlite3', Array)

    7 /var/www/owncloud2/3rdparty/pimple/pimple/src/Pimple/Container.php(112): OC\Server->OC{closure}(Object(OC\Server))

    8 /var/www/owncloud2/lib/private/appframework/utility/simplecontainer.php(96): Pimple\Container->offsetGet('DatabaseConnect...')

    9 /var/www/owncloud2/lib/private/server.php(697): OC\AppFramework\Utility\SimpleContainer->query('DatabaseConnect...')

    10 /var/www/owncloud2/lib/private/db.php(42): OC\Server->getDatabaseConnection()

    11 /var/www/owncloud2/lib/private/server.php(209): OC_DB::getConnection()

    12 /var/www/owncloud2/3rdparty/pimple/pimple/src/Pimple/Container.php(112): OC\Server->OC{closure}(Object(OC\Server))

    13 /var/www/owncloud2/lib/private/appframework/utility/simplecontainer.php(96): Pimple\Container->offsetGet('AppConfig')

    14 /var/www/owncloud2/lib/private/server.php(643): OC\AppFramework\Utility\SimpleContainer->query('AppConfig')

    15 /var/www/owncloud2/lib/private/server.php(344): OC\Server->getAppConfig()

    16 /var/www/owncloud2/3rdparty/pimple/pimple/src/Pimple/Container.php(112): OC\Server->OC{closure}(Object(OC\Server))

    17 /var/www/owncloud2/lib/private/appframework/utility/simplecontainer.php(96): Pimple\Container->offsetGet('AppManager')

    18 /var/www/owncloud2/lib/private/server.php(863): OC\AppFramework\Utility\SimpleContainer->query('AppManager')

    19 /var/www/owncloud2/lib/private/app.php(238): OC\Server->getAppManager()

    20 /var/www/owncloud2/lib/private/app.php(93): OC_App::getEnabledApps()

    21 /var/www/owncloud2/lib/base.php(592): OC_App::loadApps(Array)

    22 /var/www/owncloud2/lib/base.php(1125): OC::init()

    23 /var/www/owncloud2/index.php(46): require_once('/var/www/ownclo...')

    24 {main}

  2. OC cannot access its database, e.g. occ -V gives ...

    An unhandled exception has been thrown:
    exception 'Doctrine\DBAL\DBALException' with message 'Failed to connect to the database: An exception occurred while executing 'PRAGMA journal_mode = WAL':
    SQLSTATE[HY000]: General error: 11 database disk image is malformed' in /var/www/owncloud2/lib/private/db/connection.php:50
    Stack trace:
    #0 /var/www/owncloud2/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(973): OC\DB\Connection->connect()
    #1 /var/www/owncloud2/lib/private/db/connection.php(151): Doctrine\DBAL\Connection->executeUpdate('PRAGMA read_unc...', Array, Array)
    #2 /var/www/owncloud2/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(621): OC\DB\Connection->executeUpdate('PRAGMA read_unc...')
    #3 /var/www/owncloud2/lib/private/db/connection.php(83): Doctrine\DBAL\Connection->setTransactionIsolation(2)
    #4 /var/www/owncloud2/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))
    #5 /var/www/owncloud2/lib/private/db/connectionfactory.php(124): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
    #6 /var/www/owncloud2/lib/private/server.php(302): OC\DB\ConnectionFactory->getConnection('sqlite3', Array)
    #7 /var/www/owncloud2/3rdparty/pimple/pimple/src/Pimple/Container.php(112): OC\Server->OC{closure}(Object(OC\Server))
    #8 /var/www/owncloud2/lib/private/appframework/utility/simplecontainer.php(96): Pimple\Container->offsetGet('DatabaseConnect...')
    #9 /var/www/owncloud2/lib/private/server.php(697): OC\AppFramework\Utility\SimpleContainer->query('DatabaseConnect...')
    #10 /var/www/owncloud2/lib/private/db.php(42): OC\Server->getDatabaseConnection()
    #11 /var/www/owncloud2/lib/private/server.php(209): OC_DB::getConnection()
    #12 /var/www/owncloud2/3rdparty/pimple/pimple/src/Pimple/Container.php(112): OC\Server->OC{closure}(Object(OC\Server))
    #13 /var/www/owncloud2/lib/private/appframework/utility/simplecontainer.php(96): Pimple\Container->offsetGet('AppConfig')
    #14 /var/www/owncloud2/lib/private/server.php(643): OC\AppFramework\Utility\SimpleContainer->query('AppConfig')
    #15 /var/www/owncloud2/lib/private/server.php(344): OC\Server->getAppConfig()
    #16 /var/www/owncloud2/3rdparty/pimple/pimple/src/Pimple/Container.php(112): OC\Server->OC{closure}(Object(OC\Server))
    #17 /var/www/owncloud2/lib/private/appframework/utility/simplecontainer.php(96): Pimple\Container->offsetGet('AppManager')
    #18 /var/www/owncloud2/lib/private/server.php(863): OC\AppFramework\Utility\SimpleContainer->query('AppManager')
    #19 /var/www/owncloud2/lib/private/app.php(238): OC\Server->getAppManager()
    #20 /var/www/owncloud2/lib/private/app.php(93): OC_App::getEnabledApps()
    #21 /var/www/owncloud2/lib/base.php(592): OC_App::loadApps(Array)
    #22 /var/www/owncloud2/lib/base.php(1125): OC::init()
    

    Update apps/files/css/files.css #23 /var/www/owncloud2/console.php(41): require_once('/var/www/ownclo...')
    A suggestion for simple, yet efficient variable interpolation in js translations #24 /var/www/owncloud2/occ(11): require_once('/var/www/ownclo...')

SQLite3 query gives ...

sudo -u www-data sqlite3 /var/www/owncloud2/owncloud.db
SQLite version 3.8.2 2013-12-06 14:53:30
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .databases
seq name file

0 main /var/www/owncloud2/owncloud.db
sqlite>

Server configuration

Operating system: Ubuntu 14.04.1
Web server: apache2
Database: Mysql 5.5.50, SQLite 3.8.2
PHP version: 5.6
ownCloud version: 8.1.6
Updated from an older ownCloud or fresh install: continuously updated since v6 via SUSE repos http://download.opensuse.org/repositories/isv:/ownCloud:/community/xUbuntu_14.04/

The content of config/config.php:

'oc3a41047555', 'passwordsalt' => '*** removed for security reasons', 'datadirectory' => '/var/www/owncloud/data', 'dbtype' => 'sqlite3', 'dbname' => 'ownclouddb', 'dbhost' => 'localhost', 'version' => '8.1.6.2', 'installed' => true, 'forcessl' => true, 'theme' => '', 'maintenance' => false, 'trusted_domains' => array ( 0 => '192.168.1.24', 1 => 'localhost', 2 => 'home.mydomain.de', ), 'forceSSLforSubdomains' => true, 'appcodechecker' => false, 'xframe_restriction' => false, 'cache_path' => '', 'quota_include_external_storage' => false, 'filesystem_check_changes' => 0, 'appstore.experimental.enabled' => false, 'updatechecker' => false, );

php -m

[PHP Modules]
apc
apcu
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
igbinary
imap
intl
json
ldap
libsmbclient
libxml
mbstring
mcrypt
memcache
memcached
mhash
msgpack
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
pspell
readline
Reflection
session
shmop
SimpleXML
smbclient
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
wddx
xdebug
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Xdebug
Zend OPcache

Are you using external storage, if yes which one: Yes. Webdav and SMB.

Are you using encryption: Yes

Are you using an external user-backend, if yes which one: No.

ownCloud log (data/owncloud.log)

"reqId":"cEUEF/se7gNzvxRzJsoP","remoteAddr":"212.27.185.253","app":"index","message":"Exception: {"Exception":"Doctrine$
"reqId":"vjQFGf15JZlPq+dVD1yT","remoteAddr":"212.27.185.253","app":"index","message":"Exception: {"Exception":"Doctrine$
{"reqId":"SithAJT107BsSi3u6wRH","remoteAddr":"192.168.1.22","app":"index","message":"Exception: {"Exception":"Doctrine\$

Best regards

Christian

@DeepDiver1975
Copy link
Member

SQLSTATE[HY000]: General error: 11 database disk image is malformed' in /var/www/owncloud2/lib/private/db/connection.php:50

Looks like the database file is corrupted .... not much we can do I fear ...

@TrapperPhD
Copy link
Author

But ...
why are all backups going back 2-3 months also corrupted (after restoring them)? Coming from times, when OC and database were running fine?

Best
Chris

@DeepDiver1975
Copy link
Member

@TrapperPhD
Copy link
Author

TrapperPhD commented Aug 1, 2016

Yes, thanks, for 3 weeks now am gooling and getting more and more crazy ...
and I think I found and checked all of them. But none really fit.

What also drives me thinking beyond the DB is that restoring a complete OC installation from late April (incl. database and everything), which was working perfectly fine at that time, also gives the error today. And I am confused that some failing OC commands do not really leave any trace in owncloud.log.

But thanks for caring!
Best
Chris

@TrapperPhD
Copy link
Author

OK, done, issue can be closed. I was able to restore a database update from a time point where it was already compatible with 8.1.x and not yet corrupted. It is such a pleasure having tons of backups available. ;-)

Upgrade ran through, OC is up and running, next step will be conversion of database to MySQL.

Thank you for your time and attention ... helped me to get back on track again.

Best
Chris

@lock
Copy link

lock bot commented Aug 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants