Ubuntu hdparm APM and laptop mode tools

Ubuntu 8.10 is supposed to fix the apm=128 issue which causes high loading/unloading cycles for some hard drives; however, it is still BROKEN by default, here’s why:
the file 90-hdparm.sh located in various folders in /etc/acpi such as /etc/acpi/ac.d/, /etc/acpi/battery.d/, /etc/acpi/resume.d/, and /etc/acpi/start.d/ is supposed to fix the hdparm problem; however, notice the following lines:
DO_HDPARM=y
if [ -e /usr/sbin/laptop_mode ] ; then
LMT_CONTROL_HD_POWERMGMT=$(. /etc/laptop-mode/laptop-mode.conf && echo "$CONTROL_HD_POWERMGMT")
if [ "$LMT_CONTROL_HD_POWERMGMT" != 0 ] ; then
# Laptop mode controls hdparm -B settings, we don't.
DO_HDPARM=n
fi
fi

This checks if the file /usr/sbin/laptop_mode exists and if it exists, then it checks if CONTROL_HD_POWERMGMT in laptop-mode.conf is set to a non-zero number in order to determine if laptop mode is enabled. However, Ubuntu installs laptop-mode-tools by default, so /usr/sbin/laptop_mode always exist and that by itself does not tell whether laptop mode is on. Rather, ubuntu turns laptop mode off by default by setting the variable ENABLE_LAPTOP_MODE=false in /etc/default/acpi-support, but this variable is not used anywhere except in the init script /etc/init.d/laptop-mode from line 30 to 37:
# FIXME: this shouldn't be configured there
if [ -f /etc/default/acpi-support ]; then
. /etc/default/acpi-support;
fi

if [ x$ENABLE_LAPTOP_MODE = xfalse ]; then
exit 0;
fi
which stops the script from executing if the variable is set to false. One funny thing about this is that it says FIXME in the comment but it actually never get fixed even after Ubuntu 8.10 is released. With Ubuntu’s default settings laptop mode tool is supposed to be disabled by ENABLE_LAPTOP_MODE=false, but the script 90-hdparm.sh always thought that it is enabled as long as laptop mode is installed because /usr/sbin/laptop_mode is always there. It then checks the variable CONTROL_HD_POWERMGMT in /etc/laptop-mode/laptop-mode.conf, which is 1 by default, and it will set DO_HDPARM=n, thinking that laptop-mode is on and letting it to handle hard drive’s APM setting instead while actually laptop-mode is OFF and not taking care of the APM problem. This makes nobody changing the hard drive’s default APM setting from 128 to something else, leaving the clicking problem unsolved.
I did some workaround to 90-hdparm.sh by changing the line "if [ -e /usr/sbin/laptop_mode ] ; then" to "if [ -e /var/run/laptop-mode-tools/enabled ] ; then" in order to check if laptop mode tool is enabled, because whenever laptop mode tool is enabled, it creates the file /var/run/laptop-mode-tools/enabled, so I think this is the right way to check if it is actually enabled rather than just installed. I also think that the variable ENABLE_LAPTOP_MODE in /etc/default/acpi-support should be removed instead, just as Debian did in acpi-support version 1.109-5. That variable is just there to confuse people more and mess up the configurations. Even the comment in /etc/init.d/laptop-mode says “FIXME: this shouldn’t be configured there” already, why don’t they just fix it right now and make all these things less messy. I have tested Debian six months before and they really did a good job in fixing those hard drive clicking issues by making the 90-hdparm.sh file and removing the ENABLE_LAPTOP_MODE variable.

Finally Google Webmaster Tool Picked up My Sitemaps

I had problem uploading my sitemap to Google’s Webmaster Tools since October 22. Google used to pick up my sitemap in about 30 minutes, but this time it showed last download is October 21 and it had been pending for more than a day until it finally downloaded it. In the mean time I also submitted a sitemap for my new website, but I really caught the bad time and it took me three days before Google download the sitemap for the first time, ahhhh. I googled around and checked the Google Groups about this issue and I found out that many people had the same problem and it was something to do with Google. Hopefully they will fix this soon.

Bad Luck with Steadfast.net’s MySQL Server

Today when I went to check this blog at about 3:30pm PST I figured out that it took very long for it to respond and it can’t connect to the database. I then checked other websites but also the same. Later on I figured out that’s because steadfast’s mysql2 database server was down as their hard drive screwed up :(. I checked their website and they said they replaced the hard drive, but they needed filesystem check as well. I waited and waited for a few hours but at 7:55PM CT they said the filesystem check process restarted and I have to wait again. I kept on checking their update about the problem and at 9:45pm they said the filesystem check is completed and some data are corrupted, but they have the backup from the morning. I then checked my website and it worked for a like a minute or so but down again. Later on I checked their update again and realized that the good news is gone; instead they replaced it with a bad news in 10:00pm saying that the RAID card screwed up and they’ll look at it. An hour and a half later the bad news came, that the whole RAID array is gone and they had to replace the whole thing! After another hour wait they said they are installing the system back to the new drives and finally at 1:13 AM they are up again, and they restored the backup that was taken at 1:30AM CT on October 21, ahhhh. Fortunately nothing was changed on my websites at that time of period.
I have never had any issue with this hosting company before. My websites were almost never down until yesterday, but this time it is been down for too long. It was down for more than six hours. On all other hosting companies that I have before they have downtime as well, but only for a very short time rather than this lengthy delay. However, this issue is not common and I hope that this won’t happen again.

Hostgator unlimited space and bandwidth for cheap price

Hostgator right now is giving you unlimited space and bandwidth for all shared hosting packages. Also, for the Baby and Business plan they allow unlimited domains. It’s a very good deal for just $4.95, $7.95, and $12.95 a month for the Hatchling, Baby, and Business plans if paid 3 years at once. If you don’t want to pay for 3 years at once you can pay it for 2 years, 1 year, or even monthly, which is $8.95, $9.95, and $14.95 a month, still not that much higher than 3 years at once for the Baby and Business plans.

Installing Language Pack in Vista for My neighbors

Today I helped my neighbors to upgrade his Windows Vista that comes from the pc from premium to ultimate so that I can install the chinese language pack for them. I actually helped them to buy the upgrade from premium to ultimate online for about $172. After buying it I got the license file with the product key on it and started the update. The upgrade took about one hour and went fine. After the upgrade I was happy and trying to install the language pack from Windows Update, but the language pack failed to install when it’s half way through with code 2 error! I restarted the computer, tried it again, but it’s still the same! Still can’t fix it even after clicking the get help next to the code 2 error and search online for solutions of the problem! I actually found many people with the same problem and no solution! Some people said that the only way to get through it is make a clean install of Windows rather than using the one that comes with the PC. Later I called microsoft support for help and that guy simply sucks, can’t do anything about it either. Afterward I didn’t have any other way to fix this and I decided to resize the Windows partition and make a new partition to install Windows on it. The first time I installed Windows Vista ultimate with the Upgrade Anytime CD without the cd key I bought because it didn’t work. After installing it didn’t work either because the cd key can’t be used for activation. After that I tried to instal premium first with the computer’s product key and then upgrade to Ultimate, but without activating the premium first and couldn’t use the cd key either. Of course it failed again. Finally I gave it one more chance by clean installing premium first and then activate it. After activating the premium I can finally use the upgrade cd key to upgrade to ultimate and install the language pack! Phew… almost wasted the money that I use to upgrade. I think the language pack doesn’t work with the preinstalled Windows in many computer and I had to make a clean install instead to get it work.

Wubi – Install Ubuntu inside Windows w/o Partitioning


If you want to install ubuntu 7.04 Feisty, but you don’t want to modify your Windows partition and you want to install it inside, Wubi is for you. According to its website:

Wubi is an unofficial Ubuntu installer for Windows users that will bring you into the Linux world with a few clicks. Wubi allows you to install and uninstall Ubuntu as any other application. If you heard about Linux and Ubuntu, if you wanted to try them but you were afraid, this is for you.

Moreover, Wubi doesn’t need you to replace the default Windows bootloader, as “Wubi adds an entry to the Windows boot menu which allows you to run Linux. Ubuntu is installed within a file in the windows file system (c:\wubi\disks\system.virtual.disk), this file is seen by Linux as a real hard disk.” Then it loads the file as a loopback root Filesystem, kind like those described in “The Loopback Root Filesystem HOWTO,” but with the loopback filesystem is actually in Windows’s partition.

Since Wubi makes Ubuntu run inside Windows partition, there will be a little bit performance penalty, especially when your Windows partition is fragmented. Moreover, if there were any error in the ntfs partition that affects the system virtual disk, you need to fix the errors with something like chkdsk in Windows first before booting Ubuntu. If you’re not afraid of partitioning, I still recommend you to install Ubuntu in a separate partition.

Wubi’s Website

Tips and tricks and tech thoughts for computers, internet, and mobile.