Database disk image is malformed
See original GitHub issueObserved behavior
Upgrading kolibri from 0.7.2 to 0.10.0b3 will have this Database disk image is malformed
error when running the kolibri start
command.
Errors and logs
442 static files copied to '/home/user/.kolibri/static', 3 unmodified.
Operations to perform:
Apply all migrations: admin, auth, content, contenttypes, device, exams, kolibriauth, lessons, logger, morango, sessions
Running migrations:
Applying auth.0008_alter_user_username_max_length... OK
Applying content.0007_auto_20180212_1155... OK
Applying content.0008_contentnode_coach_content...Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/backends/sqlite3/base.py", line 328, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.DatabaseError: database disk image is malformed
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/bin/kolibri", line 9, in <module>
load_entry_point('kolibri==0.10.0b3', 'console_scripts', 'kolibri')()
File "/usr/lib/python3/dist-packages/kolibri/utils/cli.py", line 646, in main
start(port, daemon=daemon)
File "/usr/lib/python3/dist-packages/kolibri/utils/cli.py", line 261, in start
update()
File "/usr/lib/python3/dist-packages/kolibri/utils/cli.py", line 239, in update
_migrate_databases()
File "/usr/lib/python3/dist-packages/kolibri/utils/cli.py", line 176, in _migrate_databases
call_command("migrate", interactive=False, database=database)
File "/usr/lib/python3/dist-packages/kolibri/dist/django/core/management/__init__.py", line 131, in call_command
return command.execute(*args, **defaults)
File "/usr/lib/python3/dist-packages/kolibri/dist/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/usr/lib/python3/dist-packages/kolibri/dist/django/core/management/commands/migrate.py", line 204, in handle
fake_initial=fake_initial,
File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/migrations/executor.py", line 115, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/migrations/executor.py", line 244, in apply_migration
state = migration.apply(state, schema_editor)
File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/migrations/migration.py", line 129, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/migrations/operations/fields.py", line 88, in database_forwards
field,
File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/backends/sqlite3/schema.py", line 238, in add_field
self._remake_table(model, create_field=field)
File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/backends/sqlite3/schema.py", line 206, in _remake_table
self.quote_name(model._meta.db_table),
File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/backends/base/schema.py", line 136, in execute
cursor.execute(sql, params)
File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/lib/python3/dist-packages/kolibri/dist/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/backends/sqlite3/base.py", line 328, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.DatabaseError: database disk image is malformed
Steps to reproduce
- Install the 0.7.2
- Copy the 0.7.2 Kolibri sample data at the
.kolibri
- Upgrade to 0.10.0b3
- Run the
Kolibri start
command
Context
- Kolibri version: 0.10.0b3
- Operating system: Ubuntu 18.o4 LTS
- Browser:
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Fix SQLite Database Disk Image is Malformed
If you find the 'SQLite Database Disk Image is malformed' error, export your database into an SQL file. To export the data, click...
Read more >How to fix a "database disk image is malformed" - Storj
Sometimes a Storage Node Operator may encounter the "database disk image is malformed" error in their log. This could happen during ...
Read more >SQLite Database Disk Image Is Malformed: Fix It Successfully
Method to Rectify SQLite Database Disk Image is Malformed · Firstly, open the database Browser for SQLite · In the next step, run...
Read more >file - SQLite3 database or disk is full / the ... - Stack Overflow
I'm having a problem where queries are failing due to a "database or disk is full" and then sometimes "database disk image is...
Read more >Error Message "The database disk image is malformed".
"The database disk image is malformed". It also appears when I attempt to open photo files already stored on my hard drive. What...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@indirectlylit indeed - and it seems that I might have to go back to 0.7.2 to reproduce malformed databases.
Thanks @mrpau-richard for reproducing this 🎉
I have two favors to ask from you @mrpau-richard 😃
The technique for restoring the database as described here did not seem to work on Ubuntu 18.04, but I would appreciate if you can confirm this for your problematic db?
What are your simplest steps to reproduce a malformed database? I mean, not by copying the user data directory that you so kindly uploaded - but can you repeat the minimal set of steps to end up with this malformed db in
~/.kolibri
?Here is another type of malformed database. Happening on a Raspberry Pi w/ Raspian and Kolibri from PPA: