Tuesday, 31 August 2010

Saturday, 21 August 2010

Meta-Choice


We should consider the meta-choice.

Online image editting

Recently, I had to do some image editing for my friend's blog. I did not have Gimp installed on my Arch system and Gwenview can do some cropping but not much else. Some time ago, I was thinking of having a site that allows editing of images online. It was just a random thought and I did not have the knowledge to implement such a site. However, now that there was a need for such a site [because I did not want to install image editing tools as do it very rarely], I googled for it and found this nice site to help me out. It had a Photoshop-like UI and worked nicely for my needs. I was glad to get my work done [and to know that my idea was feasible].

John Cleese on creativity and subconscious

Sunday, 15 August 2010

Connecting to BSNL GPRS on Arch linux

Popular Indian ISP BSNL is notorious for bad customer care. This makes the use of less popular technologies quite an experiment. Cutting out the elaboration of my experiments, let us look at the procedure for connecting to the internet using BSNL GRS. I used wvdial for the purpose and find it quite flexible. Internet access requires the cell phone to be connected in "PC Suite" mode. I shall describe the procedure for two phones:
1. Nokia XpressMusic 5130
2. Samsung Corby

Lets start with Nokia XpressMusic. To connect it from Windows, use Nokia's PcSuite; and add the following configurations manually:
1. access point name: bsnlnet
2. dialing number: *99#


Now let us look into connecting Nokia XpressMusic using linux. Firstly, get wvdial and its dependencies installed on your system. Connect the phone and check dmesg output to get the name of the modem device. Run wvdialconf to set the baud in /etc/wvdial.conf. Then edit /etc/wvdial.conf as follows:

Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","bsnlnet"
Password = <your phone number>
Check Def Route = 1
Phone = *99***1#
New PPPD = 1
Modem Type = USB Modem
Stupid Mode = 1
# let wvdialconf set this for you
Baud = 460800
Auto DNS = 1
# This command is essential.
Dial Command = ATD
#  put your modem name here
Modem = /dev/ttyACM0
ISDN = 0
Username = <your phone number>


The same configuration shall work for the Samsung Corby. Finally, to connect Samsung Corby using the PcSuite, use the following configuration.
1. access point: bsnlnet
2. dialing number: *99***1#

Connecting to wireless LAN on Arch linux

Recently, I successfully accessed wireless LAN on my Arch linux. This post shall be a documentation of the same.
Following is the part of lspci -k output of interest here.

02:00.0 Network controller: Broadcom Corporation BCM4311 802.11b/g WLAN (rev 02)
        Subsystem: Hewlett-Packard Company BCM4311 802.11b/g Wireless LAN Controller
        Kernel driver in use: b43-pci-bridge
        Kernel modules: ssb


To get the driver, I followed the steps in the wiki. I edited the MODULES line of my rc.conf as follows:

MODULES=(acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave cpufreq_performance !pcspkr !snd_pcsp !b43legacy b43)

Using wireless LAN was fairly simple with the following sequence of commands:

# wake up the interface
ifconfig wlan0 up
# scan for wireless networks in range
iwlist scan
# join the desired network based on their essid
iwconfig wlan0 essid "<name>" key <password>
# for automatic detection
iwconfig wlan0 channel auto
# obtain the lease of an IP
dhcpcd wlan0

It is also easy to end a wireless session.

# release the interface
dhcpcd -k wlan0
# exit dhcp
dhcpcd -x
# turn off the interface
ifconfig wlan0 down

Wednesday, 14 July 2010

Octave on Arch

Well recently I had to do some image processing; so I got octave installed on my Arch system. However, I had least interest in base octave. So, soon I was looking for octave-image which I got in Arch User Repository. Soon I needed octave-statistics. I searched AUR again; but the closest match to my needs was octave-forge: the complete set of octave modules. I don't like the idea of installing a number of modules for only one module. So I decided to look into Arch packaging system and install the modules from source. So I looked up their wiki on pkgbuilds and octave-image's pkgbuild example.

Packaging is fairly easy on Arch. Within some time, I had my pkgbuilds ready for octave-miscellaneous and octave-statistics. I made some mistakes; but with some help from #archlinux, I was ready for installation.

Thursday, 8 July 2010

Really fast

Kernel crash

Recently,a few times during boot-up,my kernel crashed printing a trace to console. After the second time, I decided to find out more about it. So, first I needed logs to find clues. However, as I found out [from talking on #archlinux and ##kernel on freenode], those messages are not logged anywhere. So, I was advised to just jot down the console logs.

The following was what I jotted down the next time it happened. I have replaced memory address values by [<mem>].

[<mem>]?__find_get_block
[<mem>]submit_bio
[<mem>]submit_bh
[<mem>]__ext3_get_inode_loc
[<mem>]ext3_iget
[<mem>]ext3_lookup
[<mem>]do_lookup
[<mem>]do_last
[<mem>]do_flip_open
[<mem>]?anon_vma_chain_free
[<mem>]?unmap_region
[<mem>]?alloc_fd
[<mem>]?strncpy_from_user
[<mem>]do_sys_open
[<mem>]sys_open
[<mem>]system_call_fastpath
Code: ff ff ...
RIP [<mem>]__rb_rotate_left
RSP <mem>
--[end of trace]
note:modprobe exited with preempt_count 1

On irc, this time I was advised to do a memcheck. I took my Ubuntu disk [I keep it as a rescue disk.] and ran the memtest. My system passed that. So, the next step was to check the hard drive. I used to have smartmontools on my earlier linux installations; but I had not installed it on my Arch system. Getting it was a matter of time. It was already enabled on my hard disk; so I just had to check the logs.

smartctl --all /dev/sda
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Model Family: Seagate Momentus 5400.2 series
Device Model: ST9120821AS
Serial Number: 5PL4ZYQ9
Firmware Version: 7.24
User Capacity: 120,034,123,776 bytes
Device is: In smartctl database [for details use: -P show]
ATA Version is: 7
ATA Standard is: Exact ATA specification draft version not indicated
Local Time is: Mon Jul 5 11:48:01 2010 IST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
See vendor-specific Attribute list for marginal Attributes.

General SMART Values:
<snip>

SMART capabilities: (0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
No General Purpose Logging support.
Short self-test routine
recommended polling time: ( 2) minutes.
Extended self-test routine
recommended polling time: ( 68) minutes.
SCT capabilities: (0x0001) SCT Status supported.

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x000f 100 253 006 Pre-fail Always - 0
3 Spin_Up_Time 0x0002 096 095 000 Old_age Always - 0
4 Start_Stop_Count 0x0033 096 096 020 Pre-fail Always - 4348
5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always - 0
7 Seek_Error_Rate 0x000f 075 060 030 Pre-fail Always - 21656905082
9 Power_On_Hours 0x0032 094 094 000 Old_age Always - 5840
10 Spin_Retry_Count 0x0013 100 100 034 Pre-fail Always - 0
12 Power_Cycle_Count 0x0033 096 096 020 Pre-fail Always - 4450
187 Reported_Uncorrect 0x0032 100 100 000 Old_age Always - 0
189 High_Fly_Writes 0x003a 001 001 000 Old_age Always - 1096
190 Airflow_Temperature_Cel 0x0022 045 034 045 Old_age Always FAILING_NOW 55 (255 255 58 46)
192 Power-Off_Retract_Count 0x0032 100 100 000 Old_age Always - 1276
193 Load_Cycle_Count 0x0032 002 002 000 Old_age Always - 197088
194 Temperature_Celsius 0x0022 055 066 000 Old_age Always - 55 (0 19 0 0)
195 Hardware_ECC_Recovered 0x001a 048 044 000 Old_age Always - 131646341
197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0010 100 100 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always - 0
200 Multi_Zone_Error_Rate 0x0000 100 253 000 Old_age Offline - 0
202 Data_Address_Mark_Errs 0x0032 100 253 000 Old_age Always - 0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
<snip>

SMART Selective self-test log data structure revision number 1
<snip>
After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

As is apparent from the logs, it was a hard disk temperature problem. It was probably caused by blocked airflow coupled with high ambient temperature.