Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#33262 - [systemd] systemd suspend changes APM level

Attached to Project: Arch Linux
Opened by Lukas Jirkovsky (6xx) - Tuesday, 01 January 2013, 10:24 GMT
Last edited by Tom Gundersen (tomegun) - Wednesday, 13 November 2013, 18:14 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Dave Reisner (falconindy)
Tom Gundersen (tomegun)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 5
Private No


When "systemctl suspend" is used to suspend a machine, the APM level is not correctly restored upon wakeup. Maybe there are other settings that are not correctly restored too, but this is a visible one.

Additional references:

Additional info:
* systemd 196-2, but it is likely to be an issue since systemd 191 or 192 according to forum
* no specific configuration

Steps to reproduce:
* set APM level to a non-default one, eg. hdparm -B 254 /dev/sda
* systemctl suspend (also upower as described in the Arch wiki can be used)
* wakeup
* check APM level using hdparm -B /dev/sda

- it may be necessary to do more suspend-resume cycles, on my laptop the settings are correctly restored on the first wakeup, but consecutive suspend/wakeups always exhibit the problem.
This task depends upon

Closed by  Tom Gundersen (tomegun)
Wednesday, 13 November 2013, 18:14 GMT
Reason for closing:  Upstream
Comment by Gerardo Exequiel Pozzi (djgera) - Tuesday, 01 January 2013, 18:33 GMT
There is nothing to do with systemd. What you need is a script /usr/lib/systemd/systemd-sleep/ to restore settings. See systemd-suspend.service(8) for more info.
Comment by Lukas Jirkovsky (6xx) - Friday, 11 January 2013, 00:35 GMT
I'm pretty sure this is a bug, because:
1) the behavior should be deterministic, not like this (it's often restored for the first time, but not later).
2) this behavior is a serious step back (I dare to say it's a regression), because pm-suspend didn't have such issue.
3) it doesn't make any sense to randomly change settings by doing suspend/resume. If it's possible to recover the settings, systemd should do so. If it is possible to configure systemd in such way, it should be the default configuration.
Comment by Tom Gundersen (tomegun) - Friday, 11 January 2013, 00:36 GMT
What does pm-utils do to make this work? Why is this not a kernel bug?
Comment by Lukas Jirkovsky (6xx) - Friday, 11 January 2013, 16:15 GMT
I have no idea what pm-utils do, but it suspend/resume works perfectly with pm-suspend, while "systemctl suspend" does not. I didn't change enything regarding pm-utils.

I don't know how to verify whether is it a kernel bug. If you could point me where to look, I'd be happy to help.
Comment by Lukas Jirkovsky (6xx) - Friday, 11 January 2013, 16:20 GMT
I tried to suspend using acpitool, which I guess uses only plain ACPI, and it exhibits the same problem as systemd. So it's probably kernel related.
Comment by Tom Gundersen (tomegun) - Saturday, 02 February 2013, 17:30 GMT
Sorry for the delay in getting back to this.

pm-utils has a collection of scripts it runs on suspend/resume in order to (usually) fix kernel issues. systemd also has support for this (see systemd-suspend.service(8)), but by default we don't ship any. As a temporary workaround you could put the correct script in that dir (must be edited slightly, see manpage). However, a permanent fix should be to the kernel so nothing like this is needed at all.
Comment by Lukas Jirkovsky (6xx) - Friday, 08 February 2013, 15:53 GMT
Tom: Thank you for the reply. Shouldn't this bug be changed to kernel bug then, or maybe reported to upstream? I'm not familiar with reporting kernel bugs though (I mean that there's bugzilla, but some devs doesn't apparently use it, then there are several mailing lists…)

Anyway, it would be nice if the systemd provided default script to restore everything by default though.
Comment by jimmy chen (justopenbsd) - Wednesday, 06 March 2013, 13:43 GMT
I got this problem too. when I suspend my computer by pressing Fn+f4 or closing the the laptop, after resume, laptop-mode-tools doesn't work! my hdd doensn't spin down anymore! it is really annoying. but when i use pm-utils, it really resume the settings in laptop-mode-tools.
so I think it is time to figure out some solution to this annoying bug.
my laptop is thinkpad x230 with the newest kernel installed.
btw what is the script? where can I find it?
Comment by sledge (sledge) - Tuesday, 09 April 2013, 11:40 GMT
I disagree: even using pm-suspend, after wake-up my cpu fan spins full speed, blowing cold air (only reboot helps)

Tell me if I am reporting a new bug instead.

32bit Arch Linux on HP 6710b laptop

Many thanks,
Comment by jimmy chen (justopenbsd) - Tuesday, 09 April 2013, 17:33 GMT
to: sledge, in my case, pm-suspend will put the laptop-tools work again after resume. maybe you should reexamine your laptop-tool settings, especially the cpu section. the following is part of my laptop-mode.conf in '/etc/laptop-mode' relating to hdd spin down and cpufreq.conf which locate in '/etc/laptop-mode/conf.d/'.

# Idle timeout values. (hdparm -S)
# Default is 2 hours on AC (NOLM_HD_IDLE_TIMEOUT_SECONDS=7200) and 20 seconds
# for battery and for AC with laptop mode on.


# Should laptop mode tools control the hard drive power management settings?
# Set to 0 to disable default=auto

# Power management for HD (hdparm -B values)


# Legal values are "slowest" for the slowest speed that your
# CPU is able to operate at, "fastest" for the fastest speed,
# "medium" for some value in the middle, or any value listed in
# /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_frequencies.
# The "governor" can be any governor installed on your system, this usually
# includes "ondemand", "conservative", and "performance". The
# "IGNORE_NICE_LOAD" setting specifies that background programs that have
# a low priority ("nice level") should not cause the CPU frequency to
# be increased. (You generally want this to be enabled in battery mode.)

# Should laptop mode tools control the CPU throttling? This is only useful
# on processors that don't have frequency scaling.
# (Only works when you have /proc/acpi/processor/CPU*/throttling.)
# This is only useful on older P4 processors that do not support frequency
# scaling. On such processors, this is the only way to reduce power consumption
# but at the cost of higher performance penalty.
# Enable this only if you have a processor that does not support frequency scaling
# On most new processors, you might want to disable it.
# Set to 0 to disable.

# Legal values are "maximum" for the maximum (slowest) throttling level,
# "minimum" for minimum (fastest) throttling level, "medium" for a value
# somewhere in the middle (this is usually 50% for P4s), or any value listed
# in /proc/acpi/processor/CPU*/throttling. Be careful when using "maximum":
# this may be _very_ slow (in fact, with P4s it slows down the processor
# by a factor 8).

btw, I disabled the systemctl suspend funtion according to the Arch wiki(systemctl). and now i suspend my computer by running pm-suspend first and then close the Lid. although its not very convinient but i cant find another way.
Comment by sledge (sledge) - Tuesday, 09 April 2013, 21:05 GMT
Thank you Jimmy, but I don't even have laptop tools installed, and I started having these problems only after installing >=3.8 kernel (namely, 3.8.4 and up)

Comment by sledge (sledge) - Tuesday, 14 May 2013, 21:28 GMT
Spinning fan issue fixed with kernel 3.9.2-1 . All quiet now :) thanks Linux Kernel community, and Arch packagers ofc!

Laptop: HP 6710b
Comment by roan riddick (riddick) - Wednesday, 13 November 2013, 18:05 GMT
I have the same problem.On my laptop the settings are correctly restored on the first wakeup, but consecutive suspend/wakeups always exhibit the problem. Laptop HP.
Comment by Tom Gundersen (tomegun) - Wednesday, 13 November 2013, 18:14 GMT
This is a kernel bug, please file a report upstream. Userspace should not need to do anything on suspend/resume to restore these settings.