Content Inadvertently Removed from Kolibri While Still in Studio

One of our content developers was working on a channel that we call our “Basic Teaching Certificate”. After adding a few resources to the studio, she attempted to update the channel in our instance of Kolbri but found that the new content did not load and many of the previous resources in our channel were removed in the process. The channel went from being 250mb to 4mb after she attempted to update it.

I have logged into our course in the studio and confirmed that the resources are still there and the studio indicates that there are no changes that need to be published. Over in our Kolibri instance, the channel is also showing as being fully up to date without offering the option to download the resources that are now missing.

My two questions are: (1) is there a particular way that this kind of thing happens to help us avoid it in the future? (2) What’s the best way to restore the full version of the channel? We could just download it again and remove the partial channel but this would require re-doing a lot of work on the class that we are offering for teachers.

Hello @Andy_Johnson , your channel problem is now on one developer hands studying what happened. We’ll provide you feedback as soon as we find it out.

Regards
José

Thank you so much for the reply and for looking into it!

Hi @Andy_Johnson

Could you provide some additional details:

  • What version of Kolibri are you running?
  • What operating system are you running Kolibri on?
  • Are you using the default database backend SQLite, or are you using PostgreSQL?

Regards,
Blaine

Thank you for your reply, @blaine! We are on Kolibri version 0.13.3. We are running Kolibri on Ubuntu 18.04.3 (LTS) x64 and using SQLite.

Hi @Andy_Johnson,

Thank you for your patience. I’ve tested a snippet of Python that should help resolve the problem. Here are the steps to resolve your issue importing your channel:

  1. Make a back up of your db.sqlite3 file in your Kolibri home directory, which is ~/.kolibri by default
  2. From a terminal, run kolibri manage shell
  3. Copy and paste the Python code below into the shell:
from django.core.management import call_command
from django.db.models.signals import pre_delete

pre_delete.receivers = []
call_command("deletechannel", "<YOUR CHANNEL ID HERE>")
  1. Close the shell (Ctrl+C) and close the terminal.
  2. Re-import the channel from Studio

We believe your issue originated from a bug that occurred on Kolibri Studio a few months ago, which was resolved but is still plaguing channels that may have been published during that time. This should not occur again.

Let us know if this resolves your issue.

Regards,
Blaine

Thank you for this guidance! We took steps 1-4 but when I attempted to re-import the channel from the studio this evening, I received the following error message.

Sorry! Something went wrong!
We care about your experience on Kolibri and are working hard to fix this issue
Try refreshing this page or going back to the home page

Any idea why the channel is not able to be imported using the token at this time?

Hi @Andy_Johnson,

I did not experience this in testing this for you. Could you please share your Kolibri log file?

You might also try restarting Kolibri to see if that has any effect.

Regards,
Blaine

Thank you your response! We restarted Kolibri and shut down the server and brought it back up but are getting the same result. The error details indicate “TypeError: An id must be specified”. Here’s what’s currently showing in our the Kolibri log.

WARNING 2021-10-08 19:54:33,838 api Did not find language code tpi in our le_utils.constants!
WARNING 2021-10-08 19:54:33,841 api Did not find language code brh in our le_utils.constants!
WARNING 2021-10-08 19:54:33,841 api Did not find language code taj in our le_utils.constants!
WARNING 2021-10-08 19:54:33,842 api Did not find language code bxk in our le_utils.constants!
WARNING 2021-10-08 19:54:33,842 api Did not find language code enq in our le_utils.constants!
WARNING 2021-10-08 19:54:33,842 api Did not find language code yao in our le_utils.constants!
WARNING 2021-10-08 19:54:33,843 api Did not find language code new in our le_utils.constants!
WARNING 2021-10-08 19:54:33,843 api Did not find language code kak in our le_utils.constants!
WARNING 2021-10-08 19:54:33,843 api Did not find language code kam in our le_utils.constants!
WARNING 2021-10-08 19:54:33,844 api Did not find language code mai in our le_utils.constants!
WARNING 2021-10-08 19:54:33,844 api Did not find language code awa in our le_utils.constants!
WARNING 2021-10-08 19:54:33,844 api Did not find language code pbu in our le_utils.constants!
WARNING 2021-10-08 19:54:33,845 api Did not find language code pbt in our le_utils.constants!
WARNING 2021-10-08 19:54:33,845 api Did not find language code tum in our le_utils.constants!
WARNING 2021-10-08 19:54:33,846 api Did not find language code bcc in our le_utils.constants!
WARNING 2021-10-08 19:54:33,846 api Did not find language code srr in our le_utils.constants!
WARNING 2021-10-08 19:54:33,846 api Did not find language code dty in our le_utils.constants!
WARNING 2021-10-08 19:54:33,847 api Did not find language code thl in our le_utils.constants!
WARNING 2021-10-08 19:54:33,847 api Did not find language code guz in our le_utils.constants!
INFO 2021-10-08 20:14:08,490 system Initiating shutdown of Kolibri
INFO 2021-10-08 20:14:08,493 system Waiting for Kolibri to finish shutting down
INFO 2021-10-08 20:14:17,892 apps Running Kolibri with the following settings: kolibri.deployment.default.settin$
INFO 2021-10-08 20:14:38,535 cli Kolibri background services have successfully been stopped.
WARNING 2021-10-08 20:31:14,825 options Options file /var/kolibri/.kolibri/options.ini has been updated; server $
WARNING 2021-10-08 20:31:14,881 options Options file /var/kolibri/.kolibri/options.ini has been updated; server $
INFO 2021-10-08 20:31:21,571 apps Running Kolibri with the following settings: kolibri.deployment.default.settin$
INFO 2021-10-08 20:31:22,046 cli Running Kolibri as background process
INFO 2021-10-08 20:31:22,047 cli Starting Kolibri background workers
INFO 2021-10-08 20:31:22,048 cli Going to background mode, logging to /var/kolibri/.kolibri/logs/kolibri.txt
INFO 2021-10-08 20:31:22,077 server Starting Kolibri 0.13.3
INFO 2021-10-08 20:31:22,093 cherrypy.error ENGINE Listening for SIGTERM.
INFO 2021-10-08 20:31:22,096 cherrypy.error ENGINE Listening for SIGHUP.
INFO 2021-10-08 20:31:22,100 cherrypy.error ENGINE Listening for SIGUSR1.
INFO 2021-10-08 20:31:22,101 cherrypy.error ENGINE Listening for SIGINT.
INFO 2021-10-08 20:31:22,101 cherrypy.error ENGINE Bus STARTING
INFO 2021-10-08 20:31:23,281 utils Started new JOBCHECKER thread ID#8a7760d9260b40a892699f9a78e36727
INFO 2021-10-08 20:31:23,292 utils Started new JOBCHECKER thread ID#8ec544c0ef9547f382fc779ce6bac216
INFO 2021-10-08 20:31:23,293 utils Started new SCHEDULECHECKER thread ID#d596dcee7371400ba1d5f715643dbc4e
INFO 2021-10-08 20:31:23,344 search Registering ourselves to zeroconf network with id 'aa56e741c6bccfe25c14bb7e6$
INFO 2021-10-08 20:31:24,164 cherrypy.error ENGINE Bus STARTED
INFO 2021-10-08 20:31:25,047 utils Ping succeeded! (response: {‘id’: 1918341, ‘messages’: [{‘msg_id’: '0be5e8c1-$
INFO 2021-10-08 20:31:44,305 apps Running Kolibri with the following settings: kolibri.deployment.default.settin$
WARNING 2021-10-08 20:32:19,965 api Did not find language code tpi in our le_utils.constants!
WARNING 2021-10-08 20:32:19,966 api Did not find language code brh in our le_utils.constants!
WARNING 2021-10-08 20:32:19,967 api Did not find language code taj in our le_utils.constants!
WARNING 2021-10-08 20:32:19,967 api Did not find language code bxk in our le_utils.constants!

I noticed another thread mentioning problems with importing content while on 0.13.3 but it does not reference a solution. Should we upgrade to 0.14 or should we wait until this issue is resolved first? We’re still unable to re-import the impacted channel referenced in this thread. Just for the sake of a test, I just made a new channel to see if I could publish and then import it into our instance of Kolibri. In this case, the attempt to publish did not work and I received the following error message.

An unexpected error has occurred. Please try again, and if you continue to see this message, please contact support via the Help menu.

Hi @Andy_Johnson,

We’re constantly making improvements to Kolibri, so upgrading to 0.14 may also resolve the problem and I definitely encourage upgrading Kolibri generally speaking.

I sent you a DM regarding further investigation.

Hi @Andy_Johnson,

Digging into the issue further, the code I sent you appears to have done what we needed it to but some internal caching within Kolibri could be causing the issues during the re-import of the channel.

After making another backup (just in case), could you please try the following steps:

  1. Stop Kolibri
  2. Repeat the previously shared steps to delete the channel (please be sure to replace <YOUR CHANNEL ID HERE> with your channel ID)
  3. Delete the process_cache directory from the Kolibri home directory: rm -rf process_cache
  4. Start Kolibri
  5. Re-import the channel

Thank you for your patience
Regards,
Blaine

Hi @Andy_Johnson!

Just wanting to check whether the suggested fix addressed your issue, or if you’re still facing problems. Thanks!

Hi @jamalex! Thanks for checking in. No, this issue never did get resolved. The follow up steps that we were provided removed the content, as intended but did not allow us to reimport the channel into our instance of Kolibri. We can no longer import or update content in this instance of Kolibri. What we’ve had to do instead is create a new instance since this was a time-sensitive project. I would still like to get to the bottom of this for the sake of the ongoing use of this particular install of Kolibri.

I just logged into the Studio again and tested the import one time and confirmed that I still received the same error as before. Then I created a new channel just to test and see if I could import it but now I’m getting an unexpected error trying to publish as well. For the time being, this install of Kolibri cannot import new or updated channels and my studio account doesn’t seem to allow publishing a channel as well.

It would still be helpful to hear from somebody about this particular ticket. The instance mentioned in this thread is no longer able to import channels.

Have you tried clearing the storage/databases folder in the Kolibri home directory? If there’s a corrupted channel database that has persisted in there, that could continue to cause issues.

Thank you for your response, @richard! Based on your recommendation, we did clear the storage/databases folder but the problem lingers. The two things I’ve observed are (1) we cannot import a channel or update one using the token from the Studio; and (2) any updates to a class give an error indicating that they can’t be saved.