Saturday, January 26, 2013

How I lose 12 kg in 4 months

First of all, my BIG thanks to the research program I signed up as a test subject, and to all who gave me support during the period - my bosses, my colleagues, and especially my wife :) 

I have been trying to reduce my weight for years, but I have not made much progress towards my goal. I once thought it is difficult for me because somehow I digest food very fast and when I need energy, my body cannot convert fat to energy efficiently. After this program, I realized I was all wrong... I now know that I cannot reduce my weight because I ate too much, and exercise too little :P

There is no secret in losing weight. Basically, you have to ensure your calories intake is less than your output. In my case,  

1) I take 500 less calories than my usual intake amount of 2000 to 2200. Which means, I take 1500 - 1700 calories per day during the weight loss phase. 

 How to control the intake precisely is the tricky part. Either you can measure the calories of the food you eat one by one, or you can take some meal replacement like me (as required by my program). There are plenty of brands out there and I will not mention any specific ones because I am not advertising here. 

I take meal replacement for 2 meals, 5 days a week. For the rest of the meals I eat my normal amount (which should not be over-sized - just moderate amount). In between my meals, I take 2 times snacks, one in the morning and the other in the afternoon. Each snack should be less than 100 calories and should be something difficult to digest (e.g. no soft drinks :P). I will sometimes take max 2 servings of fruits per day. Again, choose difficult to digest fruits. 

 If you have issue with getting hungry too soon, you can try meal replacements with protein powders. In my case the meal replacement worked pretty well in hunger control. 

Of course it is not a hard and fast rule that you must reduce 500 calories intake per day. The basic idea is to eat less for main meals, and fill the gap with snacks. Overall you should eat a few hundred calories less than what you ought to (again usually it is 2000-2200 for male adults. Not sure about ladies...) 

2) I do gym exercises to burn fats 3 times a week. Each session burns 500 calories. So that's a total of 1500 calories per week. 

What I usually do for the gym sessions is fast walking (around 14 incline, 5.5 km/h) on treadmill, which takes me about 40 to 50 minutes to burn 500 calories. Other exercises like cross trainer are equally fine, as long as you don't do something too intense. The key thing here in my opinion is sustainability - you have to ensure your body can take it and won't get pain or too tired after the session. 

Again, it is not a rule that one must consume 500 calories per session, and must do 3 sessions per week. However, the total amount burnt cannot be too little, I guess. 

 3) This is important, you must be disciplined to do 1) and 2). Do not skip them unless you are really sick... In my case, I found it not difficult (not easy either, of course) to do all those for 4 months. 

The result - I lost 12 kg and 5.3 inches of waist. I must say it is pretty awesome :P 

That's all - no magical pills, no slimming sessions on expensive equipment. No adverse side effects (except that I felt a bit hungry sometimes). It is a natural and effective way of losing weight. Hope it helps for those who are in a similar situation like me.

Monday, November 28, 2011

New PC Components

New Stuff:
Motherboard: ASRock Z68 Extreme4 Gen3
CPU: Intel Core i5 2500K
SGD 583
RAM: Corsair Vengeance DDR3-1600 4GB X 2
SGD 85
Primary Disk: ADATA S511 120GB
SGD 290

Monday, June 13, 2011

Consequences of Treating My Car as Amphibious

I have to admit - driving my car through floods in Bukit Timah Road is thrilling and fun... but the consequence is dire :P (Well, it could be much worse, if the water went into the engine.)

Just recording down the damage for reference later based on my interpretation of the repair bill.

1) The ETM (Electronic Throttle Module) obviously has to be cleaned because water got into it. Luckily, labor cost only - SGD 169. (

2) MAF (Mass Air Flow) Sensor has to be replaced. This one damn expensive - SGD 728 for parts and 65 for labor.

3) Air Filter has to be replaced because water got in. Cheap.

4) Spark Plug has to be replaced too. about 200 parts + labor.

5) Intercooler is ok, but need to be removed and reinstalled to replace other parts I think. SGD 327.

Good thing is, the clutch-in seems more smooth after the repair... Anyway, next time, detour whenever seeing flood :)

Wednesday, June 1, 2011

How I fixed my MSI P35 Neo2 FR's problem

I am using a 3 year old MSI P35 Neo2 FR (MSI 7345) motherboard with 4 sticks of 1GB Corsair XMS DDR2-800 RAM. The 7345 started to have problem when all 4 sticks are inserted - I can't remember since when the problem started to surface.

Symptoms include - system hang at "Initializing USB Controller..." during boot-up; IO error after boot loader phase; hanging at Windows start up screen (or during Linux boot-up, showing some ata device IO errors); RAM error during boot-up check (as shown by on-board diagnostic LEDs); disk IO errors after booting into Windows, etc.

The problems seem unpredicatable, and I have spent a lot of time troubleshooting these problems. I went for RMA and replaced my motherboard eventually, but the problems still persist.

In the end, I discovered that once I turn off the Quick Booting option in BIOS, the problems seem gone. Still need to monitor for a bit longer to make sure it is indeed the solution.

And, I shall never buy another MSI board for my next PC.

Sunday, August 29, 2010

HDD partition plan

Intel X25M
sda1 - Windows 7 and WoW

320GB HDD1
sdb1 (30G) - Windows 7 User directory
sdb2 (30G) - Games
sdb5 (80G) - Linux LVM/RAID1 - don't touch
sdb6 (40G) - To convert into NTFS
sdb7 (10G) - RAID volume for Slackware root partition - don't touch
sdb8 (10G) - RAID volume for Ubuntu root partition - keep for now
sdb9 (120G) - Media

320GB HDD2
sdc1 (60G) - Data
sdc5/6/7/8 - same as sdb5-8
sdc9 (120G) - Backup

Sunday, March 28, 2010



Friday, December 4, 2009














Wednesday, November 12, 2008

Removing a RAID partition

To remove a RAID device that consists of 2 partitions (sda7 and sdb7) that has an LVM2 VG on top:
- lvremove to remove all LVs
- vgremove to remove all VGs
- pvremove to remove all PVs
- mdadm --stop to stop the device
- mdadm --remove to remove the device
- mdadm --zero-superblock to erase the md superblock on each of the 2 partitions
- update /etc/mdadm.conf to remove the md device

Migrating /tmp to another partition

I decided to remove the 80G RAID-0 partition in my PC, and migrate the data inside to other LVM partitions. Currently, the partition has 1 LVM2 vg which contains 3 lvs. One of them contains files I downloaded and the other 2 are /tmp filesystems in my Slackware and Ubuntu installations respectively. I simply copied the files in the first lv to another lv (non-RAID LVM). For /tmp filesystems, I did the following steps for each of them:

- Create a new lv (RAID-1 LVM) of 4G. (lvcreate)
- Format it as reiserfs. (mkfs.reiserfs)
- Mount it to a temporary mount point.
- Copy files in /tmp over using rsync -av
- Go to single user mode and unmount /tmp
- Edit /etc/fstab to change /tmp to use the new lv.
- Remount /tmp and go into multi-user mode.

Note: the device to be put into fstab should be /dev/<vg>/<lv>, not /dev/mapper/<vg>-<lv>.

Wednesday, May 14, 2008

Slackware RAID HOWTO 指南 (Chinese Translaction)

Slackware RAID HOWTO
Slackware RAID 指南

Version 1.00

by Amritpal Bath


- Introduction
- Warnings
- Planning
- Setup
- Using the generic kernel
- Troubleshooting
- Appendices
- Acknowledgements/References


This document explains how to install Slackware 12.1 (and beyond) on a
software RAID root filesystem. It is meant to cover only software raid.
If you are using a RAID expansion card, or the RAID functionality that came
with your motherboard, this document will not be useful for you.
本文解释了如何在一个基于软件RAID(廉价磁盘冗余阵列)的根文件系统上安装Slackware 12.1。本文只涵盖软件RAID。如果你使用RAID扩展卡,或者你的主板带有RAID功能,本文将不会对你有帮助。

In order to follow this document, your computer must have two or more empty
hard drives. While it is possible to be creative and create RAID arrays on
drives that already contain data, it can be error prone, so it is not
covered in this document.


If you perform the following instructions on hard drives with data on them,

If you wish to perform these operations on hard drives that hold data of
any importance, you MUST BACKUP YOUR DATA. The procedure below will
destroy all of the data on your hard drives, so any important data will
need to be restored from your backups.


If you don't backup your data and end up losing it, it will be your fault.
There is nothing I can do to help you in that case.

Now, on with the show... :)
好了,我们开始吧... :)


The first step is to determine which RAID level you want to use.

It is recommended that you familiarize yourself with basic RAID concepts,
such as the various RAID levels that are available to you. You can read
about these in various places - consult your favorite search engine about
"raid levels", or see the References section.
建议你先搞清楚RAID的基本概念,比如你可以使用的各个RAID级。你可以在很多地方找到这方面的信息 - 用你喜爱的搜索引擎查一查"raid levels"。或者看本文的“参考书目”一节。

Here's a quick summary of the more common RAID levels:

- RAID 0: Requires 2 drives, can use more. Offers no redundancy, but
improves performance by "striping", or interleaving, data between all
drives. This RAID level does not help protect your data at all.
If you lose one drive, all of your data will be lost.

- RAID 0: 需要两个或者更多的设备。不支持冗余,但“striping",或者说interleaving(数据交替储存?),可以提高读写的性能。这个级别不能够保护你的数据。如果一个设备坏了,你所有的(在这个RAID设备上的)数据都会丢失。

- RAID 1: Requires 2 drives, can use more. Offers data redundancy by
mirroring data across all drives. This RAID level is the simplest way
to protect your data, but is not the most space-efficient method. For
example, if you use 3 drives in a RAID 1 array, you gain redundancy, but
you still have only 1 disk's worth of space available for use.
- RAID 1: 需要两个或者更多的设备。使用数据在各个设备上的镜像来提供冗余。这个级别是最简单的一种保护你的数据的方法。

- RAID 5: Requires 3 drives, can use more. Offers data redundancy by
storing parity data on each drive. Exactly one disk's worth of space
will be used to hold parity data, so while this RAID level is heaviest
on the CPU, it is also the most space efficient way of protecting your
data. For example, if you use 5 drives to create a RAID 5 array, you
will only lose 1 disk's worth of space (unlike RAID 1), so you will
end up with 4 disk's worth of space available for use. While simple to
setup, this level is not quite as straightforward as setting up RAID 1.
- RAID 5: 需要三个或者更多的设备。通过在每个设备上储存的奇偶数据来提供冗余。正好整一个设备大小的空间会用来储存奇偶数据,虽然这个RAID级用最多的CPU,但是他也是最有效率利用存储空间的保护数据的方法。比方说,如果你用5个设备来建立一个RAID 5阵列,你只失去了一个设备大小的空间(不像RAID 1),所以你可以有4个设备大小的空间用来存放数据。虽然设置起来简单,但是这个级别不象设置RAID 1那么容易。


=== Partition hard drives ===

Once you have booted the Slackware installer CD, the first step is to
partition the hard drives that will be used in the RAID array(s).

I will assume that your first RAID hard drive is /dev/sda. If it is
/dev/hda or something similar, adjust the following commands appropriately.

You can see your drives by running: cat /proc/partitions
你可以运行这个来看你的硬盘:cat /proc/partitions

- /boot: RAID 0 and RAID 5 users will require a separate boot partition, as
the computer's BIOS will not understand striped devices. For
simplicity's sake, we will make /boot a small RAID 1 (mirror) array.
This means that in the case of RAID 0, it will not matter which drive
your BIOS attempts to boot, and in the case of RAID 5, losing one drive
will not result in losing your /boot partition.

- /boot: RAID 0 和 RAID 5 的使用者需要一个独立的引导分区,这是因为电脑的BIOS不能识别数据交替储存的设备。为简单起见,我们把/boot做成一个小的RAID 1阵列。这就是说,在RAID 0下面,你的BIOS可以用(这个RAID 1阵列里的)任何一个设备来引导。在RAID 5 下面,失去一个设备不会导致你失去/boot分区。

I recommend at least 30MB for this partition, to give yourself room to
play with multiple kernels in the future, should the need arise. I tend
to use 100MB, so I can put all sorts of bootable images on the partition,
such as MemTest86, for example.

Go ahead and create a small boot partition now on /dev/sda, via cfdisk
(or fdisk, if you prefer).

Ensure that the partition type is Linux RAID Autodetect (type FD).
确保分区类型是Linux RAID Autodetect (type FD)。

- /: Every setup will require a root partition. :) You will likely want to
create a partition takes up most of the rest of the drive. Unless you
are using LVM (not covered in this document), remember to save some space
after this partition for your swap partition! (see below)
- /:每个配置多需要一个根分区。:) 你很可能想要然这个分区占掉硬盘上的大部分空间。除非你用LVM(不在本文范围内),否则记得留些空间给交换分区(见下)!

If you are not creating a swap partition, I recommend leaving 100MB of
unused space at the end of the drive. (see "safety" for explanation)
- 如果你不打算建交换分区,我建议在硬盘的末端留100MB空间。(解释见“安全性”一节)。

Go ahead and create your main partition now on /dev/sda, via cfdisk
(or fdisk, if you prefer).

Ensure that the partition type is Linux RAID Autodetect (type FD).
确保分区类型是Linux RAID Autodetect (type FD)。

- swap: Swap space is where Linux stores data when you're running low on
available RAM. For fairly obvious reasons, building this on RAID 0 could
be painful (if that array develops a bad sector, for example), so I tend
to build swap on RAID 1 as well. If you understand the danger and still
want to build swap on RAID 0 to eke out as much performance as possible,
go for it.
- swap: 交换空间是Linux在内存不够的时候存放数据的地方。显而易见的,把它建在RAID 0上可能会很糟糕(比如说,那个阵列出了一个坏扇区),所以我一般也把它建在RAID 1上。如果你明白其中的危险性,但是还是想把它建在RAID 0上以尽可能多的提升性能,也是可以。

For RAID 1 swap, create a partition that is the exact size that you want
your swap space to be (for example, 2GB, if you can't decide).
对于RAID 1 交换分区,你想要多大,就建一个多大的分区。(如果你不能决定,就放2GB)

For RAID 0 swap (not recommended), create a partition that is equivalent
to the swap size you want, divided by the number of drives that will be
in the array.
对于RAID 1 交换分区,建一个大小为你想要的大小除以设备的数目的分区。

For example, 2GB / 3 drives = 683MB swap partition on /dev/sda.
比如说,2GB / 3个硬盘 = 683MB 交换分区 在/dev/sda上。

Ensure that the partition type is Linux RAID Autodetect (type FD).
确保分区类型是Linux RAID Autodetect (type FD)。

I recommend leaving 100MB of unused space at the end of the drive.
(see "safety" for explanation)

See also: Appendix A - Striping swap space without RAID 0.
又见:附录A - 不用RAID 0来交替储存交换空间。

- safety! I highly recommend leaving 100MB of unpartitioned space at the
end of each drive that will be used in the RAID array(s).
- 安全性!我极力推荐在每个RAID阵列设备的末端留100MB为分区的空间。

In the event that you need to replace one of the drives in the array,
there is no guarantee that the new drive will be exactly the same size as
the drive that you are replacing. For example, even if both drives are
750GB, they may be different revisions or manufacturers, and thus have a
size difference of some small number of megabytes.

This is, however, enough to throw a wrench in your drive-replacement
plans - you cannot replace a failed RAID drive with one of a smaller size,
for obvious reasons. Having that small 100MB buffer just may save your

=== Copy and review partitions ===

Now that /dev/sda is partitioned as appropriate, copy the partitions to all
the other drives to be used in your RAID arrays.

An easy way to do this is:
sfdisk -d /dev/sda | sfdisk /dev/sdb

This will destroy all partitions on /dev/sdb, and replicate /dev/sda's
partition setup onto it.

After this, your partitions should look something like the following:

- RAID 0:
/dev/sda1 30MB /dev/sdb1 30MB
/dev/sda2 100GB /dev/sdb2 100GB
/dev/sda3 2GB /dev/sdb3 2GB

- RAID 1:
/dev/sda1 100GB /dev/sdb1 100GB
/dev/sda2 2GB /dev/sdb2 2GB

- RAID 5:
/dev/sda1 30MB /dev/sdb1 30MB /dev/sdc1 30MB
/dev/sda2 100GB /dev/sdb2 100GB /dev/sdc2 100GB
/dev/sda3 2GB /dev/sdb3 2GB /dev/sdc3 2GB

All partition types should be Linux RAID Autodetect (type fd).
所有分区类型都应该是Linux RAID Autodetect (type FD)。

=== Create RAID arrays ===

Now it's time to create the actual RAID arrays based on the partitions that
were created.

The parameters for each of these RAID commands specifies, in order:
- the RAID device node to create (--create /dev/mdX)
- 要建立的RAID设备节点 (--create /dev/mdX)
- the RAID level to use for this array (--level X)
- 要使用的RAID级 (--level X)
- how many devices (partitions) to use in the array (--raid-devices X)
- 在这个阵列里有多少个设备(分区)(--raid-devices X)
- the actual list of devices (/dev/sdaX /dev/sdbX /dev/sdcX)
- 实际设备列单 (/dev/sdaX /dev/sdbX /dev/sdcX)

Start by creating the RAID array for your root filesystem.

- RAID 0:
mdadm --create /dev/md0 --level 0 --raid-devices 2 \
/dev/sda2 /dev/sdb2

- RAID 1:
mdadm --create /dev/md0 --level 1 --raid-devices 2 \
/dev/sda1 /dev/sdb1

- RAID 5:
mdadm --create /dev/md0 --level 5 --raid-devices 3 \
/dev/sda2 /dev/sdb2 /dev/sdc2

Next, let's create the array for the swap partition. This will be RAID 1
regardless of which RAID level your root filesystem uses, but given our
partition layouts, each command will still be slightly different.
其次,建立交换分区阵列。不论你的根文件系统用哪个RAID级,这个都是RAID 1。但是因为我们不同的分区分布,每个命令还是会有一点不同。

- RAID 0:
mdadm --create /dev/md1 --level 1 --raid-devices 2 \
/dev/sda3 /dev/sdb3

- RAID 1:
mdadm --create /dev/md1 --level 1 --raid-devices 2 \
/dev/sda2 /dev/sdb2

- RAID 5:
mdadm --create /dev/md1 --level 1 --raid-devices 3 \
/dev/sda3 /dev/sdb3 /dev/sdc3

Finally, RAID 0 and RAID 5 users will need to create their /boot array.
RAID 1 users do not need to do this.
最后,RAID 0 和 RAID 5 用户需要建立/boot 阵列。RAID 1用户不需要。

- RAID 0:
mdadm --create /dev/md2 --level 1 --raid-devices 2 \
/dev/sda1 /dev/sdb1

- RAID 5:
mdadm --create /dev/md2 --level 1 --raid-devices 3 \
/dev/sda1 /dev/sdb1 /dev/sdc1

We're all done creating our arrays! Yay!

=== Run Slackware setup ===

First, let's format our swap array, so the installer recognizes it:
mkswap /dev/md1

Now run 'setup' as normal.

When you choose to setup your swap partitions, /dev/md1 will show up.
Continue with this selected.

When asked for the target partition, choose the root array (/dev/md0).

You may choose the format method and filesystem of your choice.

RAID 0 and RAID 5 users must also setup /boot. When asked about setting up
extra partitions, choose /dev/md2. When asked where to mount this device,
enter "/boot".
RAID 0 和 RAID 5 用户必须设置/boot。当然你设置额外的分区时,选/dev/md2。当问你挂载到哪里时,输入/boot。

After this, continue installation as normal.

For LILO configuration:
- When asked about LILO, choose the "simple" setup.
- When asked about additional "append=" parameters, RAID 0 and
RAID 5 users should type in "root=/dev/md0", to ensure that the proper
array is mounted on / at bootup.
- When asked about where to install LILO, choose MBR.
- 当问你LILO设置时,选“simple”设置。
- 当问你附加的"append="参数时,RAID 0 和 RAID 5 用户要输入"root=/dev/md0" 以确保引导时正确的阵列会被挂载到/上。
- 当问你把LILO安装到哪里时,选MBR。

You may see some warnings scroll by. This is OK.

=== Finishing touches ===

After exiting the installer, we have just a few settings to tweak.

Start by switching into your actual installation directory:
- chroot /mnt

Let's make sure LILO boots from the RAID arrays properly. Using your
favorite editor (vim/nano/pico), edit /etc/lilo.conf:
- add a new line (add it anywhere, but don't indent it):
- 加入一行(随便哪里,但是不要缩进):
raid-extra-boot = mbr-only
- You will need to change the following line:
- 修改这一行:
boot =
RAID 0 and RAID 5 users, change it to:
RAID 0 和 RAID 5 用户改成:
boot = /dev/md2
RAID 1 users, change it to:
RAID 1 用户改成:
boot = /dev/md0

- Save the file and exit your editor.
- 保存文件,推出编辑器。
- run "lilo".
- 运行“lilo”。

When that's done, let's exit the installation and reboot:
- exit
- reboot


Using the generic kernel

The official Slackware recommendation is to switch to the "generic"
Slackware kernel after installation has been completed. If you wish to use
the generic kernel, you must create an initrd. This section gives a quick
example of booting a RAID system in this fashion.

If you require more information on initrds, please read /boot/README.initrd.

Typically, a user switches to a generic kernel by booting the system, and
afterwards running the following:
- cd /boot
- rm vmlinuz config
- ln -s vmlinuz-generic-smp-* vmlinuz
- ln -s*
- ln -s config-generic-smp-* config

Don't run lilo yet, we'll do that soon.

Next, edit (create, if necessary) /etc/mkinitrd.conf and add:
其次,编辑(如有必要,创建)/etc/mkinitrd.conf 并加入:

Obviously, this assumes that you are using the EXT3 filesystem. If you are
using another filesystem, adjust the module appropriately (reiserfs or xfs,
for example). If you wish to read more about the MODULE_LIST variable,
consult "man mkinitrd.conf".
显然,这里假设你用EXT3文件系统。如果你用其他的文件系统,适当修改模块行(比如reiserfs,xfs)。如果你要了解更多关于MODULE_LIST变量,参考"man mkinitrd.conf"。

Note: If the module for your hard drive controller is not compiled into the
generic kernel, you will want to add that module to the MODULE_LIST variable
in mkinitrd.conf. For example, my controller requires the mptspi module, so
my /etc/mkinitrd.conf looks like:

We're almost done.

Edit /etc/lilo.conf, and find the line at the very end that says:
image = /boot/vmlinuz

Add a new line after it that says:
initrd = /boot/initrd.gz

In this case, be sure to indent the line you've added!

Next, create the initrd based on the config file created earlier.
mkinitrd -F

Finally, run "lilo" to make the new settings take effect, give yourself a
pat on the back, and reboot your finished system. :)


Any number of typos can result in a system that does not boot on its own,
but all is not lost. Put the rubber chicken and the lemon away...
无论多少的打字错误都可能导致你的系统不能启动。不过这并不意味着全完了。(下一句不会 :P)

Booting your Slackware media (DVD, for example) can make it very easy to
switch into your installed system and make repairs:

- Boot Slackware CD/DVD.
- 启动Slackware CD/DVD。
- Login to installer as normal.
- 如常登录进安装程序。
- Scan for, and then assemble the RAID arrays:
- 扫描并组装RAID阵列:
mdadm -Es > /etc/mdadm.conf
mdadm -As
- Mount root partition:
- 挂载根分区:
mount /dev/md0 /mnt
- Switch to installed OS:
- 切换到安装好的系统:
chroot /mnt
- Mount remaining filesystems:
- 挂载其他的文件系统:
mount /boot (RAID 0 and RAID 5 users only)
mount /proc
mount sys /sys -t sysfs

At this point, you can bring up your favorite editor, tweak config files,
re-run mkinitrd/lilo/etc as you wish, or anything else you need to do to
make your system bootable again.
When you're finished making your changes, rebooting is simple:
- cd /
- umount boot proc sys
- exit
- reboot

If you are having issues that you're unable to resolve, shoot me an email.
Perhaps the answer will make it into this section. :)


=== Appendix A: Striping swap space without RAID 0 ===
附录A:不用RAID 0来交替储存交换空间

For completeness' sake, I should mention that swap space can be striped to
improve performance without creating a RAID 0 array.
为了完整性,我应该阐明不需要RAID 0阵列也可以做到交替储存交换空间。

To accomplish this, start by forgetting about any instructions having to do
with /dev/md1, which would be our swap array - create the swap partitions on
the hard drives, but do not create this particular array.
为了做到这点,先不要管关于/dev/md1(我们的交换阵列)的指令 - 在硬盘上建立交换分区,但是不要建立这个阵列。

When creating the swap partitions, ensure that the partition type is set to
Linux Swap (type 82).
当建立交换分区时,确保分区类型是Linux Swap (type 82)。

During setup, the installer will recognize the swap partitions. Ensure that
all of them are selected, and continue as normal.

After installation is complete, go ahead and boot your system - we can
finish this once the system is booted, in the interest of simplicity.
安装完成后,重启系统 - 重启后我们就可以完成安装了。

When the system boots, edit /etc/fstab with your favorite editor. Find the
lines that describe your swap partitions - they say "swap" in the second
系统启动后,编辑/etc/fstab。找到描述你的交换分区的那些行 - 第二列是"swap"的哪些。

Each of these lines says "default" in the fourth column. Simply change that
to "default,pri=0" for each line.

After saving the file, either reboot, or simply run:
swapoff -a
swapon -a

To confirm that the setting has taken effect, you can run:
swapon -s

Verify that the Priority column reads 0 for each partition, and we're done!


- In depth explanation of RAID levels:
"LasCon Storage - Different types of RAID"

- Thanks to John Jenkins (mrgoblin) for some tips in:
"Installing with Raid on Slackware 12.0+"

- Thanks to Karl Magnus Kolst?(karlmag) for his original writeup on
Slackware and RAID, ages ago!
RAID level 0 DEVICE"

- Of course, thanks to Patrick "The Man" Volkerding for creating Slackware!

- Also thanks to the rest of the guys that proofread, tested, and suggested!
Eric Hameleers (alienBOB), Robby Workman, Alan Hicks,
Piter Punk, Erik Jan Tromp (alphageek)...

- My contact info:
Primary email:
Secondary email:
On certain IRC networks: "amrit" (or some variation :) )

- This latest version of this document can be found at:

Sunday, May 11, 2008



Friday, May 9, 2008

Slackware 12.0 to 12.1 Upgrade HOWTO Chinese Translation

Slackware 12.0 to 12.1 Upgrade HOWTO
Slackware 12.0 到 12.1 升级指南

This document explains how to upgrade from Slackware 12.0 to Slackware 12.1.
这篇文章是Slackware 12.0 到 12.1的升级说明。

For details of important changes from Slackware 12.0 to 12.1, see the file
'CHANGES_AND_HINTS.TXT'. Thanks to Robby Workman for help with this.
关于从Slackware 12.0 到 12.1的重大变化,请参考CHANGES_AND_HINTS.TXT。感谢Robby Workman在这上的帮助。

Before you begin, I would strongly recommend making a backup of your
system, or, if not the entire system, at least the /etc directory. You
might find that you need to refer to a few things after the upgrade
process is complete. Back it up, or take your chances.

OK, now that everything is safely backed up, let's proceed. :-)

To do this, you'll need the Slackware 12.1 packages. If these are on a CD,
create a new directory to mount the CD on so that it doesn't get in the way
during the upgrade:
升级需要Slackware 12.1 的软件包。如果它们在CD上,建一个新目录来挂载CD,以免它们在升级过程中碍事。

mkdir /packages
mount /dev/cdrom /packages

The packages don't have to be on a CD-ROM, as an alternative you could
copy the slackware directory (the one with the various package
subdirectories in it, basically the "slackware" directory from the install
CD) to someplace like /root/slackware/. The important thing is that you
know where the slackware packages directory is. We'll use /root/slackware
in the following examples.

0. Put your machine in single-user mode:
0. 让你的机器进单用户模式:
telinit 1

1. Upgrade your glibc shared libraries. This is important, or things
might go haywire during the first part of the upgrade:
1. 升级glibc共享库。这很重要。不然的话第一部分的升级会搞糟:
upgradepkg /root/slackware/a/glibc-solibs-*.tgz

2. Upgrade your package utilities:
2. 升级软件包管理工具:
upgradepkg /root/slackware/a/pkgtools-*.tgz

3. Upgrade everything else (and install new packages):
3. 升级其他所有的软件包 (包括安装新的软件包):
upgradepkg --install-new /root/slackware/*/*.tgz

If you wish to upgrade everything except for the KDEI language
packs for KDE (these take a lot of space and can be dealt with
after the main upgrade more quickly and easily), running this
script in the "slackware" directory will do the trick:

for dir in a ap d e f k kde l n t tcl x xap y ; do
( cd $dir ; upgradepkg --install-new *.tgz )

4. Make sure your system will boot. First, be sure your initrd is up
to date (if you use one). If you use LILO, make sure the paths in
/etc/lilo.conf point to a valid kernel and then type 'lilo' to
reinstall LILO. If you use a USB memory stick to boot, be sure to
copy the new kernel to it in place of the old one.
4. 确保你的系统可以引导进slackware。首先,确定你的initrd是最新的。如果你用LILO, 确保/etc/lilo.conf里的路径都指向有效的内核,然后打'lilo'重新安装LILO到引导区。如果你用USB闪存来引导,一定要把新内核拷贝过去覆盖旧的。

5. Remove obsolete packages. The CHANGES_AND_HINTS.TXT file should have a
list of these. You may also wish to go into /var/log/packages and take
a look at the package list:
5. 卸载已废弃的软件包。CHANGES_AND_HINTS.TXT里有一个列单。你也可以到/var/log/packages看一看:
ls -lt | less

You may spot some old, obsolete, or discontinued packages. If so,
you can remove these using 'removepkg'.

6. Fix your config files. Some of the config files in /etc are going to
need your attention. You'll find the new incoming config files on
your system with the ".new" extension. You may need to fill these in
with information from your old config files and then move them over.
6. 修正你的配置文件。需要注意/etc目录下的一些配置文件。新安装的配置文件以".new"为扩展名。你需要把旧的配置文件里的东西移到新的里面。

Feel brave? You can use this little script to install all of the
.new config files in /etc. If you've made any local changes you'll
need to add them to the newly installed files. Your old config files
will be copied to *.bak. Anyway, it might be an easier starting
point. Here it is:

cd /etc
find . -name "*.new" | while read configfile ; do
if [ ! "$configfile" = "./rc.d/" \
-a ! "$configfile" = "./" \
-a ! "$configfile" = "./" \
-a ! "$configfile" = "./" ]; then
cp -a $(echo $configfile | rev | cut -f 2- -d . | rev) \
$(echo $configfile | rev | cut -f 2- -d . | rev).bak 2> /dev/null
mv $configfile $(echo $configfile | rev | cut -f 2- -d . | rev)

7. If you use a non-en_US language pack for KDE and you already have it
installed, then you may upgrade it by moving into the slackware/kdei
directory and using this command:
7. 如果你已经安装使用了非美国英语的KDE语言包的话,可以进入slackware/kdei目录用下面这个命令升级它:
upgradepkg --install-new k**tgz

To have upgradepkg cycle through all of the available packages, and
see which ones need to be upgraded, use this in slakckare/kdei:
upgradepkg *tgz

If your language has been added to KDE since Slackware 12.0, you'll
need to install it using installpkg, or upgradepkg --install-new.
如果你的语言是Slackware 12.0后才加入的。你要用installpkg,或者upgradepkg --install-new来安装它。
Typically you'll need to make sure that you have installed the
slackware/kdei packages for kde, koffice, and k3b (if you use those).
通常你要保证安装了kde, koffice, 和k3b的语言包(如果你有用它们的话)。

8. Return to multi-user mode:
8. 回到多用户模式:
telinit 3

At this point you should be running Slackware 12.1. :-)
到这里有已经在运行Slackware 12.1了 :-)
I wish everyone good luck with this!

Patrick Volkerding

Sunday, May 4, 2008

Making initrd for Slackware 12.1 generic-smp kernel

Root Device: /dev/md0 (RAID-1)
Root FS: ext3

mkinitrd -c -k -m ext3 -f ext3 -R
add "-L" if LVM support is required.

Saturday, May 3, 2008

Extenting a Logical Volume (non-RAID)

Create a new partition. e.g. /dev/sda9. Set the partition type to 8E (Linux LVM)
May need to reboot.
pvcreate /dev/sda9
vgextend datastore_vg0 /dev/sda9
lvextend -L80G /dev/datastore_vg0/download #80G is the target total size, not incremental size
resize_reiserfs -f /dev/datastore_vg0/download

Thursday, May 1, 2008

Buring Files bigger than 4GB to DVD

Update2 (5 May 2009) - The issue below is fixed in k3b 1.63 (r948463) in slackware current and cdrtools-2.01.01a57.

Update - Issue: The DVDs burnt using K3B (and cdrtools) cannot be mounted with appropriate permissions using type udf. The permission is "d---------" when mounted. Mounting as iso9660 gives right permission.

After some trying, I finally managed to burn files bigger than 4GB to DVDs.

Required software:
cdrtools-2.01.01a38-i486-1 or later
k3b-1.0.4-i486-3 or later

From k3b 1.0.4 Annoucement:
K3b now silently allows the burning of files bigger than 4 GB if an appropriate version of genisoimage or mkisofs is installed ("silently" means that I did not introduce any new messages)

Before start burning DVD, change the Filesystem Settings as follows: (see screenshot below)

- Check "Generate UDF structures"
- Select "Level 3" under "ISO Level"

Note if the settings are not appropriate, k3b will still go ahead to burn the DVD, but happily leave out the file that is more than 4GB and close the DVD, effectively wasting the DVD.

Wednesday, March 5, 2008

Grub menu.lst

# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default 0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 15

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)

# Pretty colours
color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

# examples
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro

# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=1b579cb2-4e7b-4e97-8536-88595be8fb64 ro

## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,5)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash

## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## ## End Default Options ##


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title Microsoft Windows XP Professional
root (hd0,0)
chainloader +1

# Slackware 12.0 Huge SMP
title Slackware 12.0 Huge SMP
root (hd0,6)
kernel /boot/vmlinuz root=/dev/md0 ro vga=773
#initrd /boot/initrd.gz

# Slackware 12.0 Generic SMP
#title Slackware 12.0 Generic SMP
#root (hd0,6)
#kernel /boot/vmlinuz-generic-smp- root=/dev/md0 ro vga=773
#initrd /boot/initrd.gz

title Ubuntu 8.04, kernel 2.6.24-16-generic
root (hd0,7)
kernel /boot/vmlinuz-2.6.24-16-generic root=/dev/md3 ro quiet splash
initrd /boot/initrd.img-2.6.24-16-generic

title Ubuntu 8.04, kernel 2.6.22-14-generic
root (hd0,7)
kernel /boot/vmlinuz-2.6.22-14-generic root=/dev/md3 ro quiet splash
initrd /boot/initrd.img-2.6.22-14-generic

title Ubuntu 8.04, kernel 2.6.22-14-generic (recovery mode)
root (hd0,7)
kernel /boot/vmlinuz-2.6.22-14-generic root=/dev/md3 ro single
initrd /boot/initrd.img-2.6.22-14-generic

Thursday, August 23, 2007

Custom Font Config

<?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd">

default settings for all fonts.
<match target="font" >
<edit mode="assign" name="rgba" >
<match target="font" >
<edit mode="assign" name="hinting" >
<match target="font" >
<edit mode="assign" name="hintstyle" >
<match target="font" >
<edit mode="assign" name="antialias" >

<!-- disable anti-alias for 8-17 size fonts -->
<match target="font" >

<test compare="contains" name="lang" qual="any">

<test compare="more_eq" name="pixelsize" qual="any" >
<test compare="less_eq" name="pixelsize" qual="any" >
<edit mode="assign" name="antialias" >

<!-- the space between English fonts is too wide,solve this problem -->
<match target="font">

<test name="lang" compare="contains" qual="any">
<edit name="spacing">
<edit name="globaladvance">

define the smallest size of Chinese fonts
<match target="font" >
<test name="family" qual="any" >
<string>AR PL ShanHeiSun Uni</string>
<string>AR PL ZenKai Uni</string>
<string>AR PL New Sung</string>
<test compare="more_eq" name="pixelsize" >
<test compare="less_eq" name="pixelsize" >
<edit compare="eq" name="pixelsize" >
sort the family of "serif ,sans,monospace",make it fit to Chinese people
<family>Times New Roman</family>
<family>Liberation Serif</family>
<family>Nimbus Roman No9 L</family>
<family>Luxi Serif</family>
<family>Bitstream Vera Serif</family>
<family>DejaVu Serif</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL ShanHeiSun Uni</family>
<family>AR PL ZenKai Uni</family>
<family>AR PL New Sung</family>
<family>Liberation Sans</family>
<family>Bitstream Vera Sans</family>
<family>DejaVu Sans</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL ShanHeiSun Uni</family>
<family>AR PL ZenKai Uni</family>
<family>Courier New</family>
<family>Liberation Mono</family>
<family>Luxi Mono</family>
<family>Andale Mono</family>
<family>Bitstream Vera Sans Mono</family>
<family>Nimbus Mono L</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL ShanHeiSun Uni</family>
<family>AR PL ZenKai Uni</family>
<family>Courier New</family>
<family>Courier New</family>
<family>Liberation Mono</family>
<family>Bitstream Vera Sans Mono</family>
<family>Nimbus Mono L</family>
<family>Luxi Mono</family>
<family>Andale Mono</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL ShanHeiSun Uni</family>
<family>AR PL ZenKai Uni</family>

Sunday, August 5, 2007

Enabling DRI for Intel 945G/GMA950

Update for Slackware 12.1
In Slackware 12.1, don't have to do all the changes in xorg.conf, except setting the driver to the right one (mine is "intel").

However, I observed some slowness in firefox in 12.1. After setting the following option for the intel driver, the problem goes away. Seems it is caused by the new acceleration method EXA, which is the default.

Option "AccelMethod" "XAA"

xorg的i810(或者新的intel)驱动支持945G/GMA950. 实际上,i810驱动支持所有这些intel chipset:
i810, i810-DC100, i810e, i815, 830M, 845G, 852GM, 855GM, 865G, 915G, 915GM, 945G, 945GM
虽然man page里只提到915G和915GM。可以man i810看具体情况.

关键就是打开DRI. 我参照了以下文章。


1. 我确定了我的内核(Slackware 12.0缺省huge smp内核)有Intel i810及以后芯片组的AGPGART和DRM的支持。

2. 我发现要在X里打开DRI.

编辑 xorg.conf
Section "Module"
# This loads the DRI module 载入DRI模块
Load "dri"

# This loads the GLX module 载入GLX模块
Load "glx"
# 建一个用i810驱动的设备
Section "Device"
Identifier "i810"
Driver "i810"
# Alternative to Load "dri" 这个Option与Load "dri"等效
# Option "DRI" "true"
# 使用i810设备
Section "Screen"
Identifier "Screen 1"
Device "i810"
Monitor "Samsung 710N"

# 让普通用户也可以使用DRI. 如果没有这个,只有root可以用。
Section "DRI"
Mode 0666

x@slackx:~$ glxinfo
name of display: :0.0
display: :0 screen: 0
direct rendering: No
server glx vendor string: SGI

x@slackx:~$ glxgears
4246 frames in 5.1 seconds = 840.647 FPS
4200 frames in 5.0 seconds = 835.972 FPS
4605 frames in 5.1 seconds = 901.136 FPS
4920 frames in 5.1 seconds = 961.904 FPS
5160 frames in 5.0 seconds = 1027.514 FPS
5160 frames in 5.0 seconds = 1027.391 FPS
5160 frames in 5.0 seconds = 1028.289 FPS
5160 frames in 5.0 seconds = 1028.484 FPS
5160 frames in 5.0 seconds = 1027.678 FPS
5173 frames in 5.0 seconds = 1027.146 FPS

x@slackx:~$ glxinfo
name of display: :0.0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: SGI

x@slackx:~$ glxgears
7591 frames in 5.0 seconds = 1518.076 FPS
7774 frames in 5.0 seconds = 1554.788 FPS
17984 frames in 5.0 seconds = 3596.714 FPS
17536 frames in 5.0 seconds = 3507.012 FPS
17372 frames in 5.0 seconds = 3474.314 FPS
18021 frames in 5.0 seconds = 3604.041 FPS

Saturday, August 4, 2007

转载:让 xterm 与其它程序间复制粘贴更灵活

在 TERM 中选中文字“甲”,需鼠标中键贴入其它程序(如 firefox ),而此时在 firefox 里选中文字“乙”并不 Ctrl-c ,再用鼠标中键贴出,发现贴出“乙”,而“甲”不见了。

需要效果:在 TERM 中选中即可 Ctrl-v 贴入 firefox 一类的程序中,无需鼠标中键。而在 firefox 一类的程序中 Ctrl-c 复制后,鼠标不论再选中什么,在 TERM 中 Shift-Insert 出的依然是 Ctrl-c 的内容

在 Xwindow 里有一个选中缓冲(PRIMARY)和一个剪贴板(CLIPBOARD)
几乎除了 TERM 程序以外,没有还在用选中缓冲的程序
造成 TERM 中选中的,需要鼠标中键才能贴到其它程序里。在贴之前,在其它程序中还不能选中任何东西,一旦选中,选中缓冲就被刷新

a) xterm 功能强大,本身就带剪贴板功能,如下配置即可
在 $HOME/.Xresources 里如下写,可让 xterm 的复制进入剪贴板,不再过选中缓中

*VT100*translations: #override \n\
Shift Insert:insert-selection(CLIPBOARD, CUT_BUFFER1) \n\
~Shift~Ctrl: insert-selection(CLIPBOARD, CUT_BUFFER1) \n\
~Shift: select-end(CLIPBOARD, CUT_BUFFER1)

前两句是说当 Shift-Insert 与鼠标中键(Btn2UP)效果是贴出剪贴板内容
第三句是说当 鼠标左键(BtnUP)效果是复制给剪贴板

这样一来,在 firefox 中任意选中的文字(不 Ctrl-c ),不管是 Shift-Insert 还是鼠标中键都复制不出来了

*VT100*translations: #override \n\
Shift Insert:insert-selection(CLIPBOARD, CUT_BUFFER1) \n\
~Shift~Ctrl: insert-selection(PRIMARY, CUT_BUFFER0) \n\
~Shift: select-end(CLIPBOARD, CUT_BUFFER1) \n\
~Shift: select-end(PRIMARY, CUT_BUFFER0)

这样就让在 firefox 里随意选中的文字,鼠标中键可贴在 TERM 中,而 Ctrl-c 的内容由 Shift-Insert 贴出

b) rxvt, aterm, mrxvt, rxvt-unicode 系列,需要一点小修改
这一系列都是基于 rxvt 的,代码相近,下面以 rxvt-unicode 为例:

vi rxvt-unicode-8.1/src/screen.C
2895 行:
if (selnum == Sel_Primary)
sel = xa[XA_CLIPBOARD];
else if (selnum == Sel_Secondary)

XSetSelectionOwner (dpy, xa[XA_CLIPBOARD], vt, tm);
if (XGetSelectionOwner (dpy, xa[XA_CLIPBOARD]) == vt)


Setting up Chinese in Slackware 12

Update: With Slackware 12.1, Chinese display works out-of-the-box with 文泉驿 (WenQuanYi) 正黑 font. IME packages like scim, skim and a lot more are included in 12.1, Chinese (and other language) input can be enabled easily by following instructions in CHANGES_AND_HINTS.TXT in the distribution.

- Allow displaying of Chinese characters in UTF-8 encoding while still having the normal English user interface.
- Allow inputing of Chinese characters using SCIM.

Slackware 12.0 full installation, default huge smp kernel.
文泉驿 (WenQuanYi) Bitmap Song font 0.8.1
scim 1.4.7, scim-pinyin-0.5.91, skim-1.4.5

Get 文泉驿 (WenQuanYi) Bitmap Song font from I use the PCF format of current version 0.8.1. Follow the instructions included in the downloaded file (run mkfontdir, vc-cache, etc). I copied all the pcf files into /usr/share/fonts/ folder, so that no change to /etc/X11/xorg.conf and /etc/fonts/fonts.conf is required. You can also copy the file 85-wqy-bitmapsong.conf into /etc/fonts/conf.avail/ and created a link in /etc/fonts/conf.d/, as suggested by the installation instructions but with slight variation in directory names. However, this config file will force WenQuanYi to be the chosen for all kinds of font requests, and make your English contents ugly. So if you want beautiful English fonts, don't use this one, and do your own font config instead.

As I still want to use English as my primary desktop language, I leave the LC_* environment variables untouched, and only changed LC_CTYPE=zh_CN.UTF-8 in my ~/.profile. (Note: I tried en_US.utf8 but it does not work, as all KDE applications will show squares for Chinese characters. This means fontconfig does not pick WenQuanYi font. I guess the reason is because WenQuanYi Bitmap Song font's lang attribute does not have "en" in the list so it does not get matched. )

After that restart X.

Download and compile scim, scim-pinyin, and skim, using root.
scim 1.4.7
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make -j3
make instal DESTDIR=/your/dest
makepkg scim-1.4.7-i686-1xc.tgz

scim-pinyin 0.5.91
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make -j3
make instal DESTDIR=/your/dest
makepkg scim-pinyin-0.5.91-i686-1xc.tgz
installpkg scim-pinyin-0.5.91-i686-1xc.tgz

skim 1.4.5
scons configure prefix=/usr
scons -j3
mkdir -p /usr/lib/pkgconfig
cp skim.pc /usr/lib/pkgconfig/
scons install DESTDIR=/your/dest
makepkg skim-1.4.5-i686-1xc.tgz

I also added the following lines to .profile:
export XIM=SCIM

After that restart X.