Service fails at startup

Hello - I am having trouble getting Kolibri to start. I am new to this, so let me know if the info I included is helpful or irrelevant.

Background: I am using a Raspberry Pi 3B+ running Raspian. I installed Kolibri and content using instructions for “Installing Kolibri”, “Set up Kolibri Domain” & “Attaching USB Storage” for an external HD from: https://kolibri.readthedocs.io/en/latest/install/raspberry_pi_manual.html#rpi-manual

At startup or when trying to use sudo start service Kolibri, I receive the following:

pi@raspberrypi:~ $ sudo service kolibri start
Job for kolibri.service failed because the control process exited with error code.
See “systemctl status kolibri.service” and “journalctl -xe” for details.
pi@raspberrypi:~ $ journalctl -xe
Nov 28 15:15:51 raspberrypi systemd[1]: kolibri.service: Control process exited, code=exited, status=1/FAI
– Subject: Unit process exited
– Defined-By: systemd
– Support: Debian -- User Support

– An ExecStart= process belonging to unit kolibri.service has exited.

– The process’ exit code is ‘exited’ and its exit status is 1.
Nov 28 15:15:51 raspberrypi systemd[1]: kolibri.service: Failed with result ‘exit-code’.
– Subject: Unit failed
– Defined-By: systemd
– Support: Debian -- User Support

– The unit kolibri.service has entered the ‘failed’ state with result ‘exit-code’.
Nov 28 15:15:51 raspberrypi systemd[1]: Failed to start LSB: kolibri daemon, an offline education platform
– Subject: A start job for unit kolibri.service has failed
– Defined-By: systemd
– Support: Debian -- User Support

– A start job for unit kolibri.service has finished with a failure.

– The job identifier is 813 and the job result is failed.
Nov 28 15:15:51 raspberrypi sudo[1360]: pam_unix(sudo:session): session closed for user root

pi@raspberrypi:~ $ systemctl status kolibri.service
● kolibri.service - LSB: kolibri daemon, an offline education platform
Loaded: loaded (/etc/init.d/kolibri; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2019-11-28 15:15:51 CST; 17min ago
Process: 1390 ExecStart=/etc/init.d/kolibri start (code=exited, status=1/FAILURE)

Nov 28 15:15:50 raspberrypi kolibri[1390]: File “/usr/lib/python3/dist-packages/kolibri/utils/cli.py”,
Nov 28 15:15:50 raspberrypi kolibri[1390]: backup = dbbackup(version)
Nov 28 15:15:50 raspberrypi kolibri[1390]: File "/usr/lib/python3/dist-packages/kolibri/core/deviceadmi
Nov 28 15:15:50 raspberrypi kolibri[1390]: for line in db.connections[“default”].connection.iterdump(
Nov 28 15:15:50 raspberrypi kolibri[1390]: File “/usr/lib/python3.7/sqlite3/dump.py”, line 56, in _iter
Nov 28 15:15:50 raspberrypi kolibri[1390]: for row in query_res:
Nov 28 15:15:50 raspberrypi kolibri[1390]: sqlite3.DatabaseError: database disk image is malformed
Nov 28 15:15:51 raspberrypi systemd[1]: kolibri.service: Control process exited, code=exited, status=1/FA
Nov 28 15:15:51 raspberrypi systemd[1]: kolibri.service: Failed with result ‘exit-code’.
Nov 28 15:15:51 raspberrypi systemd[1]: Failed to start LSB: kolibri daemon, an offline education platfor
lines 1-15/15 (END)

This all started when yesterday I ran:

sudo apt update

sudo apt upgrade

Preparing to unpack …/060-kolibri_0.12.9-0ubuntu2_all.deb …
Unpacking kolibri (0.12.9-0ubuntu2) over (0.12.8-0ubuntu1) …

Setting up kolibri (0.12.9-0ubuntu2) …
Installing new version of config file /etc/default/kolibri …
Installing new version of config file /etc/init.d/kolibri …
e[?1049he[22;0;0te[1;23re[4le[?25le(Be[me[37me[40me[1;23re[He[2Je[1;1He[97me[44me[K
e[K
e[K
e[K
e[K
e[K
e[K
e[K
e[K
e[K
e[K
e[K
e[K
e[K
e[K
e[K
e[K
e[K
e[K
e[K
e[K
e[K
e[Ke[1;1He[37mPackage configuratione[6;3He[30me[47m┌───────────────────────────────────────────────┤ e[31mKolibri configuratione[30m ├────────────────────────────────────────────────┐e[7;3H│ │e[97me[40m e[8;3He[30me[47m│ The Kolibri system service │e[97me[40m e[9;3He[30me[47m│ │e[97me[40m e[10;3He[30me[47m│ You have chosen to run Kolibri as a system service and it has been started automatically. You can start/stop/restart │e[97me[40m e[11;3He[30me[47m│ Kolibri with the following command │e[97me[40m e[12;3He[30me[47m│ │e[97me[40m e[13;3He[30me[47m│ sudo service kolibri [start, stop, restart] │e[97me[40m e[14;3He[30me[47m│ │e[97me[40m e[15;3He[30me[47m│ e[37me[41me[30me[47m │e[97me[40m e[16;3He[30me[47m│ │e[97me[40m e[17;3He[30me[47m└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘e[97me[40m e[18;4H e[15;62He[?12le[?25he[23;1He[37me(Be[me[39;49m
e[K
e[?1049le[23;0;0t\n\n NB! This operation can take some time, please be patient!
Synchronizing state of kolibri.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable kolibri
Job for kolibri.service failed because the control process exited with error code.
See “systemctl status kolibri.service” and “journalctl -xe” for details.

In the system logs I see the following:

Nov 28 12:09:10 raspberrypi kolibri[432]: ERROR Your database appears to be corrupted. If you encounter this,please immediately back up all files in the .kolibri folder thatend in .sqlite3, .sqlite3-shm, .sqlite3-wal, or .log and thencontact Learning Equality. Thank you!
Nov 28 12:09:10 raspberrypi kolibri[432]: Traceback (most recent call last):
Nov 28 12:09:10 raspberrypi kolibri[432]: File “/usr/bin/kolibri”, line 11, in
Nov 28 12:09:10 raspberrypi kolibri[432]: load_entry_point(‘kolibri==0.12.9’, ‘console_scripts’, ‘kolibri’)()
Nov 28 12:09:10 raspberrypi kolibri[432]: File “/usr/lib/python3/dist-packages/kolibri/utils/cli.py”, line 577, in main
Nov 28 12:09:10 raspberrypi kolibri[432]: initialize(debug=debug, skip_update=arguments[“–skipupdate”])
Nov 28 12:09:10 raspberrypi kolibri[432]: File “/usr/lib/python3/dist-packages/kolibri/utils/cli.py”, line 168, in initialize
Nov 28 12:09:10 raspberrypi kolibri[432]: backup = dbbackup(version)
Nov 28 12:09:10 raspberrypi kolibri[432]: File “/usr/lib/python3/dist-packages/kolibri/core/deviceadmin/utils.py”, line 104, in dbbackup
Nov 28 12:09:10 raspberrypi kolibri[432]: for line in db.connections[“default”].connection.iterdump():
Nov 28 12:09:10 raspberrypi kolibri[432]: File “/usr/lib/python3.7/sqlite3/dump.py”, line 56, in _iterdump
Nov 28 12:09:11 raspberrypi kolibri[432]: for row in query_res:
Nov 28 12:09:11 raspberrypi kolibri[432]: sqlite3.DatabaseError: database disk image is malformed

Any advice or instructions are greatly appreciated.

Dear Fogie,

There is some advice here: https://kolibri.readthedocs.io/en/latest/manage/get_support.html

Please ensure that you have the sqlite3 command available, otherwise sudo apt install sqlite3

Following this, you can restore the malformed database this way:

# Go to where your Kolibri data is stored
cd ~/.kolibri
# Create a directory to save the old DB in
mkdir -p malformed
# Copy the old malformed DB
cp -b db.sqlite3* malformed/
# Create a new database
sqlite3 db.sqlite3 .dump | sqlite3 fixed.db
# Move to the active location
mv fixed.db db.sqlite3
# Remove so-called "write-ahead log"
rm -f db.sqlite3-wal db.sqlite3-shm

Thank you, from what I can tell I am back up and running. Much appreciated!

1 Like