ubuntu chkconfig bug修復

今天在虛擬機裏作DRBD實驗,使用chkconfig管理服務的時候,出現了問題。node

 

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,使用如下方法能夠解決    bash


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/裏面    
ide


root@node2:/root# ls -l /usr/lib/insserv/
total 56
-rwxr-xr-x 1 root root 56368 Apr  9 19:07 insserv


而後我就作了個鏈接過去  
spa


root@node2:/root# ln -s /usr/lib/insserv /sbin/insserv
root@node2:/root# chkconfig drbd on
/sbin/insserv: Permission denied


從上面看出,報了一個權限不容許,很鬱悶  ip


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


而後就好解決了     it


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沒    
io

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,沒發現相似的問題。class

相關文章
相關標籤/搜索