Experiments with Linux

Temporary Fix For Cherokee on Raspbian

Submitted by Derwent Ready on Saturday, 04 January 2014

Following my article yesterday on the quick and dirty way to install Cherokee web server on a Raspberry Pi I feel I need to explain how to fix a potential problem you may encounter. The latest version of Rasbian for the Raspberry Pi comes with Mathematica and Wolfram language and I noticed that once Cherokee was installed and set to start on boot it was causing conflicts that would prevent dpkg from installing any more packages due to a conflicting loop in the Cherokee and Mathematica startup scripts. I wrote a post on the Raspberry Pi forums about it. If you try to install a package using apt-get install and noticed any of these errors:

insserv: there is a loop between service cherokee and mathkernel if stopped
insserv: loop involving service mathkernel at depth 2
insserv: loop involving service cherokee at depth 1

sub-process /usr/bin/dpkg returned an error code (1)

Then you may benefit from following the steps below.

Disclaimer: I take no responsibility for any damage you may cause to your system by following this article.

This is a quick and dirty workaround to fix it. Please be aware that this may render Mathematica inoperable but for me at least a running web server is more important. To fix this problem type in your terminal:

sudo mv /etc/init.d/mathkernel /home/pi

This will remove the Mathematica startup script from /etc/init.d and place it in /home/pi. This is assuming you didn't rename your main user account to something else. If you did replace the pi with your username.

Finally run:

sudo update-rc.d cherokee defaults

This should reinitialise the offending Cherokee script without the conflicts arising from Mathematica. To test this you can try and install a new or failed package. Rebooting might also be a good idea.

I hope this article was useful.

If you liked this blog post, why not buy me a beverage?

Blog Appreciation: Usefulness