【エラー】ラズベリーパイでapt-get installしようとすると「script ‘mathkernel’ missing LSB tags and overrides」と言われてインストールできない

スポンサーリンク

試したのはラズベリーパイ1 モデルBです。OSがrasbian_wheezyとちょっと古いやつ

こんなエラーでどうにもならないorz
apacheすらインストールできないので、OSが古すぎてダメなのかと諦めてました。

libsensors4:armhf (1:3.3.2-2+deb7u1) を設定しています ...
lm-sensors (1:3.3.2-2+deb7u1) を設定しています ...
insserv: warning: script 'mathkernel' missing LSB tags and overrides
insserv: There is a loop between service monit and mathkernel if stopped
insserv:  loop involving service mathkernel at depth 2
insserv:  loop involving service monit at depth 1
insserv: Stopping mathkernel depends on monit and therefore on system facility `$all' which can not be true!
insserv: exiting now without changing boot order!
update-rc.d: error: insserv rejected the script header

調べてみると、ラズベリーパイのスクリプトに一部記述が足りないみたいです
https://www.raspberrypi.org/forums/viewtopic.php?f=95&t=68263
より

対処

sudo vi /etc/init.d/mathkernel

で設定ファイルを編集し、最初の行の後(2行目)に以下のコードを追加して保存するとOKみたいです

### BEGIN INIT INFO
# Provides:          mathkernel
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: mathkernel
### END INIT INFO

追加後はこんな感じ

#!/bin/sh
### BEGIN INIT INFO
# Provides:          mathkernel
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: mathkernel
### END INIT INFO

そのあと

sudo apt-get install (パッケージ名)

でインストールすると、たぶんエラーが出なくなっていると思います。