解决ubuntu的chkconfig[/sbin/insserv 无法找到路径问题]
http://www.cnblogs.com/lost-1987/archive/2012/10/17/2727285.html
今天在虚拟机里做DRBD实验,使用chkconfig管理服务的时候,出现了问题。 root@node2:/root# chkconfig --list | grep drbd drbd 0:off 1:off 2:off 3:off 4:off 5:off 6:off root@node2:/root# chkconfig drbd on /sbin/insserv: No such file or directory 这是Ubuntu 12.04的一个BUG,使用以下方法可以解决 root@node2:/root# whereis insserv insserv: /etc/insserv /etc/insserv.conf /usr/lib/insserv /usr/share/insserv /usr/share/man/man8/insserv.8.gz 把上面找到的目录,一个一个的看一遍,发现文件在/usr/lib/里面 root@node2:/root# ls -l /usr/lib/insserv/ total 56 -rwxr-xr-x 1 root root 56368 Apr 9 19:07 insserv 然后我就做了个连接过去 root@node2:/root# ln -s /usr/lib/insserv /sbin/insserv root@node2:/root# chkconfig drbd on /sbin/insserv: Permission denied 从上面看出,报了一个权限不允许,很郁闷 root@node2:/root# ls -l /sbin/insserv lrwxrwxrwx 1 root root 16 Jun 21 04:27 /sbin/insserv -> /usr/lib/insserv root@node2:/root# ls -l /usr/lib/insserv total 56 -rwxr-xr-x 1 root root 56368 Apr 9 19:07 insserv 从上面看出,有权限的啊,好郁闷,最后发现 /usr/lib/insserv竟然是一个目录 root@node2:~# cd /usr/lib/insserv/ root@node2:/usr/lib/insserv# pwd /usr/lib/insserv root@node2:/usr/lib/insserv# ls insserv 然后就好解决了 root@node2:/usr/lib/insserv# rm -rf /sbin/insserv root@node2:/usr/lib/insserv# ln -s /usr/lib/insserv/insserv /sbin/insserv root@node2:/usr/lib/insserv# chkconfig drbd on The script you are attempting to invoke has been converted to an Upstart job, but lsb-header is not supported for Upstart jobs. insserv: warning: script 'friendly-recovery' missing LSB tags and overrides insserv: Default-Start undefined, assuming empty start runlevel(s) for script `friendly-recovery' insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `friendly-recovery' 报了一堆的其它错误,先不管吧,看看服务OK没 root@node2:/usr/lib/insserv# chkconfig --list | grep drbd drbd 0:off 1:off 2:on 3:on 4:on 5:on 6:off root@node2:/usr/lib/insserv# OK,现在看到服务已经搞定了。Ubuntu还是有Bug的,呵呵,好像还挺多。以前总是玩RedHat,没发现类似的问题。
What Doesn't Kill Me Makes Me Stronger