2009年4月16日 星期四

Suspend slackware in DELL1501

This is not true! It seems this is a kernel regression. I will post more info after the problem is identified!

Many users say that a Linux box should be shutdown as less time as possible. Because system will buffer the disk for you so the second-start-up time of an app will be much shorter. The longer time you run, the more quantity and more accurate buffer system will allocate, the faster your app will launch. If you shutdown you computer, all the buffer will gone. But I have to pay for my electricity charge! I want save power when I do not use my box. Unfortunately, Hibernate won't help because system will free "useless" pages to optimize load time.(I think) But Suspend is will keep the buffers and consume less energy. This is tested by other people.

But I suffered a disaster after resume from suspend. System goes totally unstable after resuming. I got something like this in dmesg:

[ 7962.125970] BUG: unable to handle kernel paging request at f76f5004
[ 7962.125984] IP: [] ext3_check_dir_entry+0x19/0x140
[ 7962.126000] *pde = 00007067 *pte = 77520002 
[ 7962.126010] Oops: 0000 [#1] SMP 
[ 7962.126017] last sysfs file: /sys/power/state
[ 7962.126024] Modules linked in: radeon drm vboxnetflt vboxdrv snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss ipv6 nls_cp936 vfat fat ext4 jbd2 crc16 fuse dell_laptop dcdbas b43 mac80211 joydev ricoh_mmc sdhci_pci cfg80211 led_class shpchp ohci_hcd sg input_polldev ati_agp agpgart video output
[ 7962.126075] 
[ 7962.126082] Pid: 6509, comm: pm-powersave Not tainted (2.6.29.1-slk-based-2 #4) Inspiron 1501 
[ 7962.126089] EIP: 0060:[] EFLAGS: 00010292 CPU: 1
[ 7962.126097] EIP is at ext3_check_dir_entry+0x19/0x140
[ 7962.126102] EAX: c0463684 EBX: f76f5000 ECX: f76f5000 EDX: f6c5a478
[ 7962.126108] ESI: f6846a00 EDI: 00002000 EBP: f6c5a478 ESP: f6785cec
[ 7962.126113]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
[ 7962.126120] Process pm-powersave (pid: 6509, ti=f6784000 task=f7031090 task.ti=f6784000)
[ 7962.126126] Stack:
[ 7962.126129]  f7781000 d9e5ad68 f6c35040 c01e6c4d 00000000 00000000 f6785dec f6785dec
[ 7962.126141]  f6785e80 c0463684 00000000 f76f5000 f6846a00 00002000 f6e246c0 c01e86f3
[ 7962.126153]  f6e246c0 00002000 f66c2cc0 f6ba1400 00000000 c01e5a07 0000000b d9c5fbb8
[ 7962.126166] Call Trace:
[ 7962.126171]  [] dx_probe+0x8d/0x350
[ 7962.126180]  [] ext3_find_entry+0x403/0x650
[ 7962.126189]  [] ext3_truncate+0x317/0x8e0
[ 7962.126197]  [] __ext3_get_inode_loc+0xda/0x2f0
[ 7962.126205]  [] __wake_up+0x3e/0x60
[ 7962.126215]  [] ext3_lookup+0x46/0xf0
[ 7962.126222]  [] d_alloc+0xf7/0x170
[ 7962.126233]  [] do_lookup+0x1ba/0x1e0
[ 7962.126240]  [] __link_path_walk+0x675/0xd90
[ 7962.126247]  [] generic_file_aio_read+0x2fa/0x6d0
[ 7962.126257]  [] do_page_fault+0x28c/0x6a0
[ 7962.126266]  [] path_walk+0x54/0xb0
[ 7962.126273]  [] do_path_lookup+0xb0/0x160
[ 7962.126280]  [] getname+0x96/0xd0
[ 7962.126287]  [] user_path_at+0x5a/0x90
[ 7962.126295]  [] vfs_stat_fd+0x22/0x60
[ 7962.126305]  [] sys_stat64+0xf/0x30
[ 7962.126313]  [] syscall_call+0x7/0xb
[ 7962.126321] Code: ff ff 83 c4 0c 5b c3 90 90 90 90 90 90 90 90 90 90 90 83 ec 3c 89 6c 24 38 89 5c 24 2c 89 d5 89 74 24 30 89 7c 24 34 89 44 24 24 <0f> b7 41 04 3d ff ff 00 00 74 74 83 f8 0b 89 c6 0f 8f c1 00 00 
[ 7962.126379] EIP: [] ext3_check_dir_entry+0x19/0x140 SS:ESP 0068:f6785cec
[ 7962.126390] ---[ end trace a30eca9c02841218 ]---
Some process has been terminated for some reason that I don't know. Even syslogd at worst case! Firefox won't launch, su don't work, if you click icons on panel, plasma will freeze...

After some exploring, I see these lines lay in /usr/doc/pm-utils-1.2.5/README.SLACKWARE

==============================================================================

KNOWN ISSUES

****  If you encounter either of these, mail rworkman@slackware.com ****

If your alsa drivers don't correctly save and restore state across a sleep /
resume cycle (due to a buggy driver), then you will need to add the drivers
to a custom file named /etc/pm/config.d/defaults (create the file if it does
not exist already) in a variable named "SUSPEND_MODULES" - see the file at
/usr/lib/pm-utils/defaults for proper format.

The /usr/lib/pm-utils/sleep.d/90clock does not run by default.  It added
over a second to suspend, and the vast majority of hardware does not need it
to keep the clocks in sync.  If you need this hook, you can set the
NEED_CLOCK_SYNC environment variable in a custom /etc/pm/config.d/defaults
file.

==============================================================================
So I tried to set NEED_CLOCK_SYNC=1 in /etc/pm/config.d/defaults . Suspend, go to a sleep, Resume. And everything works well! Angles sing, light suddenly fills the dorm ;)

What /usr/lib/pm-utils/sleep.d/90clock actually done is here:

#!/bin/sh
# Synchronize system time with hardware time.
# TODO: Do modern kernels handle this correctly?  If so, we should detect that
#       and skip this hook.

. "${PM_FUNCTIONS}"

suspend_clock()
{
        /sbin/hwclock --systohc >/dev/null 2>&1 0<&1
}

resume_clock()
{
        /sbin/hwclock --hctosys >/dev/null 2>&1 0<&1
}

[ "$NEED_CLOCK_SYNC" ] || exit $NA

case "$1" in
        hibernate|suspend) suspend_clock ;;
        thaw|resume) resume_clock ;;
        *) exit $NA ;;
esac


A LQ post that I created to discuss this issue is here

2009年3月31日 星期二

终于搞定 bzr 的 launchpad 帐户了……

纵使有一千个理由骂 bzr(而且确实有一千个理由),可还是要用它,入乡随俗么……

终于把 bzr 上的 launchpad 帐户搞定了。方法是在 ~/.bash_profile 里加一句

 export CURL_CA_BUNDLE=/usr/share/apps/kssl/ca-bundle.crt
,那个 ca-bundle.crt 是 "grep ca-bundle.crt /var/log/packages*" 找到的,竟然是 kde 包里面的一个东西 Qrz... 而且要重新 clone 上游才能有 commit 权限……

干嘛不用 git 呢?忽然想起前段时间看到的一句话:"yet another f*cking wheel -- but a better one",但是我觉得 bzr 就是"yet another f*cking wheel -- but a worse one"

2009年3月24日 星期二

近况

  1. 先是帮东子装上了 Slackware,装完了之后发现 slack 确实有点不适合新手,一开始不进图形界面就是一个比较大的台阶,系统的配置都只能通过文本来解决就会让很多从 win 下转来的孩子们不知所措…… 不过还好,折腾了一下午终于大概配置好了。

    不过在配置鼠标滚轮的时候发现一个问题,安装网上说的在 InputDevice 里加入:

     Option      "ZAxisMapping" "4 5"
    还是不够,还需要把 Option "Protocol" 改成 "explorerps/2" 才行…… 不知大家有没有遇到相同的问题……

    Update: 看了 vvoody 的回复,发现改成 "IMPS/2" 也是可以的,后来自己好奇,改成了"auto",结果 xorg 自己探测的结果还是 "explorerps/2",好吧,还是信任 xorg 吧~

  2. 最近开始看 Babiloo的源码了~主要是因为1)觉得不看代码还是不行2)那个东西是用 PyQt4 写的而且是个字典程序,还可以就着学点英语。不过看的时候就觉得不爽,首先是代码是用 bzr 托管在 launchpad.com,用惯了 git 感觉 bzr 作为一个 “分布式”版本控制工具怎么就不支持本地的分支和合并……(至少是迄今为止我还不知道怎么办,特性里面也没有说……)而且 bzr 和 launchpad 绑定的太紧了……代码缩进风格和自己的也不一样…… 不过能和作者直接联系这个优势是怎么样也替代不了的~ 当找到一个 bug 的时候可以和作者直接联系,他会给你讲一些全局上的事情,能让人受益匪浅。不管怎样,先坚持下去吧~

2009年3月2日 星期一

大刀向Google Reader的头上砍去

今天在 Reader 里看到这样一篇文章:《大刀向Google Reader的头上砍去》文章幽默诙谐,读后深有感触。于是反观自己的 Reader,嗯,是该整理了。

整理的时候忽然发现 GReader 有一个十分好的功能:Trends(不清楚中文是怎么翻译的)。打开他就可以看到每个订阅的阅读率。我把低于 30% 的原则上全部退订了~一下子清闲了很多。估计以后又会有一段清闲的生活了,不过节省下来的时间去干嘛呢?……

忽然记起来以前看到过一个“定律”的,就是一个人开始的时候总是会被垃圾信息包围着,但是他又不愿意去屏蔽,因为“可能”会损失有价值的信息。但是事实是从一堆垃圾信息里能提取出有价值信息的概率很小,人们总是会得到有价值信息的,但是不是通过这种“鸟枪法”。但是现在我就感觉自己的信息“确实”太闭塞了,整天两眼一摸黑,啥新闻都不知道…… 大家都是怎么样收集信息的呢?

2009年2月5日 星期四

感动中国 2008 之感动我

其实一开始就觉得自己没心没肺,如果不是我妈看那个节目我也就不会搬电脑过去看了。但是既然看了,而且略微有点小感动了,那就墨迹两句吧。

看完之后我妈问我,哪个给你最大的感动?我问,你呢?她说,是那个彝族教师,因为其他人其实只是做好他们的本职工作。我觉得也是。尤其是当他说自己每月的工资只有两百块钱的时候,快不成了……其实我当时很想看看主持人是什么表情,估计她的工资是这个的百倍,身上的一件衣服就顶的上人家几个月的工资…… 能够经常上网的同学们也可以想想两百块对你来说算什么?对人家来说算什么?由此,其实中国的国情也就可见一斑了。(想说当地消费水平低的滚蛋~ 每月给你两百块钱把你扔山里19年你试试?)

其实还有一个感动的,就是神州七号的乘员组。可能是自己从小关心航空航天的事件,略微知道点其中的辛劳、危险的缘故。尤其是当舱内有火警时改变工作程序的那一段。虽然理智上感觉那样做不对,觉得要是真有火,还是先灭火为好,但是那种大无畏的勇气,祖国至上的精神,是最感动我而且我所应该学习的。

没错,本质上说他们只是完成了自己的本职工作。但是这年头,能干好自己的本职工作就比较不错了。要是还有能力,还有意志,做到像那两个彝族教师一样更好。貌似《肖申克的救赎》里有句经典台词叫“要么好好活着,要么就去死”说的就是这个事?说了半天,其实我还是属于那种“就去死”的类型,为了以后能“好好活 ”今天就先不死了,呵呵~

2009年1月14日 星期三

sep.py v0.1.1 发布

咳咳~ sep.py 是我自己写的一个 python 小脚本。用来从当前目录下提取指定扩展名的文件,并且保留其目录结构~~ 我经常是先用 vvoodycueconv.sh 转换下载下来的 flac啊,cue+ape啊什么的,然后在用这个脚本把转出来的东西一并提取出来,而且不会乱~;)

源代码在这里:http://github.com/grissiom/etc/raw/59d2482073b174530c27a58c8c28c8852e11d579/sep/sep.py。GPLv3 的许可证吧。代码是用 github 托管的~ 感兴趣的同学可以跟踪。非常欢迎提意见或者是 bug report。要是 bug fix 更好~ ;D

早晨发布的那个 v0.1 有问题,这个 v0.1.1 就好了~ 如果带来不便请见谅~;)

Qt4.5 will release under LGPL

消息来源这里还有~~