learningequality / ka-lite

KA Lite: lightweight web server for serving core Khan Academy content (videos and exercises) without needing internet connectivity
https://learningequality.org/ka-lite/
Other
457 stars 304 forks source link

kalite .17.0 Server not starting on boot raspberry Pi Debian 8.0 #5423

Closed case485 closed 7 years ago

case485 commented 7 years ago

I corrected this but I was not sure if this is by design. During the setup process I select "start as a service" then on reboot the service is not started. I have had this issue since Raspbian switched to the system.d startup structure. I noticed in the kalite.service file in /lib/system.d/system diretory that there is no "[Install]" section in the service file. When I appended the following : ... [Install] WantedBy=multi-user.target

Then I reloaded the service

systemctl daemon-reload

systemctl enable ka-lite.service

and rebooted it started as expected.

Thanks again for the great work.

benjaoming commented 7 years ago

Thanks @case485!! I was using a template from Ubuntu for the .service file, actually one of those that systemd auto-creates from init.d scripts... and was scratching my head a lot about this.

I'll make sure to add this and rebuild the .debs...

benjaoming commented 7 years ago

I'm also setting TimeoutStartSec= infinity, in case slow devices are running setup (scanning a large video folder).

TimeoutStartSec=

Configures the time to wait for start-up. If a daemon service does not signal start-up completion within the configured time, the service will be considered failed and will be shut down again. Takes a unit-less value in seconds, or a time span value such as "5min 20s". Pass "infinity" to disable the timeout logic. Defaults to DefaultTimeoutStartSec= from the manager configuration file, except when Type=oneshot is used, in which case the timeout is disabled by default (see systemd-system.conf(5)).

https://www.freedesktop.org/software/systemd/man/systemd.service.html

benjaoming commented 7 years ago

I've uploaded new debian sources, which are being built now:

https://launchpad.net/~learningequality/+archive/ubuntu/ka-lite-proposed

@case485 - would you be able to verify the prerelease in the proposed PPA to see if this works on your installation? Thanks! :)

case485 commented 7 years ago

Be glad to do it. One other thing I have noticed in locations like Haiti where we have frequent power outages is that on restart sometimes the kalite.pid file is not removed on a loss of power scenario and when the reboot starts kalite sees the kalite.pid file in the config directory and will not start until i manually remove it. I was going to add a force remove in one of the startup services to just be sure.

benjaoming commented 7 years ago

Be glad to do it. One other thing I have noticed in locations like Haiti where we have frequent power outages is that on restart sometimes the kalite.pid file is not removed on a loss of power scenario and when the reboot starts kalite sees the kalite.pid file in the config directory and will not start until i manually remove it.

This is a good point.

I haven't seen much feedback regarding power outages. We try to block multiple KA Lite processes because the SQLite database could be corrupted this way.

But the solution would be to check if the PID in the file exists, and if indeed that process is a kalite process.

~I'll open up a new issue for this!~ Done: #5424

benjaoming commented 7 years ago

Closing this, will investigate that the proposed fix in ka-lite-proposed PPA works, and tracking in above issue.

The PID check issue is tracked separately.

Thanks for the report @case485 !

benjaoming commented 7 years ago

Tested and released in ka-lite stable PPA.

benjaoming commented 7 years ago

In https://github.com/learningequality/ka-lite-installers/issues/440, I fixed the wrong ka-lite.service file which was not supposed to have been in debian/ but debian/startup/. Therefore, the fix has never been committed entirely (I'm not sure if somehow I've still managed to build and release with the correct file, but I'm assuming not).