You are not logged in.
I'm trying to get pm-hibernate to work on my Lenovo T430. When I execute the command my laptop goes to hibernate for 1 second, power button flashes twice, laptop resumes.
From /var/log/pm-suspend.log I get the following error:
/usr/lib/pm-utils/pm-functions: line 316: echo: write error: No such device
The full /var/log/pm-suspend.log can be seen here:
Initial commandline parameters:
Tue Sep 10 02:11:11 EDT 2013: Running hooks for hibernate.
Running hook /usr/lib/pm-utils/sleep.d/00logging hibernate hibernate:
Linux lolhostname 3.10.10-1-ARCH #1 SMP PREEMPT Fri Aug 30 11:30:06 CEST 2013 x86_64 GNU/Linux
Module Size Used by
xhci_hcd 89455 0
rtl8192ce 50615 0
rtlwifi 70827 1 rtl8192ce
rtl8192c_common 36693 1 rtl8192ce
mac80211 455139 2 rtlwifi,rtl8192ce
cfg80211 406112 2 mac80211,rtlwifi
ehci_pci 4120 0
ehci_hcd 47704 1 ehci_pci
usbcore 177183 4 rtlwifi,ehci_hcd,ehci_pci,xhci_hcd
usb_common 1648 1 usbcore
snd_hda_codec_hdmi 29701 1
snd_hda_codec_realtek 35645 1
iTCO_wdt 5407 0
iTCO_vendor_support 1929 1 iTCO_wdt
joydev 9663 0
nls_cp437 5953 1
vfat 10055 1
fat 51547 1 vfat
intel_powerclamp 8802 0
coretemp 6038 0
kvm_intel 128977 0
kvm 376394 1 kvm_intel
arc4 2000 2
crc32_pclmul 3019 0
crc32c_intel 14249 0
ghash_clmulni_intel 4501 0
aesni_intel 46124 2
aes_x86_64 7399 1 aesni_intel
lrw 3565 1 aesni_intel
gf128mul 5858 1 lrw
glue_helper 4609 1 aesni_intel
ablk_helper 1972 1 aesni_intel
cryptd 8473 3 ghash_clmulni_intel,aesni_intel,ablk_helper
microcode 13172 0
psmouse 85132 0
serio_raw 5041 0
evdev 9880 13
pcspkr 2027 0
snd_hda_intel 35309 0
snd_hda_codec 147506 3 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_intel
snd_hwdep 6332 1 snd_hda_codec
snd_pcm 77765 3 snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel
snd_page_alloc 7234 2 snd_pcm,snd_hda_intel
lpc_ich 12849 0
i2c_i801 11237 0
snd_timer 18718 1 snd_pcm
thermal 8620 0
wmi 8283 0
i915 572675 3
intel_agp 10872 1 i915
thinkpad_acpi 61629 0
intel_gtt 12664 2 i915,intel_agp
drm_kms_helper 35438 1 i915
tpm_tis 10921 0
tpm 15091 1 tpm_tis
nvram 5874 1 thinkpad_acpi
tpm_bios 9745 1 tpm
battery 6925 0
snd 58950 8 snd_hda_codec_realtek,snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_hda_codec,snd_hda_intel,thinkpad_acpi
drm 231168 4 i915,drm_kms_helper
mperf 1267 0
soundcore 5418 1 snd
rfkill 15666 3 cfg80211,thinkpad_acpi
i2c_algo_bit 5391 1 i915
i2c_core 23720 5 drm,i915,i2c_i801,drm_kms_helper,i2c_algo_bit
e1000e 221873 0
mei_me 9688 0
mei 61444 1 mei_me
ac 3324 0
video 11328 1 i915
ptp 8180 1 e1000e
pps_core 8857 1 ptp
processor 27755 0
button 4669 1 i915
ext4 456475 2
crc16 1359 1 ext4
mbcache 5866 1 ext4
jbd2 81946 1 ext4
sr_mod 14898 0
sd_mod 30730 4
cdrom 34848 1 sr_mod
ahci 22792 3
libahci 21169 1 ahci
libata 171016 2 ahci,libahci
sdhci_pci 11819 0
sdhci 28627 1 sdhci_pci
scsi_mod 127772 3 libata,sd_mod,sr_mod
mmc_core 94875 2 sdhci,sdhci_pci
total used free shared buffers cached
Mem: 16254308 2326680 13927628 0 28924 486448
-/+ buffers/cache: 1811308 14443000
Swap: 10485756 0 10485756
/usr/lib/pm-utils/sleep.d/00logging hibernate hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/00powersave hibernate hibernate:
/usr/lib/pm-utils/sleep.d/00powersave hibernate hibernate: success.
Running hook /etc/pm/sleep.d/00screensaver-lock hibernate hibernate:
/etc/pm/sleep.d/00screensaver-lock hibernate hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/01grub hibernate hibernate:
/usr/lib/pm-utils/sleep.d/01grub hibernate hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/49bluetooth hibernate hibernate:
/usr/lib/pm-utils/sleep.d/49bluetooth hibernate hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/75modules hibernate hibernate:
Unloading kernel module ehci_hcd...Done.
Unloading kernel module usbcore...Done.
/usr/lib/pm-utils/sleep.d/75modules hibernate hibernate: success.
Running hook /etc/pm/sleep.d/90alsa hibernate hibernate:
/etc/pm/sleep.d/90alsa hibernate hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/90clock hibernate hibernate:
/usr/lib/pm-utils/sleep.d/90clock hibernate hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/94cpufreq hibernate hibernate:
/usr/lib/pm-utils/sleep.d/94cpufreq hibernate hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/95led hibernate hibernate:
/usr/lib/pm-utils/sleep.d/95led hibernate hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/98video-quirk-db-handler hibernate hibernate:
Kernel modesetting video driver detected, not using quirks.
/usr/lib/pm-utils/sleep.d/98video-quirk-db-handler hibernate hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/99video hibernate hibernate:
/usr/lib/pm-utils/sleep.d/99video hibernate hibernate: success.
Tue Sep 10 02:11:12 EDT 2013: performing hibernate
/usr/lib/pm-utils/pm-functions: line 316: echo: write error: No such device
Tue Sep 10 02:11:18 EDT 2013: Awake.
Tue Sep 10 02:11:18 EDT 2013: Running hooks for thaw
Running hook /usr/lib/pm-utils/sleep.d/99video thaw hibernate:
/usr/lib/pm-utils/sleep.d/99video thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/98video-quirk-db-handler thaw hibernate:
/usr/lib/pm-utils/sleep.d/98video-quirk-db-handler thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/95led thaw hibernate:
/usr/lib/pm-utils/sleep.d/95led thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/94cpufreq thaw hibernate:
/usr/lib/pm-utils/sleep.d/94cpufreq thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/90clock thaw hibernate:
/usr/lib/pm-utils/sleep.d/90clock thaw hibernate: success.
Running hook /etc/pm/sleep.d/90alsa thaw hibernate:
Playing raw data '/dev/zero' : Unsigned 8 bit, Rate 8000 Hz, Mono
/etc/pm/sleep.d/90alsa thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/75modules thaw hibernate:
Reloaded unloaded modules.
/usr/lib/pm-utils/sleep.d/75modules thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/49bluetooth thaw hibernate:
/usr/lib/pm-utils/sleep.d/49bluetooth thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/01grub thaw hibernate:
/usr/lib/pm-utils/sleep.d/01grub thaw hibernate: success.
Running hook /etc/pm/sleep.d/00screensaver-lock thaw hibernate:
/etc/pm/sleep.d/00screensaver-lock thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/00powersave thaw hibernate:
/usr/lib/pm-utils/sleep.d/00powersave thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/00logging thaw hibernate:
/usr/lib/pm-utils/sleep.d/00logging thaw hibernate: success.
Tue Sep 10 02:11:20 EDT 2013: Finished.
These are the following lines from /usr/lib/pm-utils/pm-functions
grep -qw "${HIBERNATE_MODE}" /sys/power/disk && \
echo -n "${HIBERNATE_MODE}" > /sys/power/disk
echo -n "disk" > /sys/power/state
The last echo is where pm-suspend.log says pm-hibernate fails.
I've included the pm-utils script:
#!/bin/sh
# vim:noexpandtab
# Default values go here. It is important to _not_ initialize some
# variables here. They are:
#
# PM_CMDLINE
# RESUME_MODULES
#
# for great debugging!
[ "${PM_DEBUG}" = "true" ] && {
export PM_DEBUG
set -x
}
set -a
PM_UTILS_LIBDIR="/usr/lib/pm-utils"
PM_UTILS_ETCDIR="/etc/pm"
PM_UTILS_RUNDIR="/var/run/pm-utils"
PATH=/sbin:/usr/sbin:/bin:/usr/bin:"${PM_UTILS_LIBDIR}"/bin
PM_LOGFILE="/var/log/${STASHNAME}.log"
TEMPORARY_CPUFREQ_GOVERNOR="performance"
LOCKDIR="${PM_UTILS_RUNDIR}/locks"
STORAGEDIR="${PM_UTILS_RUNDIR}/${STASHNAME}/storage"
NA=254
NX=253
DX=252
PM_FUNCTIONS="$PM_UTILS_LIBDIR/functions"
PM_QUIRKDB="$PM_UTILS_LIBDIR/video-quirks"
PM_LKW_QUIRKS="$PM_UTILS_ETCDIR/last_known_working.quirkdb"
# Use c sort order
LC_COLLATE=C
# These should be overridden by defaults and/or config.d settings.
# Specifically, distros should override these by modifying defaults,
# and end users should modify these using files in /etc/pm/config.
HIBERNATE_MODE=""
HIBERNATE_RESUME_POST_VIDEO="no"
SLEEP_MODULE="auto"
# These variables will be handled specially when we load the config file.
SUSPEND_MODULES=""
HOOK_BLACKLIST=""
ADD_PARAMETERS=""
DROP_PARAMETERS=""
PARAMETERS="${STORAGEDIR}/parameters"
INHIBIT="${STORAGEDIR}/inhibit"
PM_CMDLINE="$*"
BEFORE_HOOKS=""
MODULE_HELP=""
SUSPEND_MODULE=""
HIBERNATE_MODULE=""
SUSPEND_HYBRID_MODULE=""
# variables to handle hibernate after suspend support
PM_HIBERNATE_DELAY=900 # 15 minutes
PM_RTC=/sys/class/rtc/rtc0
# when loading configuration files, allow stash-specific ones
# to override the pm-utils global ones.
[ -f "${PM_UTILS_LIBDIR}"/defaults ] && . "${PM_UTILS_LIBDIR}"/defaults
[ -f "${PM_UTILS_LIBDIR}/${STASHNAME}.defaults" ] && \
. "${PM_UTILS_LIBDIR}/${STASHNAME}.defaults"
set +a
for cfg in "${PM_UTILS_ETCDIR}"/config.d/*[!~] \
"${PM_UTILS_ETCDIR}/${STASHNAME}.config.d"/*[!~]; do
[ -f "$cfg" ] || continue
# Ugly, I know. The goal here is to allow multiple files in
# /etc/pm/config.d declare these variables and have those
# declarations add together instead of the last one overwriting
# all the others.
[ "$SUSPEND_MODULES" ] && REAL_SUSPEND_MODULES="$SUSPEND_MODULES"
[ "$HOOK_BLACKLIST" ] && REAL_HOOK_BLACKLIST="$HOOK_BLACKLIST"
[ "$ADD_PARAMETERS" ] && REAL_ADD_PARAMETERS="$ADD_PARAMETERS"
[ "$DROP_PARAMETERS" ] && REAL_DROP_PARAMETERS="$DROP_PARAMETERS"
set -a
. "${cfg}"
SUSPEND_MODULES="$REAL_SUSPEND_MODULES $SUSPEND_MODULES"
HOOK_BLACKLIST="$REAL_HOOK_BLACKLIST $HOOK_BLACKLIST"
ADD_PARAMETERS="$REAL_ADD_PARAMETERS $ADD_PARAMETERS"
DROP_PARAMETERS="$REAL_DROP_PARAMETERS $DROP_PARAMETERS"
set +a
done
. "${PM_FUNCTIONS}"
# Simple little logging function.
# We do it this way because 'echo -n' is not posix.
log()
{
is_set "$LOGGING" || return 0;
local fmt='%s\n'
[ "$1" = "-n" ] && { fmt='%s'; shift; }
printf "$fmt" "$*"
}
profiling() { [ "$PM_PROFILE" = "true" ]; }
if profiling; then
profile() {
local t1 t2 status msg elapsed
msg="$1"
shift
t1="$(date '+%s.%N')"
"$@"
status=$?
t2="$(date '+%s.%N')"
elapsed="$(printf "%s %s - p q" "$t2" "$t1" |dc)"
log "$msg: $(printf "%.3f" $elapsed) ($t2 - $t1)"
return $status
}
else
profile() { shift; "$@"; }
fi
add_before_hooks() {
[ -z "$BEFORE_HOOKS" ] && BEFORE_HOOKS="$*" || \
BEFORE_HOOKS="$BEFORE_HOOKS $*"
}
add_module_help() {
[ -z "$MODULE_HELP" ] && MODULE_HELP="$*" || \
MODULE_HELP="$MODULE_HELP $*"
}
before_hooks()
{
[ -z "$BEFORE_HOOKS" ] && return 0
local meth
for meth in $BEFORE_HOOKS; do
command_exists "$meth" && "$meth"
done
}
sleep_module_help()
{
[ -z "$MODULE_HELP" ] && return 0
local meth
for meth in $MODULE_HELP; do
command_exists "$meth" && "$meth"
done
}
# update PM_CMDLINE iff someone changed our parameters
update_parameters()
{
[ -f "$PARAMETERS.new" ] || return
export PM_CMDLINE="$(get_parameters)"
rm -f "$PARAMETERS.new"
}
# if the user asked us to blacklist any hooks, do it.
load_hook_blacklist()
{
[ "$HOOK_BLACKLIST" ] || return
local hook
for hook in $HOOK_BLACKLIST; do
disablehook "${hook}" "blacklisted by user"
log "Blacklisting ${hook}."
done
}
load_hook_parameters()
{
[ "$DROP_PARAMETERS" ] && remove_parameters $DROP_PARAMETERS
[ "$ADD_PARAMETERS" ] && add_parameters $ADD_PARAMETERS
update_parameters
}
hook_exit_status(){
case $1 in
0) log "success." ;;
$NA) log "not applicable." ;;
$NX) log "not executable." ;;
$DX) log "disabled." ;;
*) log "Returned exit code $1."; return 1 ;;
esac
}
# check to see if a hook is a candidate for being run.
hook_ok()
{
local hook="${1##*/}"
# the actual name as passed to us.
[ -f "$STORAGEDIR/disable_hook:$hook" ] && return $DX
# name with leading digits chopped off the filename
[ -f "$STORAGEDIR/disable_hook:${hook#[0-9][0-9]}" ] && return $DX
[ -x "$1" ] || return $NX
return 0
}
_run_hook() {
# $1 = hook to run
# rest of args passed to hook unchanged.
log "Running hook $*:"
hook_ok "$1" && "$@"
log ""
log -n "$*: "
hook_exit_status $? && LAST_HOOK="${1##*/}" || inhibit
}
if profiling; then
run_hook() { profile "$1:" _run_hook "$@"; }
else
run_hook() { _run_hook "$@"; }
fi
# Run all applicable hooks, logging success and failure as we go.
_run_hooks() {
# $1 = type of hook to find.
# $2 = paramaters to pass to hooks.
# $3 = if present and equal to "reverse", run hooks backwards.
# Currently only power and sleep are meaningful.
local syshooks="${PM_UTILS_ETCDIR}/$1.d"
local phooks="${PM_UTILS_LIBDIR}/$1.d"
command_exists before_hooks && before_hooks
local sort="sort"
local base
local hook
local oifs="${IFS}"
# the next two lines are not a typo or a formatting error!
local nifs="
"
IFS="${nifs}" # tolerate spaces in filenames.
[ "$3" = "reverse" ] && sort="sort -r"
for base in $(IFS="${oifs}"; for f in "$syshooks/"*[!~] "$phooks/"*[!~];
do [ -O "$f" ] && echo ${f##*/} ; done | $sort | uniq) ;
do
IFS="${oifs}"
# if we are running backwards, skip hooks that we did not
# run going forwards due to a hook failing.
[ "$3" -a "$3" = "reverse" -a "$LAST_HOOK" ] && \
[ "$base" \> "$LAST_HOOK" ] && continue
# if we have already inhibited suspend/resume,
# don't run any more hooks.
[ ! "$3" ] && inhibited && break
update_parameters
if [ -f "$syshooks/$base" ]; then
hook="$syshooks/$base"
elif [ -f "$phooks/$base" ]; then
hook="$phooks/$base"
fi
run_hook "$hook" $2
IFS="${nifs}"
done
IFS="${oifs}"
# return value is 1 if something was inhibited, 0 otherwise.
inhibited && return 1 || return 0
}
if profiling; then
run_hooks() { profile "$1 $2:" _run_hooks "$@"; }
else
run_hooks() { _run_hooks "$@"; }
fi
# Try to reinitalize the logfile. Fail unless certian criteria are met.
init_logfile()
{
if [ -z "$1" ]; then
echo "Please pass a filename to init_logfile."
return 1
elif [ -h "$1" ]; then
echo "$1 is a symbolic link, refusing to overwrite."
return 1
elif [ -f "$1" -a ! -O "$1" ]; then
echo "We do not own $1, refusing to overwrite."
return 1
fi
export LOGGING=true
exec >> "$1" 2>&1
}
check_suspend() { [ -n "$SUSPEND_MODULE" ]; }
check_hibernate() { [ -n "$HIBERNATE_MODULE" ]; }
check_suspend_hybrid() { [ -n "$SUSPEND_HYBRID_MODULE" ]; }
# allow autodetection of sleep methods
if [ "$SLEEP_MODULE" = "auto" ]; then
SLEEP_MODULE="tuxonice uswsusp"
fi
for mod in $SLEEP_MODULE; do
mod="${PM_UTILS_LIBDIR}/module.d/${mod}"
[ -f "$mod" ] || continue
. "$mod"
done
# always fall back to kernel methods if nothing else was declared
if [ -z "$SUSPEND_MODULE" ]; then
if grep -q mem /sys/power/state; then
SUSPEND_MODULE="kernel"
do_suspend() { echo -n "mem" >/sys/power/state; }
elif [ -c /dev/pmu ] && pm-pmu --check; then
SUSPEND_MODULE="kernel"
do_suspend() { pm-pmu --suspend; }
elif grep -q standby /sys/power/state; then
SUSPEND_MODULE="kernel"
do_suspend() { echo -n "standby" >/sys/power/state; }
fi
fi
if [ -z "$HIBERNATE_MODULE" ] && \
[ -f /sys/power/disk ] && \
grep -q disk /sys/power/state; then
HIBERNATE_MODULE="kernel"
do_hibernate()
{
[ -n "${HIBERNATE_MODE}" ] && \
grep -qw "${HIBERNATE_MODE}" /sys/power/disk && \
echo -n "${HIBERNATE_MODE}" > /sys/power/disk
echo -n "disk" > /sys/power/state
}
fi
# since the kernel does not directly support hybrid sleep, we do
# something else -- suspend and schedule an alarm to go into
# hibernate if we have slept long enough.
# Only do this if we do not need to do any special video hackery on resume
# from hibernate, though.
if [ -z "$SUSPEND_HYBRID_MODULE" -a -w "$PM_RTC/wakealarm" ] && \
check_suspend && check_hibernate && ! is_set $HIBERNATE_RESUME_POST_VIDEO; \
then
SUSPEND_HYBRID_MODULE="kernel"
do_suspend_hybrid() {
WAKETIME=$(( $(cat "$PM_RTC/since_epoch") + PM_HIBERNATE_DELAY))
echo >"$PM_RTC/wakealarm"
echo $WAKETIME > "$PM_RTC/wakealarm"
if do_suspend; then
NOW=$(cat "$PM_RTC/since_epoch")
if [ "$NOW" -ge "$WAKETIME" -a "$NOW" -lt $((WAKETIME + 30)) ]; then
log "Woken by RTC alarm, hibernating."
# if hibernate fails for any reason, go back to suspend.
do_hibernate || do_suspend
else
echo > "$PM_RTC/wakealarm"
fi
else
# if we cannot suspend, just try to hibernate.
do_hibernate
fi
}
fi
Any directions on what to do next to get my laptop to hibernate?
Last edited by duosspace (2013-09-11 02:50:48)
Offline
Did you actually set up hibernation? Why are you trying to use pm-utils (pm-hibernate)? Pm-utils is a set of scripts that are meant to work around various bugs. Most of those bugs don't exist any longer and pm-utils I don't think is even actively maintained anymore.
You should be using systemctl hibernate. See the wiki to get this working.
Offline
Things work with systemctl suspend
Offline
Why did you mark this is [Solved] if you didn't actually find a solution?! I too think that suspending to RAM is good enough, and that is all I use. Suspend to disk (aka hibernation) is pretty buggy in Linux and typically doens't work quite right anyway.
But the original question was about getting hibernate to work. So "things work with systemctl suspend" does not address the original topic of the thread.
Offline
I have a pretty small SSD but I have 16GB of ram so I made 10GB swap file in /swap and mounted it per instructions about creating swap files.
systemctl hibernate worked at that point but I like having disk space so I'll use suspend.
If battery life becomes an issue while living in suspend I'll sacrifice disk space for battery performance. When I did use pm-utils I never had an issue with hibernate, it just worked which was nice.
Offline
As mentioned earlier, pm-utils is old and deprecated. Its lack of maintenance means that it is trying to work around problems that likely don't exist. In the event that you do find something that can be worked around with a script, systemd actually gives this functionality just in case. See the systemd-sleep man page to learn about the arguments passed to the scripts in /usr/lib/systemd/system-sleep. The function of that directory is almost exactly the same as what pm-utils does, but instead of running the scripts sequentially, systemd stays true to form and just runs them all at the same time.
I still have not found a really valid use for the systemd-sleep function though. If there is something you want to hook into the suspend/sleep cycle (like a screen locker for example) then you should really be using native systemd units or acpid for that functionality.
Offline
Ironically enough speaking about screen locks, this url helped me configure i3lock with suspend. Before writing my unit I tried to hook in to the systemd-sleep but it was just a nightmare. The path of least resistance is typically the best option.
Offline
Interesting… I would have considered using the systemd-sleep to be much easier. Writing a systemd service is by no means hard, but using systemd-sleep you just need a one line script.
Offline