Corrupted database following upgrade to 0.12.2

If you have a specific technical inquiry, construct your post with the following:

Upgrade to x.12.2 resulted in corrupted database error. Have backed up the sqlite & log files separately.

Link to kolibri.log and db: https://www.dropbox.com/s/l0gt1tprsqwxfup/Jackson_kolibri.zip?dl=0

Summary

Errors generated:

Running migrations:
No migrations to apply.
Installed 2 object(s) from 1 fixture(s)
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.OperationalError: no such column: content_channelmetadata.published_size

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/bin/kolibri”, line 11, in
load_entry_point(‘kolibri==0.12.2’, ‘console_scripts’, ‘kolibri’)()
File “/usr/lib/python3/dist-packages/kolibri/utils/cli.py”, line 630, in main
initialize(debug=debug)
File “/usr/lib/python3/dist-packages/kolibri/utils/cli.py”, line 181, in initialize
update()
File “/usr/lib/python3/dist-packages/kolibri/utils/cli.py”, line 260, in update
update_channel_metadata()
File “/usr/lib/python3/dist-packages/kolibri/core/content/utils/annotation.py”, line 48, in update_channel_metadata
import_channel_from_local_db(channel_id)
File “/usr/lib/python3/dist-packages/kolibri/core/content/utils/channel_import.py”, line 675, in import_channel_from_local_db
import_manager.import_channel_data()
File “/usr/lib/python3/dist-packages/kolibri/core/content/utils/channel_import.py”, line 507, in import_channel_data
if self.check_and_delete_existing_channel():
File “/usr/lib/python3/dist-packages/kolibri/core/content/utils/channel_import.py”, line 397, in check_and_delete_existing_channel
existing_channel = ChannelMetadata.objects.get(id=self.channel_id)
File “/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/manager.py”, line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File “/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/query.py”, line 374, in get
num = len(clone)
File “/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/query.py”, line 232, in len
self._fetch_all()
File “/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/query.py”, line 1121, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File “/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/query.py”, line 53, in iter
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
File “/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/sql/compiler.py”, line 899, in execute_sql
raise original_exception
File “/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/sql/compiler.py”, line 889, in execute_sql
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.OperationalError: no such column: content_channelmetadata.published_size
pi@raspberrypi:~ $ kolibr status
-bash: kolibr: command not found
pi@raspberrypi:~ $ kolibri status
WARNING:root:No C Extensions available for this platform.

INFO Running Kolibri with the following settings: kolibri.deployment.default.settings.base
Stopped (1)
pi@raspberrypi:~ $

Technical details

  • Kolibri version x.12.2
  • Operating system Raspbian
  • Chromium, Safari, Firefox

Hi @cjackson!

From the logs, I assume you upgraded yesterday (the 30th), as I see that there was a malformed database image error then:

ERROR 2019-03-30 18:11:14,096 exception Internal Server Error: /coach/api/classsummary/bf41a602107dde3d526beb970023a678/
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

Just wanting to check when precisely the error occured relative to upgrade.

@jredrejo I notice that the background notification saving process is getting initialized twice? Can you imagine why that might be happening?

INFO 2019-03-30 10:19:20,815 tasks Initializing background log saving process
INFO 2019-03-30 10:19:50,561 tasks Initializing background log saving process

I looked at the database file locally, and it appears to still be readable by some tools, so I think it should be recoverable. @benjamin would you be able to follow up with Chris to restore his database?

I upgraded today, 3/30 in the morning my time (West Africa Time). I downloaded the installer from GitHub. I noticed that the post-beta version was up, so thought I’d go ahead and install it. It ran with no errors, but then Kolibri did not load fully. I checked the status and also ran “Kolibri start”. That’s when I got the error message telling me to make a backup of he sqlite and log files and contact LE for support.

I did check the migrations and all appears to have worked fine. No errors there.

Sorry @cjackson - I am a bit confused, today is the 31st of March, are you saying you upgraded on the 30th, or the 31st?

@richard - I can now see and understand your confusion! The excerpt of the log file I sent is marked 3/30. I looked back at my log file and it shows the update from 0.12.2b3 to 0.12.2 took place yesterday, 3/31. However all the errors I saw preceded that event, strangely. Since the update, I have not been able to launch Kolibri or access it via a browser.

Running ‘kolibri status’ I get:

pi@raspberrypi:~ $ kolibri status
WARNING:root:No C Extensions available for this platform.

INFO Running Kolibri with the following settings: kolibri.deployment.default.settings.base
Failed to start (check log file: /home/pi/.kolibri/server.log) (6)

However, the server.log file shows no update written to it at the time this error was generated. I just tested it again and the log file was not updated.

Thanks for the context, I had not realized that this was a machine that was already running 0.12.2b3, so it implies that the 0.12.2 release might still be part of the issue, even if the upgrade was not to blame.

Seems like this error message is misleading - as errors that get logged to kolibri.log that prevent startup will not appear here.

Jose Rodriguez fixed the database this morning. It is working fine again. He could give an update as to what he found.

1 Like