環境はCentOS7
何らかの起動スクリプトを実行しようとした時に以下のように言われた場合の対処法
/etc/init.d/hoge-service: line xx: /lib/lsb/init-functions: No such file or directory Usage: /etc/init.d/hoge-service {start|stop|status|restart|xxx}
yum provides でファイルが入っているパッケージを検索してみる
yum provides '/lib/lsb/init-functions' Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.iij.ad.jp * epel: ftp.riken.jp * extras: ftp.iij.ad.jp * remi-safe: mirror.smartmedia.net.id * updates: ftp.iij.ad.jp base/7/x86_64/filelists_db | 6.6 MB 00:00 epel/x86_64/filelists_db | 7.6 MB 00:01 extras/7/x86_64/filelists_db | 423 kB 00:00 jenkins/filelists_db | 60 kB 00:00 mysql-connectors-community/x86_64/filelists_db | 14 kB 00:00 mysql-tools-community/x86_64/filelists_db | 92 kB 00:00 mysql56-community/x86_64/filelists_db | 527 kB 00:00 puppetlabs-pc1/x86_64/filelists_db | 795 kB 00:01 https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/7/safe/x86_64/repodata/ddcc1cbd9d1924c6b987fb349692907297f27c7048a1e118bf8b71db9870cf9a-filelists.sqlite.bz2: [Errno 12] Timeout on https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/7/safe/x86_64/repodata/ddcc1cbd9d1924c6b987fb349692907297f27c7048a1e118bf8b71db9870cf9a-filelists.sqlite.bz2: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds') Trying other mirror. remi-safe/7/filelists_db | 755 kB 00:00 updates/7/x86_64/filelists_db | 1.7 MB 00:00 redhat-lsb-core-4.1-27.el7.centos.1.i686 : LSB Core module support Repo : base Matched from: Filename : /lib/lsb/init-functions redhat-lsb-core-4.1-27.el7.centos.1.x86_64 : LSB Core module support Repo : base Matched from: Filename : /lib/lsb/init-functions
redhat-lsb-coreとかいう中に入っているらしいのでインストール
yum -y install redhat-lsb-core
インストールされた
yum list installed | grep redhat-lsb redhat-lsb-core.x86_64 4.1-27.el7.centos.1 @base redhat-lsb-submod-security.x86_64 4.1-27.el7.centos.1 @base
以下にちゃんと配置されている事がわかる。
ll /lib/lsb/ total 4 -rwxr-xr-x 1 root root 631 Mar 27 2015 init-functions lrwxrwxrwx 1 root root 23 Mar 2 14:54 install_initd -> ../../../sbin/chkconfig lrwxrwxrwx 1 root root 23 Mar 2 14:54 remove_initd -> ../../../sbin/chkconfig
これでおk
/etc/init.d/hoge-service Usage: /etc/init.d/hoge-service {start|stop|status|restart|xxx}
正直LSBが何なのかよくわからないので暫定対応的には使えるが、勉強不足・・・