LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
楼主: dacheng

新编译的内核时钟比计算机快8小时?[已解决]

[复制链接]
发表于 2010-1-16 11:49:57 | 显示全部楼层
Post by dacheng;2064515
使用d00m3d兄提供的cp命令并重启后系统时钟仍然快8小时。我怀疑是某些脚本的原因。继续Google。。。。。


Strange!

What did you type in the cp?

What is the result of the date command after the cp?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-1-16 12:18:52 | 显示全部楼层
回d00m3d兄,命令是:
sudo cp -v --remove-destination /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
reboot后,时钟仍然快8小时。刚才我检查过了,在/etc/init.d/hwclock.sh和/etc/init.d/hwclockfirst.sh中都有这样一句:
HWCLOCKPARS="--directisa“
另外,已经说过了,我是在单用户模式下检查的。硬盘上有根分区、交换分区和home分区三个。
回复 支持 反对

使用道具 举报

发表于 2010-1-16 12:23:26 | 显示全部楼层
It has nothing to deal with partitions.

I am curious to know what is the result of the date command after the cp?

i.e. after you run "cp -v --remove-destination /usr/share/zoneinfo/Asia/Shanghai /etc/localtime" as root, then type:

date

and see what is the result.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-1-16 14:13:30 | 显示全部楼层
回d00m3d兄,cp后的输出:
$date
Sat Jan 16 21:16:45 CST 2010
$hwclock --directisa --show
Sat Jan 1613:46:55 2010  -0.453933 Seconds
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-1-16 14:19:24 | 显示全部楼层
发现了hwclock不能使用的原因:
$hwclock
Cannot access the Hardware clock via any known method.
$hwclock --debug
hwclockpen of /dev/rtc faild erno=2:No such file or directory
Cannot access the Hardware clock via any known method.
hwclock from util-linux-ng 2.16.2
No useable clock interface found.

从上述输出,可以看到。没有/dev/rtc这个文件。经检查在/sys和/proc下都有rtc文件。在/dev下确实没有。
还发现一个奇怪的问题:/dev下没有hda文件,导致不能加载/dev/hda7(/home),但hda3(根/)却可以在mount的输出中发现。
回复 支持 反对

使用道具 举报

发表于 2010-1-16 14:20:07 | 显示全部楼层
个人经验:
1、rtc加载成功不代表驱动正确,在本人的机器上是把rtc模块加入黑名单的,否则也是会快8小时;
2、看看是否存在设备/dev/rtc0,否则脚本是不会正确处理的;
3、就是要小心设置UTC=no及时区后,重启时CMOS中设置正确的北京时间,否则也经常把人搞晕。
回复 支持 反对

使用道具 举报

发表于 2010-1-16 14:25:05 | 显示全部楼层
Post by dacheng;2064610
发现了hwclock不能使用的原因:
$hwclock
Cannot access the Hardware clock via any known method.
$hwclock --debug
hwclockpen of /dev/rtc faild erno=2:No such file or directory
Cannot access the Hardware clock via any known method.
hwclock from util-linux-ng 2.16.2
No useable clock interface found.

从上述输出,可以看到。没有/dev/rtc这个文件。经检查在/sys和/proc下都有rtc文件。在/dev下确实没有。
还发现一个奇怪的问题:/dev下没有hda文件,导致不能加载/dev/hda7(/home),但hda3(根/)却可以在mount的输出中发现。


Did you run tzselect before cp?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-1-16 15:12:53 | 显示全部楼层
已经tzselect。Google后,发现可能要打补丁,已经aptitude install linux-patch-2.6.30,但不知道如何给源码打补丁,d00m3d兄请指点一二,谢谢!
回复 支持 反对

使用道具 举报

发表于 2010-1-16 16:52:01 | 显示全部楼层
请直接用最新稳定版内核试试。

变通的做法是给 /etc/init.d/hwclock.sh 添加 --directisa 参数,早些年官方内核在特定机机上有类似问题。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-1-16 17:40:30 | 显示全部楼层
回深空兄:现在使用linux-image-2.6.30-2是正确的;尝试着在/etc/init.d/hwclock.sh和/etc/init.d/hwclockfirst.sh里加上了“--directisa”参数,依然无效。
回复 支持 反对

使用道具 举报

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

本版积分规则

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