How to delete immutable files

After fsck for an office box, there exists some IMMUTABLE files. The files cannot be deleted, modified even I am super-user. Asking for help with ZMX (our friend), the reference is useful: Make your files immutable which even root can’t delete. The reason is the attribute of files are setup  as immutable and with owner/group misplaced.

The command to make the file mutable: # chattr -i {files}, and it can be deleted. If some files still cannot be deleted, the final strategy is to remove ALL of its attributes. Just run # chattr -AacDdijsSu {files}, and everything works. Enjoy it. 🙂

Create soft-raid with raidtools on RedHat 9

Because I’m familiar with mdadm, that I should write the note with raidtools as log. With the reference: The Software-RAID HOWTO: RAID setup, the step for raid-0 is listing:

1. Format the prepared disk, for example sdc and sdd, with whole disk for a partition:

1
2
# fdisk /dev/sdc
# fdisk /dev/sdd

2. Setup /etc/raidtab for md0 with 2 disk:

1
2
3
4
5
6
7
8
9
raiddev /dev/md0
raid-level 0
nr-raid-disks 2
chunk-size 32
persistent-superblock 1
device /dev/sdc1
raid-disk 0
device /dev/sdd1
raid-disk 1

3. Create the raid disk: # mkraid /dev/md0

4. Format the raid disk:# fdisk /dev/md0

5. Make a journal system (eg: ext3): # mke2fs -j /dev/md0

OK, that’s all. Enjoy it. 🙂

Mysql CONCAT fields between char type and number type with JDBC

In the issue, if we concat a char field with Chinese characters and a number filed directly in JDBC’s sql query, the result returned by JDBC may lead Chinese words to be ‘blocked’ (which means the charset of the words is wrong). For some tries, the issue is due to the charset of number seems ISO-8859-1 but the charset of Chinese words are UTF8. And the solution is convert the words via cast function in SQL:

1
SELECT CONCAT( CHAR_FIELD, CAST( NUMBER_FIELD AS CHAR ) ) AS T ...

whereas the dispaly is correct. Enjoy it. 🙂

Partially to make rtl8192se works with kernel 3.0

My laptop is Lenovo X201 with a RTL8191SEvB wireless card. In kernel 2.6.3x version, I’ve to install the rtl8192se and rtl8192se-firmware packages to make it works. In the previous settings, the module named r8192se_pci and with a parameter hwwep=0 can led to a stable network connection no matter my gentoo or ubuntu box.

But the nightmare comes back when I upgrade to kernel-3.0.x with built-in rtl8192se modules in rtlwifi catalog. The issues are:
1) Network connection are hard to established and will disconnected dynamically itself.
2) My ad-hoc connection shared by Windows cannot be established.
3) And so on.

The symptoms of the issues are: the configurations via ifconfig, iwconfig even route are all CORRECTLY, but I still CANNOT ping the default gateway.

But now I found a PARTIAL solution. That is, to set a new parameter swenc=1 to make the module use software encryption rather than hardware one, which similar the old hwwep=0 with r8192se_pci modules.

To make it set on loaded, adding a configuration file via:
echo "options rtl8192se swenc=1" > /etc/modprobe.d/rtl8192se.conf

If you encounter the same problem with rtl8192se driver on RTL8191SEvB card, Try it. 🙂

[20111114 edit] From the forum, the developer suggest me to install iw and set the CRDA for the wirless card. After I try # iw reg set TW, my network connection in Ubuntu more stable. Maybe this is another trick, too.

Make cpufreqd work as module in Gentoo

I’m using the default setting via genkernel to build my box. But the cpufreqd always shown it cannot be start-up without the kernel config CONFIG_CPU_FREQ.

But the weird thing is: I’ve selected the CPU_FREQ* settings in my kernel and there are corresponding modules in /lib/modules/<kernel version>:/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_TABLE=m
CONFIG_CPU_FREQ_STAT=m
CONFIG_CPU_FREQ_STAT_DETAILS=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=m
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=m
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
...

Finally, I found the reason: the modules (also the government settings) not be auto-loaded when booting. So I append the configuration for module auto-load for gentoo and everything works fine.

1. The final kernel configuration, I’ve change the default government setting from performance to userspace which make me can choose the speed I want:

1
2
3
4
5
6
7
8
9
10
11
12
13
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_TABLE=m
CONFIG_CPU_FREQ_STAT=m
CONFIG_CPU_FREQ_STAT_DETAILS=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=m
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=m
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m

2. The auto-load module settings in gentoo (/etc/conf.d/module):

1
modules_3_0="acpi-cpufreq cpufreq_ondemand cpufreq_powersave cpufreq_conservative"

Which will load the INTEL’s CPUFREQ driver (acpi-cpufreq) and the governments.
Note: The governments which is loaded can be used in the programs (eg: Gnome’s CPU Frequency Scaling Monitor).
Note: the modules should be set AT LEAST major AND minor number of kernel (eg: 3.0 as 3_0) or it cannot be parsed.

Finally, everything works fine. Enjoy it. 🙂

GRUB settings of booting from usb disk with genkernel on Gentoo

I’ve tried to use genkernel to build my gentoo box recent days. But I cannot boot correctly via an installation with external USB disk (My gentoo box is on an external USB 2.5″ disk).

The default GRUB settings for genkernel user is:

1
2
3
4
title Gentoo Linux 2.6.34-r1
root (hd0,0)
kernel /boot/kernel-genkernel-x86-2.6.34-gentoo-r1 real_root=/dev/sda3
initrd /boot/initramfs-genkernel-x86-2.6.34-gentoo-r1

But with this configuration, the boot procedure will stop at there is not correct root sector can be loaded. That’s because the usb is slower o be configured than my laptop’s disks. And on the other hand, the waitroot, doslowusb, and so on additional configurations cannot be passed to a genkernal-ed source.

For some tries and referenced configurations on other linux distribution, the works setting is to use UUID (UUID=….) rather than aliased device name (dev/$ROOT). The correct settings:

1
2
3
4
title Gentoo Linux 2.6.34-r1
root (hd0,0)
kernel /boot/kernel-genkernel-x86-2.6.34-gentoo-r1 real_root=UUID=....
initrd /boot/initramfs-genkernel-x86-2.6.34-gentoo-r1

The UUID for devices can be found in your /etc/fstab if you also use genkernel. Finally, my USB gentoo works fine. Enjoy it. 🙂