Monday, April 27, 2009

Using WPA2 with Intel Wireless LAN 2100

My thinkpad X31 has a Intel(R) PRO/Wireless LAN 2100 3B Mini PCI Adapter and according to this product brief, it is Wi-Fi CERTIFIED for WPA although it's a IEEE 802.11b card.

I upgraded its Windows driver to the latest version 1.2.5.37 and the Intel PROSet software to 7.1.47 as found on this intel download page. Afterwards, I can choose WPA2-Personal as security mode and AES-CCMP as encryptionn algorithm in the PROSet software as shown in the screenshot below.

Saturday, April 25, 2009

Saving power with Linux

  1. Install cpufrequtils in Mandriva
    urpmi cpufrequtils

    lsmod | grep cpufreq_ondemand
    if nothing shows up, run
    modprobe cpufreq_ondemand

    echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

    echo ondemand > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
    echo 1 > /sys/devices/system/cpu/sched_mc_power_savings
    echo hpet > /sys/devices/system/clocksource/clocksource0/current_clocksource
    echo 5 > /proc/sys/vm/laptop_mode
    echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
    echo min_power > /sys/class/scsi_host/host0/link_power_management_policy


    powertop


  2. cpufreq-info for Pentium-4 2.4C CPU after modprobe p4_clockmod:
    cpufrequtils 003: cpufreq-info (C) Dominik Brodowski 2004-2006
    Report errors and bugs to cpufreq@lists.linux.org.uk, please.
    analyzing CPU 0:
    driver: p4-clockmod
    CPUs which need to switch frequency at the same time: 0
    hardware limits: 300 MHz - 2.40 GHz
    available frequency steps: 300 MHz, 600 MHz, 900 MHz, 1.20 GHz, 1.50 GHz, 1.80 GHz, 2.10 GHz, 2.40 GHz
    available cpufreq governors: ondemand, conservative, powersave, userspace, performance
    current policy: frequency should be within 300 MHz and 2.40 GHz.
    The governor "performance" may decide which speed to use
    within this range.
    current CPU frequency is 2.40 GHz (asserted by call to hardware)
  3. cpufreq-info for Celeron E1400 CPU after modprobe acpi-cpufreq:
    cpufrequtils 005: cpufreq-info (C) Dominik Brodowski 2004-2006
    Report errors and bugs to cpufreq@vger.kernel.org, please.
    analyzing CPU 0:
    driver: acpi-cpufreq
    CPUs which need to switch frequency at the same time: 0
    hardware limits: 1.20 GHz - 2.00 GHz
    available frequency steps: 2.00 GHz, 1.60 GHz, 1.20 GHz
    available cpufreq governors: ondemand, conservative, powersave, userspace, performance
    current policy: frequency should be within 1.20 GHz and 2.00 GHz.
    The governor "ondemand" may decide which speed to use
    within this range.
    current CPU frequency is 1.20 GHz (asserted by call to hardware).
    cpufreq stats: 2.00 GHz:0.00%, 1.60 GHz:0.00%, 1.20 GHz:0.00% (1)
    analyzing CPU 1:
    driver: acpi-cpufreq
    CPUs which need to switch frequency at the same time: 1
    hardware limits: 1.20 GHz - 2.00 GHz
    available frequency steps: 2.00 GHz, 1.60 GHz, 1.20 GHz
    available cpufreq governors: ondemand, conservative, powersave, userspace, performance
    current policy: frequency should be within 1.20 GHz and 2.00 GHz.
    The governor "ondemand" may decide which speed to use
    within this range.
    current CPU frequency is 1.20 GHz (asserted by call to hardware).
    cpufreq stats: 2.00 GHz:0.00%, 1.60 GHz:0.00%, 1.20 GHz:0.00% (11)


    However, I noticed that with my 2.6.29.1-server-4mnb kernel, changing the governor among ondemand, powersave and performance doesn't change the total idle power consumption of my PC measured from the wall outlet. The figure (48W) never changes no matter whether the P-state of the E1400 is at 2GHz or 1.2 GHz. I guess it's probably because the CPU is put into C1E state during idle regardless of the P-state.

    I further noticed from this Japanese website (translated by Google), that the power consumption of the E1400 may be reduced by 4W if its core VID is dropped from 1.30V to 1.05V.

    I recompiled the acpi-cpufreq kernel module after applying the phc-intel patch (urpmi kernel-devel is needed for modpost) then inserted the module phc-intel. Afterwards, I tried to use the phctool to manually set the core VID for the E1400 but the core VID measured by sensors stays constant at 1.20V no matter what's shown in /sys/devices/system/cpu/cpu?/cpufreq/phc_controls.
References:
  1. LessWatts.org
  2. How to use CPU frequency scaling (cpufreq)
  3. Speedstep on Pentium III
  4. Documentation: The /proc/acpi/processor Subdirectory
  5. CPU C-States

Display Chinese file names correctly on Samba shares

I found I had to add the following to /etc/samba/smb.conf
unix charset = GBK
and restart samba. I also have the following locale rpm installed:
locales-zh-2.9-4mdv2009.1

Friday, April 24, 2009

sensors.conf for my TUL TG31-M2 (it8718 and coretemp)

The result of sensors -v gives sensors version 2.10.8 with libsensors version 2.10.8 and I have the following in /etc/sensors.conf

chip "it8718-*"
label in0 "VCore"
label in1 "VDDR"
label in2 "+3.3V" # VCC3
label in3 "+5V" # VCC
label in4 "+12V"
ignore in5
# label in5 "-12V"
label in6 "-5V"
label in7 "5VSB" # VCCH
label in8 "VBat"

set in0_min 0.85
set in0_max 1.5
set in1_max 2.0

compute in3 ((6.8/10)+1)*@ , @/((6.8/10)+1)
compute in4 ((30/10)+1)*@ , @/((30/10)+1)
# compute in5 ((30/10)+1)*@ , @/((30/10)+1)
compute in6 (1+120/56)*@ - 4.096*120/56 , (@ + 4.096*120/56)/(1+120/56)
compute in7 ((6.8/10)+1)*@ , @/((6.8/10)+1)

label temp1 "M/B Temp"
label temp2 "CPU Temp"
label temp3 "ACPI Temp"

label fan1 "CPU Fan"
label fan2 "SYS Fan"
label fan3 "PWR Fan"

ignore vid
# label vid "CPU Vid"
# compute vid @,@

# Coretemp max 86C (/sys/devices/platform/coretemp.0/temp1_max) instead of 100C
chip "coretemp-isa-*"
compute temp1 (@ -14),(@ +14)

Thursday, April 23, 2009

Disable IPv6 in Mandriva

I found I needed the following line in /etc/modprobe.conf to disable IPv6.
alias ipv6 off
I also had the following line in /etc/sysconfig/network
NETWORKING_IPV6=no
The IPv6 is then disabled after reboot.

Power Consumption of my PCs measured by Kill A Watt P4400


  1. Custom build: AMD Athlon 64 X2 5050e, ECS GF8100VM-M3 motherboard with Gigabit NIC, one hard drive, 80-PLUS CORSAIR CMPSU-400CX 400W PS

    • Hibernating: 2W

    • Starting up/Shutting down: 50W

    • Idle: 40W (50W before installing the AMD CPU driver)

  2. PowerEdge 400SC: P4 2.4C, 1GB DDR memory, Radeon 9600, one SATA hard drive

    • Hibernating: 1W

    • Starting up/Shutting down: 108W

    • Idle: 61W

    • Web surfing: 70-90W

    • Playing back a WMV: 78W(81W with high quality mode)

    • Standby (S3): 4W (7% of idle power)

    • Standby (S1): 52W (85% of idle power)

    It costs me about $36=52*24*365/1000*$0.08 for standbying S1 a year. How to avoid that.

  3. Custom build: Sempron 3100+, 1GB DDR memory, Geforce 6200, two hard drives, Ultra 500W PS

    • Starting up/Shutting down: 110W

    • Idle: 73W/60W after removing one hard drive and all the add-on cards except for the video card

    • Web surfing: 75-100W

    • Playing back video: 78W

    • Viewing HDTV (720P) with a PCI TV card: 90W

    • Standby (S3): 6W (8% of idle power)


  4. Custom build: Duron 1.6G, 512MB SDRAM, Radeon 7500, one hard drive, Ultra 400W PS

    • Hibernating: 5W

    • Starting up/Shutting down: 90-100W

    • Idle: 79W

    • Web surfing: 85W

    • Standby (S3): 5W (6% of idle power)


  5. Linux router: Celeron 1.2G (tualatin), 256MB SDRAM, No video card, one hard drive, two NICs, 80-PLUS PC Power & Cooling Silencer PPCS370X 370W PS(or Powmax 300W PS)

    • Hibernating: 2W

    • Starting up/Shutting down: 47W(55W)

    • Normal: 42-43W(52-54W)

  6. Linux router: Dual-Core Celeron E1400, 2GB DDR2-800, TUL TG31-M2 (Intel G31) motherboard with gigabit NIC, one fast ethernet NIC, Two hardrives (one WD GP), 80-PLUS 370W PS
    • Hibernating: 2W

    • Starting up/Shutting down: 60-70W

    • Idle: 46W (44W after gigabit ethernet speed disabled)

    • Normal during hard drive IO: 48W

  7. LCD Monitor: 17 inch 1280x1024

    • Power off: 1W

    • Normal: 29W

    • Standby: 4W


Wednesday, April 22, 2009

Upgrade kernel using urpmi in Mandriva

  1. Upgrade filesystem libraray and programs in case e2fsck needs to run after reboot
    urpmi libext2fs2 e2fsprogs
  2. Upgrade mkinitrd
    urpmi mkinitrd nash
  3. Upgrade kernel and initscripts
    urpmi kernel initscripts

Saturday, April 11, 2009

How to modify client scheduled scan in Symantec Antivirus

I found that to modify client scheduled scan in Symantec Antivirus Corporate Edition (the client is not controlled by any server), one needs to edit the registry.The key to edit is HKEY_LOCAL_MACHINE\SOFTWARE\Intel\LanDesk\VirusProtect6\CurrentVersion\LocalScans\clientscheduledscan_?\schedule(? is a number).

I simply deleted the key HKEY_LOCAL_MACHINE\SOFTWARE\Intel\LanDesk\VirusProtect6\CurrentVersion\LocalScans\clientscheduledscan_1 to disable the client scheduled scan. And the result is shown below:

Friday, April 3, 2009

Use LDAP EXOP to change userpassword in PHP

It seems to me I couldn't do LDAP EXOP directly in PHP 5. However, the CPAN module Net::LDAP::Extension::SetPassword can do it and I can use Perl Code from PHP. I installed the Net::LDAP in CPAN and php-perl by urpmi. Then the following PHP code is what I have to change LDAP UserPassword by EXOP (connection is by ldapi):


$perl = new Perl();

try {
$perl->eval('
use Net::LDAP;
use Net::LDAP::Extension::SetPassword;
$errtxt="";

sub changepass {
my $server=shift @_;
my $dn=shift @_;
my $oldpass=shift @_;
my $newpass=shift @_;

$ENV{LDAPI_SOCK}="/var/run/ldap/ldapi";
$ldap = Net::LDAP->new( $server, onerror => "warn" );
$ldap->bind($dn , password => $oldpass);
$mesg = $ldap->set_password( oldpasswd => $oldpass, newpasswd => $newpass);
$errtxt=$mesg->error();
return $mesg->code();
}
');

$server='ldapi://';
$dn='uid=user,ou=People,dc=example,dc=com';
$oldpass='oldsecret';
$newpass='newsecret';

$errno=$perl->changepass($server,$dn,$oldpass,$newpass);
$error=$perl->errtxt;

}

catch (PerlException $exception) {
echo "Perl error: " . $exception->getMessage() . " ";
}

if ($errno) {
echo "Error $errno: $error";
}