Chinaunix

标题: rpcbind服务开机不启动,尽管已经在chkconfig rpcbind on [打印本页]

作者: liaozd    时间: 2013-08-27 17:14
标题: rpcbind服务开机不启动,尽管已经在chkconfig rpcbind on
本帖最后由 liaozd 于 2013-08-27 17:14 编辑

Redhat 6.4里面

可以在chkconfig rpcbind --list看到:
  1. rpcbind    0:off   1:0ff   2:on   3:on   4:on   5:on   6:off
复制代码
但是service rpcbind status显示的是:
rpcbind is stopped

除非手动运行一下/sbin/rpcbind,才能看到rpcbind(pid 2312) is running....
作者: zongg    时间: 2013-08-27 17:28
占的端口是多少? 是不是portmap 这个服务?
作者: liaozd    时间: 2013-08-27 21:14
回复 2# zongg


    如何看占的什么端口?

RHEL4和5是portmap,RHEL6改名叫作rpcbind了,我是需要mount NAS上的NFS。每次手动运行rpcbind之后就可以正常mount,否则mount不上。
作者: zongg    时间: 2013-08-27 22:23
回复 3# liaozd


    对,nfs 是依赖portmap 的,也就是6里的rpcbind .

rpcbind 一直启着就行。
作者: liaozd    时间: 2013-08-28 06:48
回复 4# zongg

我就是不明白为什么chkconfig中可以看到rpcbind是开着的,但每次启动之后却没有启动。


   
作者: zongg    时间: 2013-08-28 08:53
回复 5# liaozd


    恩,确实不清楚是什么情况,你的机器总需要重启吗? 不行就得把它放在
  1. [root@db ~]# cat /etc/rc.d/rc.local
复制代码

作者: liaozd    时间: 2013-08-28 21:36
回复 6# zongg

我重装一下再试试吧。谢谢!

   
作者: zongg    时间: 2013-08-28 22:14
回复 7# liaozd


    好吧,试试看吧。
作者: llzzccc    时间: 2013-08-29 05:14
回复 5# liaozd


    能确定在rcx.d目录下面有link吗?
作者: wenhq    时间: 2013-08-29 06:40
看/var/log/messages 有启动日志
作者: liaozd    时间: 2013-08-29 11:12
回复 9# llzzccc

etc/rc[3-5].d/ 每个里面都有rpcbind的link


   
作者: liaozd    时间: 2013-08-29 11:25
回复 10# wenhq


message里面没有出现rpcbind
作者: Purple_Grape    时间: 2013-08-29 17:37
添加个任务计划
*/5 * * * * puppet resource service rpcbind ensure=running enable=true

作者: wenhq    时间: 2013-08-29 19:47
回复 12# liaozd


    要看grep -i error /var/log/messages*

目的是看异常是啥,或者错误是啥?是否这些error能导致rpcbind无法启动。
作者: liaozd    时间: 2013-08-30 12:10
回复 13# Purple_Grape

谢谢,是个备选方案!


   
作者: liaozd    时间: 2013-08-30 12:13
回复 14# wenhq

这是台新安装的机器,没安装什么新服务,也没有多少error和warning。message里面没有线索


   
作者: llzzccc    时间: 2013-08-31 04:41
只是一个建议,在rpcbind 的script 里面,找到stop call,然后加入一个warning message 输出到屏幕,看看能不能在启动的时候看到。如果实在不行就在stop里面block,然后看看是谁干的。
作者: wjg501917603    时间: 2013-09-02 11:52
你这样,先看下/etc/init.d/下有没有rpcbind,如果没有在该目录下对/sbin/rpcbind做一个软链接
作者: liaozd    时间: 2013-09-03 16:14
回复 17# llzzccc

感谢你的建议,不过rpcbind是在/sbin/rpcbind,不是一个script,我file了一下,结果是:
  1. /sbin/rpcbind: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Llinux j2.6.18, stipped
复制代码

作者: llzzccc    时间: 2013-09-05 23:27
本帖最后由 llzzccc 于 2013-09-05 23:28 编辑
liaozd 发表于 2013-09-03 16:14
回复 17# llzzccc

感谢你的建议,不过rpcbind是在/sbin/rpcbind,不是一个script,我file了一下,结果是 ...


你的 /etc/init.d/ 下面一定会有一个rpcbind 脚本,这个才是你启动的时候真正执行的,在你的rcx.d目录下的S13rpcbind应该是链接到这个脚本的。

有点无语。
作者: liaozd    时间: 2013-09-06 11:53
本帖最后由 liaozd 于 2013-09-06 12:00 编辑

回复 20# llzzccc

o" />ps:" /> 看串楼层了。

加入了一些warning message 1-7 (Line: 22, 31, 38, 47, 49, 63)

  1. # This is an interactive program, we need the current locale
  2. [ -f /etc/profile.d/lang.sh ] && . /etc/profile.d/lang.sh
  3. # We can't Japanese on normal console at boot time, so force LANG=C.
  4. if [ "$LANG" = "ja" -o "$LANG" = "ja_JP.eucJP" ]; then
  5.     if [ "$TERM" = "linux" ] ; then
  6.         LANG=C
  7.     fi
  8. fi

  9. # Source function library.
  10. . /etc/init.d/functions

  11. # Source networking configuration.
  12. [ -f /etc/sysconfig/network ] &&  . /etc/sysconfig/network

  13. prog="rpcbind"
  14. [ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog

  15. RETVAL=0
  16. uid=`id | cut -d\( -f1 | cut -d= -f2`

  17. echo "waring message 1"
  18. start() {
  19.         # Check that networking is up.
  20.         [ "$NETWORKING" = "yes" ] || exit 6

  21.         [ -f /sbin/$prog ] || exit 5

  22.         # Make sure the rpcbind is not already running.
  23.         if status $prog > /dev/null ; then
  24.                 echo "waring message 2"
  25.                 exit 0        
  26.         fi

  27.         # Only root can start the service
  28.         [ $uid -ne 0 ] && exit 4

  29.         echo "waring message 4"
  30.         echo -n [        DISCUZ_CODE_0        ]quot;Starting $prog: "
  31.         daemon $prog $1 "$RPCBIND_ARGS"
  32.         RETVAL=$?
  33.         echo
  34.         if [ $RETVAL -eq 0 ] ; then
  35.                 touch /var/lock/subsys/$prog
  36.                 [ ! -f /var/run/rpcbind.pid ] &&
  37.                         /sbin/pidof $prog > /var/run/rpcbind.pid
  38.         echo "waring message 5"
  39.         fi
  40.         echo "waring message 6"
  41.         return $RETVAL
  42. }


  43. stop() {
  44.         echo -n [        DISCUZ_CODE_0        ]quot;Stopping $prog: "
  45.         killproc $prog
  46.         RETVAL=$?
  47.         echo
  48.         [ $RETVAL -eq 0 ] && {
  49.                 rm -f /var/lock/subsys/$prog
  50.                 rm -f /var/run/rpcbind*
  51.         }
  52.         echo "waring message 7"
  53.         return $RETVAL
  54. }

  55. # See how we were called.
  56. case "$1" in
  57.   start)
  58.         start
  59.         RETVAL=$?
  60.         ;;
  61.   stop)
  62.         stop
  63.         RETVAL=$?
  64.         ;;
  65.   status)
  66.         status $prog
  67.         RETVAL=$?
  68.         ;;
  69.   restart | reload| force-reload)
  70.         stop
  71.         start
  72.         RETVAL=$?
  73.         ;;
  74.   condrestart | try-restart)
  75.         if [ -f /var/lock/subsys/$prog ]; then
  76.                 stop
  77.                 start -w
  78.                 RETVAL=$?
  79.         fi
  80.         ;;
  81.   *)
  82.         echo [        DISCUZ_CODE_0        ]quot;Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart|try-restart}"
  83.         RETVAL=2
  84.         ;;
  85. esac

  86. exit $RETVAL
复制代码
执行的输出结果是这样的:
  1. [root@vfxws04 init.d]# service rpcbind start
  2. waring message 1
  3. [root@vfxws04 init.d]# service rpcbind status
  4. waring message 1
  5. rpcbind is stopped
  6. [root@vfxws04 init.d]# service rpcbind stop
  7. waring message 1
  8. Stopping rpcbind:                                          [FAILED]
  9. waring message 7
  10. [root@vfxws04 init.d]#
复制代码

作者: llzzccc    时间: 2013-09-07 00:12
本帖最后由 llzzccc 于 2013-09-07 00:14 编辑

运行晚这个,系统log里面有什么信息吗?

在72行前面加上 “echo $RETVAL"
作者: liaozd    时间: 2013-09-10 10:48
回复 22# llzzccc

修改了第72行:
# See how we were called.
case "$1" in
  start)
        start
        RETVAL=$?
        echo $RETVAL
        ;;
  stop)
        stop
        RETVAL=$?
        ;;

运行的结果是这样的:
  1. [root@vfxws04 init.d]# service rpcbind start; echo $?
  2. waring message 1
  3. 6
  4. [root@vfxws04 init.d]# service rpcbind stop; echo $?
  5. waring message 1
  6. Stopping rpcbind:                                          [FAILED]
  7. waring message 7
  8. 0
  9. [root@vfxws04 init.d]# service rpcbind restart; echo $?
  10. waring message 1
  11. Stopping rpcbind:                                          [FAILED]
  12. waring message 7
  13. 6
复制代码
运行的时候tail -f /var/log/message,没有出现任何新的内容。


作者: llzzccc    时间: 2013-09-11 05:00
回复 23# liaozd


很明显,你在start的时候,第25行直接就exit了。说明网络没有开启。

这个你应该自己会查找了吧。
作者: liaozd    时间: 2013-09-11 10:25
回复 24# llzzccc

奇怪啊,我是ssh进去的,网络没问题


   
作者: llzzccc    时间: 2013-09-11 21:24
liaozd 发表于 2013-09-11 10:25
回复 24# llzzccc

奇怪啊,我是ssh进去的,网络没问题


那个脚本就是检查 “$NETWORKING” 这个变量,他是通过source /etc/sysconfig/network来得到这个变量值的。

看看在 /etc/sysconfig/network 里面是不是 NETWORKING=yes

你写过脚本吗?
作者: liaozd    时间: 2013-09-13 14:26
回复 26# llzzccc

就是这个!我之前修改过,可能忘记保存了,network文件是空的。

NETWORKING=yes是什么意思?为什么文件里是空的我的机器也能使用网络功能?

刚开始写脚本,几乎没写过。

谢谢!
   
作者: llzzccc    时间: 2013-09-13 22:33
本帖最后由 llzzccc 于 2013-09-13 22:33 编辑
liaozd 发表于 2013-09-13 14:26
回复 26# llzzccc

就是这个!我之前修改过,可能忘记保存了,network文件是空的。


我不知道你的机器具体怎么设置的,是不是要进入UI 用 networkmanager控制网络的开启呢?

你可以 在 /etc/init.d 下执行 grep "sysconfig/network" * . 这样你就知道有多少网络的服务依赖它了。

其中 network 是控制网络的开启的,如果在这个设置文件中 ”NETWORK=no“, 机器启动的时候就不会开启网络。很多网络相关的服务也检查这个变量的。

你可以从其他的机器上考一个过来,这就是一个设置文件。

这个对你是好机会,看看那些启动脚本,挺好的,也能更了解系统。
作者: liaozd    时间: 2013-09-18 14:28
回复 28# llzzccc

谢谢!

我查了,留个记录在这里:
  1. dnsmasq:. /etc/sysconfig/network
  2. netconsole:. /etc/sysconfig/network
  3. netfs:[ -f /etc/sysconfig/network ] || exit 0
  4. netfs:. /etc/sysconfig/network
  5. network:if [ ! -f /etc/sysconfig/network ]; then
  6. network:. /etc/sysconfig/network
  7. network:cd /etc/sysconfig/network-scripts
  8. network:        if [ -x /etc/sysconfig/network-scripts/init.ipv6-global ]; then
  9. network:                /etc/sysconfig/network-scripts/init.ipv6-global start pre
  10. network:         if [ -x /etc/sysconfig/network-scripts/init.ipv6-global ]; then
  11. network:                 /etc/sysconfig/network-scripts/init.ipv6-global start post
  12. network:        if [ -x /etc/sysconfig/network-scripts/init.ipv6-global ]; then
  13. network:                /etc/sysconfig/network-scripts/init.ipv6-global stop post
  14. NetworkManager:. /etc/sysconfig/network
  15. nfs:[ -f /etc/sysconfig/network ] &&  . /etc/sysconfig/network
  16. nfslock:if [ ! -f /etc/sysconfig/network ]; then
  17. nfslock:[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
  18. ntpd:. /etc/sysconfig/network
  19. ntpdate:. /etc/sysconfig/network
  20. postfix:. /etc/sysconfig/network
  21. rdisc:. /etc/sysconfig/network
  22. rpcbind:[ -f /etc/sysconfig/network ] &&  . /etc/sysconfig/network
  23. rpcgssd:[ -f /etc/sysconfig/network ]&&  . /etc/sysconfig/network
  24. rpcidmapd:[ -f /etc/sysconfig/network ] &&  . /etc/sysconfig/network
  25. rpcsvcgssd:[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
  26. winbind:. /etc/sysconfig/network
  27. wpa_supplicant:. /etc/sysconfig/network
  28. xinetd:# config: /etc/sysconfig/network
  29. xinetd:test -f /etc/sysconfig/network && . /etc/sysconfig/network
  30. ypbind:[ -e /etc/sysconfig/network ] && . /etc/sysconfig/network
复制代码





欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2