Bug 710922 - Hard disk spins down twice at power down
Summary: Hard disk spins down twice at power down
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 15
Hardware: i686
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Lennart Poettering
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-06-05 20:26 UTC by Boyan Anastasov
Modified: 2011-06-08 20:27 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-06-08 09:46:23 UTC
Type: ---


Attachments (Terms of Use)
Diff between my kernel and Fedora kernel configs (89.08 KB, text/plain)
2011-06-08 08:25 UTC, Boyan Anastasov
no flags Details

Description Boyan Anastasov 2011-06-05 20:26:43 UTC
Description of problem:

When the system is shut down I hear that before the system is powered down the hard disk spins down, then it is powered up, and then spins down again.
This does not look like very healthy operation for hard disks.

I've tested this on kernel 2.6.38.6 which was my last kernel in Fedora 14, and the current one is 2.6.39.1.

The observed situation is also seen with smartctl from SMART attributes after booting next time - Start_Stop_Count increases with 2, Power_Cycle_Count with 1.

Version-Release number of selected component (if applicable):
systemd-26-2.fc15.i686 (all versions until now)

Feel free to assign it to another component of Fedora 15 if there is more appropriate one.

Comment 1 Michal Schmidt 2011-06-06 14:04:41 UTC
Can you reproduce it even with an immediate shutdown without systemd involvement?:
sync && poweroff -f

Comment 2 Boyan Anastasov 2011-06-07 08:06:05 UTC
  With poweroff -f the system is shut down immediately, without the
mentioned sound of spin up, but the strange thing is that the counters
are increased the same way - Start_Stop_Count with 2, Power_Cycle_Count
with 1. The difference between those counters is not double - currently
they are respectively 1419/713.
  I'm sure that for the first 700 times before Fedora 15 the sound was of
only one spin down. Definitely with Fedora 15 something is different. I've
tested with kernels 2.6.37.6, 2.6.38.4, and my current kernel 2.6.39.1 -
same thing, the disk produces sound of spin down, spin up, spin down.
  Booted with Fedora 14 CD and with another distribution's usb flash - powering
off does not produce such sound.

Comment 3 Michal Schmidt 2011-06-07 17:55:34 UTC
Are you using only custom built kernels? Can you reproduce it with a Fedora kernel too?

If yes, see if it happens also with "systemctl poweroff -f".

Comment 4 Boyan Anastasov 2011-06-07 20:35:51 UTC
  I have only custom kernels. I doubt Fedora kernel (2.6.38) will be different
from my last 3 kernels (2.6.37.X, 2.6.38.X, 2.6.39.X).
  I guess "poweroff -f" is the same as "systemctl poweroff -f":
lrwxrwxrwx 1 root root 16 May 30 22:17 /sbin/poweroff -> ../bin/systemctl*
  Executing "poweroff -f" does instant spin down of the disk. There is no problem
with that, except forcing filesystem check next time. The issue is with the
non-forced shutdown.
  This whole thing seems like something is trying to power down the disk
before the data is synced, and the kernel tries to power it up again to sync it.

Comment 5 Michal Schmidt 2011-06-07 21:08:56 UTC
(In reply to comment #4)
>   I have only custom kernels. I doubt Fedora kernel (2.6.38) will be different
> from my last 3 kernels (2.6.37.X, 2.6.38.X, 2.6.39.X).

Please give it a try.

>   I guess "poweroff -f" is the same as "systemctl poweroff -f":

It is not.

> lrwxrwxrwx 1 root root 16 May 30 22:17 /sbin/poweroff -> ../bin/systemctl*

systemctl looks at argv[0] to switch its mode of operation, so the symlink does not prove anything.

Comment 6 Boyan Anastasov 2011-06-08 08:22:51 UTC
  You are right - "systemctl poweroff -f" is not equivalent to "poweroff -f".
It shuts down like "poweroff", i.e. without "force" argument, so there is
no difference - the disk spins up before power down.
  I've tried the latest Fedora 15 kernel - kernel-2.6.38.7-30.fc15.i686. There is no such spin up before power down. Now the question is what is in Fedora kernel that it is now needed by Fedora 15 to shut down properly that I don't have in my
custom kernel, except a bunch of unused drivers for hardware I don't have.
I'll attach the diff between my and Fedora kernel configs if that can help...

  By the way, there are some visible and annoying differences comparing Fedora kernel and my custom kernel, but they are for another bug report anyway:
- Xorg detects keyboard and mouse differently, and the mouse is moving faster. In
kde konsole editing the command is difficult - left/right arrows don't do repeat mode when pressed longer time, down arrow is like enter. Enter is doing 2 enters. Even writing here in Firefox is difficult to go up and down in the text, next line is removed if I press down arrow. Sure it might be something in xorg.conf like: Option "XkbRules" "xorg" and not "evdev".

Comment 7 Boyan Anastasov 2011-06-08 08:25:14 UTC
Created attachment 503637 [details]
Diff between my kernel and Fedora kernel configs

Comment 8 Michal Schmidt 2011-06-08 09:46:23 UTC
I'm 99 % sure this is it:

-CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+CONFIG_UEVENT_HELPER_PATH=""

Comment 9 Michal Schmidt 2011-06-08 11:07:57 UTC
(In reply to comment #6)
>   By the way, there are some visible and annoying differences comparing Fedora
> kernel and my custom kernel, but they are for another bug report anyway:
> - Xorg detects keyboard and mouse differently, and the mouse is moving faster.
> In
> kde konsole editing the command is difficult - left/right arrows don't do
> repeat mode when pressed longer time, down arrow is like enter. Enter is doing
> 2 enters. Even writing here in Firefox is difficult to go up and down in the
> text, next line is removed if I press down arrow. Sure it might be something in
> xorg.conf like: Option "XkbRules" "xorg" and not "evdev".

This could be explained by:
+CONFIG_INPUT_EVDEV=y

You don't have evdev in your custom kernel and have probably configured Xorg to use the legacy drivers. With the Fedora kernel Xorg detects the evdev devices automatically, so it gets mouse and keyboard events twice.
Or something like that.
Before you file bugs about it, try reproducing it after moving your xorg.conf away.

Comment 10 Boyan Anastasov 2011-06-08 20:14:49 UTC
(In reply to comment #8)
> I'm 99 % sure this is it:
> 
> -CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
> +CONFIG_UEVENT_HELPER_PATH=""

That fixed it. It worked even before recompiling the kernel with:

echo "" > /proc/sys/kernel/hotplug

I've searched last days, but just now found this:
http://lists.freedesktop.org/archives/systemd-devel/2011-May/002376.html

>Kay Sievers wrote:
>Just a first quick check of an issue we ran into with ATA disks:
>what's in /proc/sys/kernel/hotplug before you shut down? Or what's
>CONFIG_UEVENT_HELPER in your kernel setup, it must be ="" on modern
>systems, otherwise the kernel will they to exec() binaries all the
>time and keep the system's rootfs busy.

This explains why the disk can't spin down the first time.
Thanks for your help.

Comment 11 Boyan Anastasov 2011-06-08 20:27:55 UTC
(In reply to comment #9)
> (In reply to comment #6)
> >   By the way, there are some visible and annoying differences comparing Fedora
> > kernel and my custom kernel, but they are for another bug report anyway:
> > - Xorg detects keyboard and mouse differently, and the mouse is moving faster.
> > In
> > kde konsole editing the command is difficult - left/right arrows don't do
> > repeat mode when pressed longer time, down arrow is like enter. Enter is doing
> > 2 enters. Even writing here in Firefox is difficult to go up and down in the
> > text, next line is removed if I press down arrow. Sure it might be something in
> > xorg.conf like: Option "XkbRules" "xorg" and not "evdev".
> 
> This could be explained by:
> +CONFIG_INPUT_EVDEV=y
> 
> You don't have evdev in your custom kernel and have probably configured Xorg to
> use the legacy drivers. With the Fedora kernel Xorg detects the evdev devices
> automatically, so it gets mouse and keyboard events twice.
> Or something like that.
> Before you file bugs about it, try reproducing it after moving your xorg.conf
> away.

With Fedora kernel without xorg.conf there is an improvement - left and right arrow works as expected, mouse speed is normal, only the Enter works double.
After enabling CONFIG_INPUT_EVDEV in my kernel everything is normal.
Note - in Fedora 14 I had this to have working keyboard and mouse:
       Option "AllowEmptyInput" "off"
       Option "AutoAddDevice" "off"

In Fedora 15:
Option "AutoEnableDevices" "off"

But now with CONFIG_INPUT_EVDEV=y I've removed those options and everything
looks normal.
Thanks again for your help.


Note You need to log in before you can comment on or make changes to this bug.