Dec 272010

I have lately noticed that my Ubuntu crash when unplugging the power cord from my Laptop. This seemed to have something with the disk or disk controller since i would get ATA and file system kernel oops, and eventually a full crash.

After a bit testing i found that this came from acpid calling pm-utils (power management utilities) when unplugging the power cord.
A bit more testing revealed that it was the sata_alpm script which was the problem.
From the sata_alpm file it says it does the following:

This hook tries to save power by allowing SATA controllers to
reduce power usage when the SATA subsystem is otherwise idle.
This adds a little bit of latency to drive accesses in
exchange for moderate power savings if you are not using the drive.

I was able to circumvent this issue by doing sudo touch /etc/pm/power.d/sata_alpm.
Immediately after this i am able to unplug my power cord just as i please.

I have not given any time to solving the underlying cause for the freeze in the first time, as this lies in the part of the kernel telling the OS and file system that the drive has gone away sleeping.

Some information about the commit causing this problem: