# Corrupted database following upgrade to 0.12.2

**URL:** <https://community.learningequality.org/t/corrupted-database-following-upgrade-to-0-12-2/1097>\
**Category:** Kolibri\
**Tags:** installation\
**Created:** [March 31, 2019, 10:53am UTC](https://community.learningequality.org/t/corrupted-database-following-upgrade-to-0-12-2/1097 "2019-03-31T10:53:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cjackson](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.learningequality.org/cjackson/32/240_2.png) [@cjackson](https://community.learningequality.org/u/cjackson)\
**Post date:** [March 31, 2019, 10:53am UTC](https://community.learningequality.org/t/corrupted-database-following-upgrade-to-0-12-2/1097/1 "2019-03-31T10:53:57Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![richard](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.learningequality.org/richard/32/10_2.png) [@richard](https://community.learningequality.org/u/richard)\
**Post date:** [March 31, 2019, 5:31pm UTC](https://community.learningequality.org/t/corrupted-database-following-upgrade-to-0-12-2/1097/2 "2019-03-31T17:31:58Z")

</div>

Hi @cjackson!

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

```auto
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?

```auto
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?

---

<div class="post-metadata">

**Author:** ![cjackson](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.learningequality.org/cjackson/32/240_2.png) [@cjackson](https://community.learningequality.org/u/cjackson)\
**Post date:** [March 31, 2019, 9:36pm UTC](https://community.learningequality.org/t/corrupted-database-following-upgrade-to-0-12-2/1097/3 "2019-03-31T21:36:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![richard](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.learningequality.org/richard/32/10_2.png) [@richard](https://community.learningequality.org/u/richard)\
**Post date:** [March 31, 2019, 10:13pm UTC](https://community.learningequality.org/t/corrupted-database-following-upgrade-to-0-12-2/1097/4 "2019-03-31T22:13:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cjackson](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.learningequality.org/cjackson/32/240_2.png) [@cjackson](https://community.learningequality.org/u/cjackson)\
**Post date:** [April 1, 2019, 5:52am UTC](https://community.learningequality.org/t/corrupted-database-following-upgrade-to-0-12-2/1097/5 "2019-04-01T05:52:03Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![richard](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.learningequality.org/richard/32/10_2.png) [@richard](https://community.learningequality.org/u/richard)\
**Post date:** [April 1, 2019, 2:48pm UTC](https://community.learningequality.org/t/corrupted-database-following-upgrade-to-0-12-2/1097/6 "2019-04-01T14:48:26Z")

</div>

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.

> [@cjackson](#):
>
> Failed to start (check log file: /home/pi/.kolibri/server.log) (6)

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

---

<div class="post-metadata">

**Author:** ![cjackson](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.learningequality.org/cjackson/32/240_2.png) [@cjackson](https://community.learningequality.org/u/cjackson)\
**Post date:** [April 1, 2019, 3:25pm UTC](https://community.learningequality.org/t/corrupted-database-following-upgrade-to-0-12-2/1097/7 "2019-04-01T15:25:13Z")

</div>

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