Harddisk Failure? -- Part 1

Computer Hanged

My Linux box hanged yesterday! When a Linux box hangs, you normally blame (1) a memory-leaked program, (2) an I/O-hungry program, or (3) a hardware failure. Checked my Conky monitor, no program was swallowing my memory or I/O bandwidth. Hardware problem? I checked my /var/log/messages, and something really went wrong (I've highlighted those abnormal events):

  Mar 10 15:53:11 peace-desktop kernel: [ 2434.881018] ata3: hard resetting link
  Mar 10 15:53:18 peace-desktop kernel: [ 2442.392316] ata3: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
  Mar 10 15:53:23 peace-desktop kernel: [ 2447.400079] ata3.00: qc timeout (cmd 0xec)
  Mar 10 15:53:23 peace-desktop kernel: [ 2447.400092] ata3.00: failed to IDENTIFY (I/O error, err_mask=0x4)
  Mar 10 15:53:23 peace-desktop kernel: [ 2447.400110] ata3: hard resetting link
  Mar 10 15:53:24 peace-desktop kernel: [ 2447.940060] ata3: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
  Mar 10 15:53:24 peace-desktop kernel: [ 2447.943275] ata3.00: configured for UDMA/33
  Mar 10 15:53:24 peace-desktop kernel: [ 2447.943311] ata3: EH complete

Was it really a harddisk problem? Turned out that it's not that simple yet!

Conky as System Monitor

Last Updated (07-Mar-09): Added the monitoring of CPU fan speed.

I have recently discovered Conky, a very nice light-weight system monitor. A screenshot along with the current configuration file are attached below.

漫画里的数学:《欺诈游戏》第24话里的6% (Analysis of a Game Involving Bernoulli Trials)

这帖子里我分析了《欺诈游戏》漫画里出现的某个机率。最近我朋友看这漫画时问了我另一问题:第24话里出现的6%。我研究了一下,这问题也蛮有趣的。先说明一下:

  • 以下的分析涉及到一点大学程度的数学,但高中程度的数学知识就应可读懂。
  • 我在高中用中文学数学,上了大学却用英文,所以不太懂得运用某些专有名词。为避免張冠李戴用错专有名词,我以英文作分析。

This is a mathematical problem from a Japanese manga Liar Game.

问题 Problem

The game involves two players (S and F) and consists of several rounds. Each round is essentially a Bernoulli trial with probability p of success. Player S scores a point if the trial is success, otherwise Player F scores a point. The game ends when one player wins by first obtaining N points.

  1. Find out the probability P that Player S will win the game, in terms of p and N.
  2. Verify the claim in the comic that, if N=10 and p=1/3, Player S stands for a chance of only P≅6% to win the game.

解答 Solution

Restore Grub Boot Loader in Ubuntu

Sometimes, especially if you have just installed Windows operating system alongside with your Ubuntu, your precious Grub boot loader will be wiped out from the MBR (Master Boot Record) from your hard disk. How do you restore it?

The steps here have been tested with Ubuntu 9.10.

  1. Boot into the Ubuntu Live CD or USB stick.
  2. Open a terminal with 'Accessories' -> 'Terminal'.
  3. Find out the partition that correspond to your root /. If you have a separate partition for /boot, find it out too. The command sudo fdisk -l may help. Here we assume that the partitions are /dev/sda1 and /dev/sda2 (if any) respectively.
  4. Now mount your root partition with sudo mount /dev/sda1 /mnt. If you have a separate partition for /boot, mount it too with sudo mount /dev/sda2 /mnt.
  5. Restore Grub with sudo grub-install --root-directory=/mnt /dev/sda. (Assume that you want to install Grub to the MBR of /dev/sda.)

Reboot your computer and it should work fine now.

My Customized Desktop Panel

I have just installed Ubuntu 9.10 Karmic Koala, and have spent some time to customize my Xfce panel. I have used GIMP to create a snapshot of my panel, split it into two (since the panel is too wide, with 1440 pixels), and attach them here.

I configured to use only one panel, with a height of 34 pixels at the bottom of the screen.

The Left Part

The left part of the panel consists of the items below (from left to right):

  1. Xfce Menu. Only shows the icon to save space.
  2. Places. For fast access.
  3. Launcher for Firefox. I use Firefox often.
  4. Launcher for Chromium. I use Google Chromium often too. Add the repository with a simple sudo add-apt-repository ppa:chromium-daily
  5. Launcher for Xfce Terminal. A must-have for hardcore GNU/Linux hacker!
  6. Separator. A Line.
  7. Task List. I configure it to 'Never group tasks'.
  8. Separator. A Line.

The Right Part

This part is much more dynamic and interesting.

  1. Weather Update. I can access the weather details and forecast in a few clicks. Handy information for me before hanging clothes outside!
  2. Dictionary. I have also added the web service with URL http://dictionary.sina.com.hk/p/word/{word} for English <-> Chinese translation.
  3. Notes. The 'physical' sticky notes I used did not stick well on the edge of my monitor. I resort to this 'soft' sticky notes for the moment. Bad thing is that it has to occupy some display area and not all notes are visible anytime.
  4. Governor Plugin. I use the 'ondemand' governor most of the time to save power and reduce the heat generated. Will use 'performance' governor sometimes when I'm desperate. :p
  5. CPUFreq. Shows the current CPU frequency, in GHz.
  6. System Load Monitor. Shows monitors for CPU, memory, swap, and uptime respectively.
  7. Free Space Checkter for /tmp. I have modified /etc/fstab to mount /tmp as tmpfs with this line: tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0. The capacity of tmpfs in my box, mounted with 4GB RAM, is 2GB. It's sufficient but it's better to monitor its space usage, as I often use /tmp to hold temporary files when compiling software, hold temporary ISO images during disc burning, etc.
  8. Network Monitor. The maximums for incoming and outgoing are set to be 200 kBytes/s and 50 kBytes/s respectively.
  9. Sensor plugin. sensors-detect found that I need to use the it87 module, but the module will not load successfully under Karmic Koala due to 'ACPI: I/O resource it87 [0x295-0x296] conflicts with ACPI region ECRE [0x290-0x2af]' as found in dmesg. To workaround with the problem, edit /etc/default/grub by assigning GRUB_CMDLINE_LINUX="acpi_enforce_resources=lax", execute sudo update-grub2, and reboot the box. I configured it to show M/B Temp, CPU Temp, and the temperatures of two hard disks.
  10. Workspace Switcher. I use 6 workspaces, shown in 3 rows here.
  11. Notification Area. The volume control and IBus input method framework are always accessible here.
  12. Orage Clock. Line 1: %R, with font Sans 10. Line 2: %d-%b, with font Sans Bold 10.
  13. Action Buttons. To lock the screen with just one click.

Your comments or suggestions are welcomed.

Fuji Xerox WorkCentre PE220 in Ubuntu (Up to Ubuntu 9.04)

IMPORTANT NOTE!!!

For updated and latest instructions for Ubuntu 9.10 onwards, go to this page.
This page keeps only the OBSOLETE instructions for setting up this printer up to Ubuntu 9.04 in case some people still need it.

Update (25-Apr-09): Updated for Ubuntu 9.04 Jaunty Jackalope and Samsung Unified Driver version 3.xx
Update (08-Nov-08): Updated for Ubuntu 8.10 Intrepid Ibex
Update (30-Apr-08): Improved the workaround with hal-cups-utils
Update (28-Apr-08): Updated for Ubuntu 8.04 Hardy Heron
Update (23-Oct-07): Updated for Ubuntu 7.10 Gutsy Gibbon

I started to use my Fuji Xerox WorkCentre PE220 since Ubuntu 7.10, and I needed to do many tricks to install the driver properly. But since Ubuntu 9.04 and Samsung Unified Driver version 3.xx, the installation is so easy and it works out-of-box!

Note that the installation steps involved differ for different Ubuntu and driver versions. I make this guide more 'practical' by only showing the steps for the latest Ubuntu (9.04 Jaunty Jackalope) and printer driver (version 3.xx).

1. Download the Unified Linux Printer Driver from Samsung

Some Xerox printers are Samsung OEM. This Xerox WorkCentre PE220 looks like a clone of Samsung SCX-4521F [www.samsung.com] (Note: This link changed very often! Navigate from the main page if the link does not work.) except that it has a slightly different button layout on the control panel. Download the driver. The latest driver I use is UnifiedLinuxDriver.tar.gz (Version 3.00.37) as of this writing.

Taiji Symbol on the Casing?

When I upgraded my computer a few days ago, something on one of the casings involved caught my eyes:

Saw it? There is a Taiji [en.wikipedia.org] symbol (太极图) at the bottom of the casing!

Is there any special structural design that results in this taiji symbol? I took a look the bottom of the casing.

Hmm... No, I can't think of any other reason except that the symbol might be used to bless the computer components inside the casing? Some Feng Shui purpose? Nonetheless, the motherboard installed in this casing was spoiled last month (after using it for about 2 years). And this was the first reason that made me to upgrade my computer. :p

So do you have a better idea why the symbol is there? Tell me.

Syndicate content