-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Upgrade from 10.0.3 to 11.0.1 fails with database error #3242
Comments
Do you by any chance know what went on during the upgrade? Was there high IO load? If you have a bigger instance we highly recommend to switch to MySQL, because SQLite locks down the whole file and doesn't allow concurrent access to the database. During update we usually only run exactly one connection to the database. So there shouldn't be any other conenction (that locks the database) possible. Maybe you tried to open the database manually during the update. Could this be the case? |
The instance was not online during the upgrade process. I copied data and config/config.php into a fresh installation which was not reachable from users. I started the upgrade using occ from there.
I'd love too, see Issue #173.
I tried the upgrade several times with the last few tries being isolated from any user requests.
No |
I then have no idea why the DB should be locked -.- |
I have the exact same issue upgrading from 10.0.4 to 11.0.2. System is debian jessie also with sqlite. It's a very small installation with just one user (besides the admin account). |
Without further details we sadly can't do much here. Just retry and check if you can find more information why it was locked at all. I will close this for now and we will reopen if more details are available. |
I ran into the same issue. After some investigation, it seems that the upgrade routine tries to connect (in case of SQLite, this means opening the file) two times during the procedure. This is relatively easy to verify by printing a single line to the console output when the DB connect() function is called (ie within the Although the second connect() will succeed, the next SQL command will fail and report the above After some tracing it seems that the first connection is made at the /**
* @param \Doctrine\DBAL\Schema\Schema|\Doctrine\DBAL\Schema\SchemaDiff $schema
* @return bool
*/
private function executeSchemaChange($schema) {
$this->conn->beginTransaction();
foreach ($schema->toSql($this->conn->getDatabasePlatform()) as $sql) {
$this->conn->query($sql);
}
$this->conn->commit();
if ($this->conn->getDatabasePlatform() instanceof SqlitePlatform) {
// Commenting out the following 2 lines
/*$this->conn->close();
$this->conn->connect();*/
}
return true;
} This change let the script move on and successfully perform the update. But I am sure this is not the proper way to fix the problem anyway. |
Thanks a lot! This worked for me! |
Just had to do this today ugrading from 12 to 13. |
Steps to reproduce
Expected behaviour
The upgrade should work
Actual behaviour
The upgrade fails during database migration step with the following error message:
Server configuration
Operating system: Arch Linux
Web server: Nginx
Database: sqlite
PHP version: PHP 7.0.14 (cli) (built: Dec 7 2016 17:11:27) ( NTS )
Nextcloud version: 11.0.1
Updated from an older Nextcloud/ownCloud or fresh install: update from 10.0.3
Where did you install Nextcloud from: cli
List of activated apps:
Apps
The content of config/config.php:
Config report
Are you using external storage, if yes which one: no
Are you using encryption: no
Are you using an external user-backend, if yes which one: no
Client configuration
Browser: Firefox
Operating system: Linux
Logs
Nextcloud log (data/nextcloud.log)
Nextcloud log
``` {"reqId":"t8JUKlmOeQFHjHg2Y\/gW","remoteAddr":"","app":"core","message":"Exception: {\"Exception\":\"Doctrine\\\\DBAL\\\\Exception\\\\DriverException\",\"Message\":\"An exception occurred while executing 'INSERT INTO \\\"oc_appconfig\\\" (\\\"appid\\\",\\\"configkey\\\",\\\"configvalue\\\") SELECT ?,?,? WHERE NOT EXISTS (SELECT 1 FROM \\\"oc_appconfig\\\" WHERE \\\"appid\\\" = ? AND \\\"configkey\\\" = ?)' with params [\\\"twofactor_backupcodes\\\", \\\"installed_version\\\", \\\"1.0.0\\\", \\\"twofactor_backupcodes\\\", \\\"installed_version\\\"]:\\n\\nSQLSTATE[HY000]: General error: 5 database is locked\",\"Code\":0,\"Trace\":\"#0 \\\/path\\\/http\\\/nextcloud\\\/testing-only\\\/nextcloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/DBALException.php(128): Doctrine\\\\DBAL\\\\Driver\\\\AbstractSQLiteDriver->convertException('An exception oc...', Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException))\\n#1 \\\/path\\\/http\\\/nextcloud\\\/testing-only\\\/nextcloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.php(996): Doctrine\\\\DBAL\\\\DBALException::driverExceptionDuringQuery(Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOSqlite\\\\Driver), Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException), 'INSERT INTO \\\"oc...', Array)\\n#2 \\\/path\\\/http\\\/nextcloud\\\/testing-only\\\/nextcloud\\\/lib\\\/private\\\/DB\\\/Connection.php(215): Doctrine\\\\DBAL\\\\Connection->executeUpdate('INSERT INTO \\\"oc...', Array, Array)\\n#3 \\\/path\\\/http\\\/nextcloud\\\/testing-only\\\/nextcloud\\\/lib\\\/private\\\/DB\\\/AdapterSqlite.php(86): OC\\\\DB\\\\Connection->executeUpdate('INSERT INTO \\\"oc...', Array)\\n#4 \\\/path\\\/http\\\/nextcloud\\\/testing-only\\\/nextcloud\\\/lib\\\/private\\\/DB\\\/Connection.php(253): OC\\\\DB\\\\AdapterSqlite->insertIfNotExist('*PREFIX*appconf...', Array, Array)\\n#5 \\\/path\\\/http\\\/nextcloud\\\/testing-only\\\/nextcloud\\\/lib\\\/private\\\/AppConfig.php(157): OC\\\\DB\\\\Connection->insertIfNotExist('*PREFIX*appconf...', Array, Array)\\n#6 \\\/path\\\/http\\\/nextcloud\\\/testing-only\\\/nextcloud\\\/lib\\\/private\\\/AllConfig.php(164): OC\\\\AppConfig->setValue('twofactor_backu...', 'installed_versi...', '1.0.0')\\n#7 \\\/path\\\/http\\\/nextcloud\\\/testing-only\\\/nextcloud\\\/lib\\\/private\\\/Installer.php(503): OC\\\\AllConfig->setAppValue('twofactor_backu...', 'installed_versi...', '1.0.0')\\n#8 \\\/path\\\/http\\\/nextcloud\\\/testing-only\\\/nextcloud\\\/lib\\\/private\\\/Installer.php(445): OC\\\\Installer::installShippedApp('twofactor_backu...')\\n#9 \\\/path\\\/http\\\/nextcloud\\\/testing-only\\\/nextcloud\\\/lib\\\/private\\\/Updater.php(252): OC\\\\Installer::installShippedApps(true)\\n#10 \\\/path\\\/http\\\/nextcloud\\\/testing-only\\\/nextcloud\\\/lib\\\/private\\\/Updater.php(124): OC\\\\Updater->doUpgrade('11.0.1.2', '9.1.3.2')\\n#11 \\\/path\\\/http\\\/nextcloud\\\/testing-only\\\/nextcloud\\\/core\\\/Command\\\/Upgrade.php(261): OC\\\\Updater->upgrade()\\n#12 \\\/path\\\/http\\\/nextcloud\\\/testing-only\\\/nextcloud\\\/3rdparty\\\/symfony\\\/console\\\/Command\\\/Command.php(256): OC\\\\Core\\\\Command\\\\Upgrade->execute(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#13 \\\/path\\\/http\\\/nextcloud\\\/testing-only\\\/nextcloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(818): Symfony\\\\Component\\\\Console\\\\Command\\\\Command->run(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#14 \\\/path\\\/http\\\/nextcloud\\\/testing-only\\\/nextcloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(186): Symfony\\\\Component\\\\Console\\\\Application->doRunCommand(Object(OC\\\\Core\\\\Command\\\\Upgrade), Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Componet\\\\Console\\\\Output\\\\ConsoleOutput))\\n#15 \\\/path\\\/http\\\/nextcloud\\\/testing-only\\\/nextcloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(117): Symfony\\\\Component\\\\Console\\\\Application->doRun(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#16 \\\/path\\\/http\\\/nextcloud\\\/testing-only\\\/nextcloud\\\/lib\\\/private\\\/Console\\\/Application.php(169): Symfony\\\\Component\\\\Console\\\\Application->run(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#17 \\\/path\\\/http\\\/nextcloud\\\/testing-only\\\/nextcloud\\\/console.php(90): OC\\\\Console\\\\Application->run()\\n#18 \\\/path\\\/http\\\/nextcloud\\\/testing-only\\\/nextcloud\\\/occ(11): require_once('\\\/path\\\/http\\\/nextc...')\\n#19 {main}\",\"File\":\"\\\/path\\\/http\\\/nextcloud\\\/testing-only\\\/nextcloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/AbstractSQLiteDriver.php\",\"Line\":85}","level":3,"time":"2017-01-24T17:19:30+00:00","method":"--","url":"--","user":"--","version":"9.1.3.2"} {"reqId":"t8JUKlmOeQFHjHg2Y\/gW","remoteAddr":"","app":"updater","message":"\\OC\\Updater::failure: Doctrine\\DBAL\\Exception\\DriverException: An exception occurred while executing 'INSERT INTO \"oc_appconfig\" (\"appid\",\"configkey\",\"configvalue\") SELECT ?,?,? WHERE NOT EXISTS (SELECT 1 FROM \"oc_appconfig\" WHERE \"appid\" = ? AND \"configkey\" = ?)' with params [\"twofactor_backupcodes\", \"installed_version\", \"1.0.0\", \"twofactor_backupcodes\", \"installed_version\"]:\n\nSQLSTATE[HY000]: General error: 5 database is locked","level":3,"time":"2017-01-24T17:19:30+00:00","method":"--","url":"--","user":"--","version":"9.1.3.2"} ```The text was updated successfully, but these errors were encountered: