LinuxSir.cn,穿越时空的Linuxsir!

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

cannot start hwclock是何故?(貌似解决了)

[复制链接]
发表于 2008-7-10 02:37:43 | 显示全部楼层 |阅读模式
开机显示
ERROR: cannot start hwclock as fsck would not start
但是时间显示正常:

  1. localhost ~ # hwclock
  2. Thu 10 Jul 2008 01:07:24 AM CST  -0.173325 seconds
  3. localhost ~ # date
  4. Thu Jul 10 01:07:24 CST 2008

  5. localhost ~ # rc-update -v show | grep fsck
  6.                  fsck | boot                        
  7. localhost ~ # rc-update -v show | grep hwclock
  8.            hwclock | boot                        
  9. localhost ~ # cat /etc/conf.d/hwclock
  10. # Set CLOCK to "UTC" if your system clock is set to UTC (also known as
  11. # Greenwich Mean Time).  If your clock is set to the local time, then
  12. # set CLOCK to "local".  Note that if you dual boot with Windows, then
  13. # you should set it to "local".
  14. CLOCK="local"
  15. #这里我也试过小写的clock="local"

  16. # If you want to set the Hardware Clock to the current System Time
  17. # during shutdown, then say "YES" here.
  18. # You normally don't need to do this if you run a ntp daemon.
  19. clock_systohc="NO"

  20. # If you wish to pass any other arguments to hwclock during bootup,
  21. # you may do so here. Alpha users may wish to use --arc or --srm here.
  22. clock_args=""
  23. #同样试过clock_args="--directisa"


  24. localhost ~ # cat /etc/timezone
  25. PRC
  26. #这里我还试过TIMEZONE="PRC"

复制代码


/etc/localtime是复制的/usr/share/zoneinfo/PRC,内核已经加入Real Time Clock Support 并且/dev/rtc 存在。

忘了说了,用的是openrc
 楼主| 发表于 2008-7-10 21:52:55 | 显示全部楼层
虽然开机这样写,但时间是正确的,而且开机后运行
  1. localhost ~ # /etc/init.d/hwclock start
  2. * WARNING: hwclock has already been started
复制代码
因此也没太着急解决这个问题,可是今天把/etc/rc.conf中rc_parallel="NO"修改成YES,问题就出来了,启动到hwclock这一步系统就不动了……附上我的/etc/init.d/hwclock文件:
  1. #!/sbin/runscript
  2. # Copyright 2007-2008 Roy Marples <roy@marples.name>
  3. # All rights reserved. Released under the 2-clause BSD license.
  4. extra_commands="save show"
  5. description="Sets the local clock to UTC or Local Time."
  6. description_save="Saves the current time in the BIOS."
  7. description_show="Displays the current time in the BIOS."
  8. clock_adjfile=${clock_adjfile:-${CLOCK_ADJFILE}}
  9. clock_args=${clock_args:-${CLOCK_OPTS}}
  10. clock_systohc=${clock_systohc:-${CLOCK_SYSTOHC}}
  11. clock=${clock:-${CLOCK:-UTC}}
  12. if [ "${clock}" = "UTC" ]; then
  13.         utc="UTC"
  14.         utc_cmd="--utc"
  15. else
  16.         utc="Local Time"
  17.         utc_cmd="--localtime"
  18. fi
  19. depend()
  20. {
  21.         provide clock
  22.         if yesno ${clock_adjfile}; then
  23.                 use root
  24.         else
  25.                 before *
  26.         fi
  27.         keyword noopenvz noprefix nouml novserver noxenu
  28. }
  29. setupopts()
  30. {
  31.         case "$(uname -m)" in
  32.                 s390*)
  33.                         utc="s390"
  34.                         ;;
  35.                 *)
  36.                         if [ -e /proc/devices ] && \
  37.                                 grep -q " cobd$" /proc/devices
  38.                         then
  39.                                 utc="coLinux"
  40.                         fi
  41.                         ;;
  42.         esac
  43.         case "${utc}" in
  44.                 UTC|Local" "Time);;
  45.                 *) unset utc_cmd;;
  46.         esac
  47. }
  48. # hwclock doesn't always return non zero on error
  49. _hwclock()
  50. {
  51.         local err="$(hwclock "$@" 2>&1 >/dev/null)"
  52.         [ -z "${err}" ] && return 0
  53.         echo "${err}" >&2
  54.         return 1
  55. }
  56. start()
  57. {
  58.         local retval=0 errstr=""
  59.         setupopts
  60.         if [ -z "${utc_cmd}" ]; then
  61.                 ewarn "Not setting clock for ${utc} system"
  62.                 return 0
  63.         fi
  64.         ebegin "Setting system clock using the hardware clock [${utc}]"
  65.         if [ -e /proc/modules -a ! -e /dev/rtc ]; then
  66.                 modprobe -q rtc || modprobe -q genrtc
  67.         fi
  68.         if [ -e /etc/adjtime ] && yesno ${clock_adjfile}; then
  69.                 _hwclock --adjust ${utc_cmd}
  70.                 retval=$((${retval} + $?))
  71.         fi
  72.        
  73.         # If setting UTC, don't bother to run hwclock when first booting
  74.         # as that's the default
  75.         if [ "${PREVLEVEL}" != "N" -o \
  76.                 "${utc_cmd}" != "--utc" -o \
  77.                 -n "${clock_args}" ];
  78.         then
  79.                 _hwclock --hctosys ${utc_cmd} ${clock_args}
  80.                 retval=$((${retval} + $?))
  81.         fi
  82.        
  83.         eend ${retval} "Failed to set the system clock"
  84.         return 0
  85. }
  86. stop()
  87. {
  88.         # Don't tweak the hardware clock on LiveCD halt.
  89.         [ -n "${CDBOOT}" ] && return 0
  90.         yesno ${clock_systohc} || return 0
  91.         local retval=0 errstr=""
  92.         setupopts
  93.         [ -z "${utc_cmd}" ] && return 0
  94.         ebegin "Setting hardware clock using the system clock" "[${utc}]"
  95.         if ! yesno "${clock_adjfile}"; then
  96.                 # Some implementations don't handle adjustments
  97.                 if LC_ALL=C hwclock --help | grep -q "\-\-noadjfile"; then
  98.                         utc_cmd="${utc_cmd} --noadjfile"
  99.                 fi
  100.         fi
  101.         _hwclock --systohc ${utc_cmd} ${clock_args}
  102.         retval=$?
  103.         eend ${retval} "Failed to sync clocks"
  104. }
  105. save()
  106. {
  107.         clock_systohc="yes"
  108.         stop
  109. }
  110. show()
  111. {
  112.         setupopts
  113.         hwclock --show "${utc_cmd}" ${clock_args}
  114. }
复制代码
有问题么?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-7-11 00:57:59 | 显示全部楼层
基本解决了。
曾经多次手动修改了fsck和hwclock的depend,依然无效,后来干脆把hwclock从boot级别删除,转移到default,居然没有错误提示了。不理解啊,因为没升级到openrc以前,clock的运行级别设置为boot完全没问题啊,莫非hwclock必须要在default?
还有就是,似乎openrc在我电脑上不太稳定?非parallel模式还好,如果设置为parallel模式,在启动过程中按I键会随机的hang住(时有时无)。太神奇了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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