LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 3089|回复: 0

/var/log/boot.log为空的问题

[复制链接]
发表于 2007-8-7 08:20:16 | 显示全部楼层 |阅读模式
前两天主意到自己那台RHEL5下的/var/log/boot.log总是为空的,检查了一下/etc/syslog.conf也没有发现什么错误. Google了一下发现原来这个记录到boot.log的功能在RHEL5下被裁去了.

Boot-time logging to /var/log/boot.log is not available in this release of Red Hat Enterprise Linux 5. An equivalent functionality will be added in a future update of Red Hat Enterprise Linux 5
(http://www.redhat.com/docs/manua ... E-NOTES-x86-en.html)

继续搜索了一下发现这个问题在Fedora里已经存在挺久了。原因是Redhat决定淘汰对initlog的使用,所以在/etc/init.d/functions中将所有调用initlog的命令给注释起来了.

e.g.

  1. # Log that something succeeded
  2. success() {
  3.   #if [ -z "${IN_INITLOG:-}" ]; then
  4.   #   initlog $INITLOG_ARGS -n $0 -s "$1" -e 1
  5.   #fi
  6.   [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_success
  7.   return 0
  8. }
复制代码


我觉得boot.log对于考试中做trouble shooting或是正常运行一个服务器都是比较有用的一个日志,所以没有了是比较不方便的。查了一下,还好/sbin/initlog还在,只是调用它的时候会给出一个Warning告诉你它已经被deprecated了。那么一个简单的恢复就是编辑/etc/init.d/functions文件把这些注释都去掉。重启之后就可以看到boot.log里面记录了在你选择的run level下的daemon的开启和关闭记录了。

但问题是如果只是要判断这些daemon是不是在开机的时候运行了,其实一个简单的ps命令,或者查看一下/var/lock/subsys下对应的lock 文件就可以了。但是在Redhat决定不用initlog之后把其它daemon自带的init script里所有用到initlog的命令都去除了。比如我对比了一下RHEL4和RHEL5下/etc/init.d/kudzu文件

  1. #RHEL4
  2. start)
  3.         echo -n $"Checking for new hardware"
  4.         rm -f /var/run/Xconfig
  5.         rm -f /var/run/Xconfig-failed

  6.         # Have a 30 second timeout.
  7.         /usr/sbin/kudzu $KUDZU_ARGS -t 30
  8.         RETVAL=$?
  9.         if [ "$RETVAL" -eq 0 ]; then
  10.            action "" /bin/true
  11.         else
  12.            action "" /bin/false
  13.            if [ "$RETVAL" -eq 5 ]; then
  14.                echo -n $"Hardware configuration timed out."
  15.                echo -n $"Run '/usr/sbin/kudzu' from the command line to re-detect."
  16.                [color="Red"]initlog -n kudzu -s $"Hardware configuration timed out."
  17.                initlog -n kudzu -s $"Run '/usr/sbin/kudzu' from the command line to re-detect."[/color]
  18.            fi
  19.         fi
复制代码

  1. #RHEL5
  2. start)
  3.         echo -n $"Checking for hardware changes"
  4.         rm -f /var/run/Xconfig
  5.         rm -f /var/run/Xconfig-failed

  6.         # Have a 30 second timeout.
  7.         /sbin/kudzu $KUDZU_ARGS
  8.         RETVAL=$?
  9.         if [ "$RETVAL" -eq 0 ]; then
  10.            action "" /bin/true
  11.         else
  12.            action "" /bin/false
  13.         fi
复制代码


这样即使去掉了/etc/init.d/functions文件中的注释,那些个额外的启动关闭信息就都不会记录到boot.log中了,里面就只有succeeded, failed了

当然了对于相应的服务查看它自身的日志文件还是最有效的方法。只是觉得boot.log已经提供了一个比较不错的日志,Redhat既然认为initlog已经过时,但是在没有更新之间不应该直接把它停了。而且从Fedora的情况上看来这个问题已经存在挺久了,希望可以早点出update解决吧
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表