Linux, Tech

Hard disk health monitoring in Debian Lenny using smartmontools

Install smartmontools from the repository.

thinkpad:~# aptitude install smartmontools

Enable SMART monitoring on the SATA drive.

thinkpad:~# smartctl -s on  -d ata /dev/sda

Check the health of the drive.

thinkpad:~# smartctl -d ata -H /dev/sda
smartctl version 5.38 [i686-pc-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is

SMART overall-health self-assessment test result: PASSED

Run a short self test on the drive and check the test log.

thinkpad:~# smartctl -t short /dev/sda
thinkpad:~# smartctl -l selftest /dev/sda
smartctl version 5.38 [i686-pc-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%      4156         -

In order to configure smartd to monitor the hard disk, enable it in /etc/default/smartmontools.

# uncomment to start smartd on system startup

Set the schedule and monitoring options by editing /etc/smartd.conf. Comment out all the DEVICESCAN lines and add a line for the main hard drive.

# First (primary) ATA/IDE hard disk.  Monitor all attributes, enable
# automatic online data collection, automatic Attribute autosave, and
# start a short self-test every day between 2-3am, and a long self test
# Saturdays between 3-4am. Send mail on SMART failures
/dev/sda -a -o on -S on -s (S/../.././02|L/../../6/03) -m naveen@localhost

Start the smart daemon.

thinkpad:~# /etc/init.d/smartmontools restart
 * Restarting S.M.A.R.T. daemon smartd                        [ OK ]
Linux, Tech

Software suspend, hibernate Debian Lenny on Thinkpad R61

I recently installed Debian Lenny KDE on my Thinkpad R61. The installation went smooth but suspend/hibernate did not work. When suspend was initiated from KPowersave or Guidance, the machine would go into suspend (the moon LED on the Thinkpad panel blinks) but it immediately resumes in to the KDE session.

After reading about software suspend in the debian wiki, I decided pm-utils and uswsusp was the recommended way to go.

I played with the s2ram script with different options, ‘s2ram -f‘, ‘s2ram -f -a 3‘, but I still got the same problem of suspend-immediate-wakeup (hibernate also had the same problem).

Then, I found thinkwiki had the exact problem description.

The problem is that the USB kernel modules are not unloaded for the suspend to complete. So, I created file called ‘defaults’ under /etc/pm/config.d/ with the following flags enabled (this is the preferred location for pm-utils customization – ref: /usr/lib/pm-utils/defaults):

# The default sleep/wake system to use.  Valid values are:
#   kernel    The built-in kernel suspend/resume support.
#             Use this if nothing else is supported on your system.
#   uswsusp   If your system has support for the userspace
#             suspend programs (s2ram/s2disk/s2both), then use this.
#   tuxonice  If your system has support for tuxonice, use this.
# The system defaults to "kernel" if this is commented out.

# If you need to unload any modules to suspend/resume, add them here.
SUSPEND_MODULES="uhci_hcd ehci_hcd"

Bam. Suspend and Hibernate were working beautifully. Just not quite. When the machine was waking up from hibernate nicely, splashy was emitting some errors. I got it working by reinstalling splashy and libsplashy1 and adding the kernel options for splashy in my grub menu. hwinfo was useful in finding the correct vga parameter that would be supported by my R61 (1280×800).


kernel          /boot/vmlinuz-2.6.26-2-686 root=/dev/sda3 ro quiet vga=0x368 splash

thinkpad:~# hwinfo --framebuffer
02: None 00.0: 11001 VESA Framebuffer
[Created at bios.450]
Unique ID: rdCR.pM4x9oRqolF
Hardware Class: framebuffer
Model: "Intel(r)Crestline Graphics Controller"
Vendor: "Intel Corporation"
Device: "Intel(r)Crestline Graphics Controller"
SubVendor: "Intel(r)Crestline Graphics Chip Accelerated VGA BIOS"
Revision: "Hardware Version 0.0"
Memory Size: 7 MB + 448 kB
Memory Range: 0xe0000000-0xe076ffff (rw)
Mode 0x0360: 768x480 (+768), 8 bits
Mode 0x0361: 768x480 (+1536), 16 bits
Mode 0x0362: 768x480 (+3072), 24 bits
Mode 0x0363: 960x600 (+960), 8 bits
Mode 0x0364: 960x600 (+1920), 16 bits
Mode 0x0365: 960x600 (+3840), 24 bits
Mode 0x0366: 1280x800 (+1280), 8 bits
Mode 0x0367: 1280x800 (+2560), 16 bits
Mode 0x0368: 1280x800 (+5120), 24 bits
Mode 0x0305: 1024x768 (+1024), 8 bits
Mode 0x0317: 1024x768 (+2048), 16 bits
Mode 0x0318: 1024x768 (+4096), 24 bits
Mode 0x0312: 640x480 (+2560), 24 bits
Mode 0x0314: 800x600 (+1600), 16 bits
Mode 0x0315: 800x600 (+3200), 24 bits
Mode 0x0301: 640x480 (+640), 8 bits
Mode 0x0303: 800x600 (+832), 8 bits
Mode 0x0311: 640x480 (+1280), 16 bits
Config Status: cfg=new, avail=yes, need=no, active=unknown

thinkpad:~# update-initramfs -u

This post was very helpful:


Droid fonts from the Open Handset Alliance’s Android platform

Droid is a font family specifically designed for the Android platform. The family consists for the usual serif, sans serif and monospace typefaces. I downloaded the font bundle from here.

The fonts, especially the sans serif typeface, looks really good with KDE’s sub-pixel hinting. So, I have set it up as the UI font for my KDE4 desktop.



Internet, Tech

Port-Forwarding in OpenWRT

Port forwarding can be enabled in OpenWRT by editing the firewall config file /etc/firewall.config.


This is a typical entry in the firewall config implying that incoming connections from the WAN on port 5022 will be forwarded to port 22 on the machine


The above method works on Kamikaze. For White Russian, check out the comment below.

Internet, Tech

Static IP Leases in OpenWRT

DHCP is the simplest way for handling IP leases in a home network. But, we would need static leases when we are running any servers in the network.

This can be done in OpenWRT by specifying the machine needing the static lease in the /etc/ethers file.
# desktop

Once this is done, the DNS/DHCP server needs to be restarted.
/etc/init.d/dnsmasq restart