You are not logged in.

#1 2012-06-15 16:07:54

lagagnon
Member
From: an Island in the Pacific...
Registered: 2009-12-10
Posts: 1,087
Website

pm-utils hook not working as it should

Since finally getting suspend to ram working on my machine I now find that cpu frequency scaling gets confused after a suspend and the frequency on one CPU bumps up to max frequency unnecessarily on a constant basis without any cup load.

I find the solution is to restart the cpufreq module. I have attempted to place a hook in the file /etc/pm/sleep.d/91freq as per the pm-utils wiki. Here is the hook:

#!/bin/bash
case $1 in
    hibernate)
            ;;
    suspend)
            ;;
    thaw)
            ;;
    resume)
            /etc/rc.d/cpufreq restart   
        ;;
    *)  echo "somebody is calling me totally wrong."
            ;;
esac

However that resume hook is not getting executed. I can do it manually after suspend but do not understand why the hook does not work. Any ideas appreciated.

Larry


Philosophy is looking for a black cat in a dark room. Metaphysics is looking for a black cat in a dark room that isn't there. Religion is looking for a black cat in a dark room that isn't there and shouting "I found it!". Science is looking for a black cat in a dark room with a flashlight.

Offline

#2 2012-06-15 16:25:10

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: pm-utils hook not working as it should

Did you make it executable?

Offline

#3 2012-06-15 19:00:38

lagagnon
Member
From: an Island in the Pacific...
Registered: 2009-12-10
Posts: 1,087
Website

Re: pm-utils hook not working as it should

tomk wrote:

Did you make it executable?

Sure did!


Philosophy is looking for a black cat in a dark room. Metaphysics is looking for a black cat in a dark room that isn't there. Religion is looking for a black cat in a dark room that isn't there and shouting "I found it!". Science is looking for a black cat in a dark room with a flashlight.

Offline

#4 2012-06-16 00:54:52

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,178

Re: pm-utils hook not working as it should

Maybe the standard hook for frequency scaling interferes somehow? (Are you sure it isn't being executed as opposed to not doing what you expect?)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#5 2012-06-16 10:32:55

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: pm-utils hook not working as it should

/var/log/pm-suspend.log would be helpful.

Offline

#6 2012-08-01 04:22:54

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: pm-utils hook not working as it should

I'm going to resurrect this thread as it's applicable inasmuch as the hook in /etc/pm/sleep.d/ seems to not get executed. Here's the hook (just a test for screen locking):

#!/bin/bash

case $1 in
        hibernate)
                echo "Hibernate"
        ;;
        suspend)
                LOCK_CMD="/usr/bin/sflock"
                USER=firecat53  # Main user
                USERHOME="/home/$USER"
                BIN="$USERHOME/.local/bin"
                export XAUTHORITY="$USERHOME/.Xauthority"
                for x in /tmp/.X11-unix/*; do
                    DISPLAYNUM=$(echo $x | sed s#/tmp/.X11-unix/X##)
                    if [[ -f "$XAUTHORITY" ]]; then
                            export DISPLAY=":$DISPLAYNUM"
                    fi
                done
                su $USER -c "$LOCK_CMD" &
                echo "Suspending..."
        ;;
        thaw)
                echo "Thaw"
        ;;
        resume)
                echo "Resume"
        ;;
        *)
                echo "Error"
        ;;
esac

/var/log/pm-suspend.log

Warning: Configuration file /etc/laptop-mode/conf.d/board-specific/*.conf is not readable, skipping.

/usr/lib/pm-utils/sleep.d/01laptop-mode resume suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/01grub resume suspend:

/usr/lib/pm-utils/sleep.d/01grub resume suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/00powersave resume suspend:

/usr/lib/pm-utils/sleep.d/00powersave resume suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/00logging resume suspend:

/usr/lib/pm-utils/sleep.d/00logging resume suspend: success.
Tue Jul 31 21:10:21 PDT 2012: Finished.
21:12:44 $ ls -l /etc/pm/sleep.d/
total 4
-rwxr-xr-x 1 firecat53 users 541 Jul 31 21:08 00test.sh

Nothing showing up in the log at all from the hook 'echo' statements. Am I missing something here? Fully updated x86_64.

Thanks,
Scott

Update:
After removing laptop-mode-tools, /var/log/pm-suspend.log changes (but the hook is still not being executed):

Warning: Configuration file /etc/laptop-mode/conf.d/board-specific/*.conf is not readable, skipping.

/usr/lib/pm-utils/sleep.d/01laptop-mode resume suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/01grub resume suspend:

/usr/lib/pm-utils/sleep.d/01grub resume suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/00powersave resume suspend:

/usr/lib/pm-utils/sleep.d/00powersave resume suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/00logging resume suspend:

/usr/lib/pm-utils/sleep.d/00logging resume suspend: success.
Tue Jul 31 21:10:21 PDT 2012: Finished.
Initial commandline parameters: 
Tue Jul 31 21:18:51 PDT 2012: Running hooks for suspend.
Running hook /usr/lib/pm-utils/sleep.d/00logging suspend suspend:
Linux scotty 3.4.7-1-ARCH #1 SMP PREEMPT Sun Jul 29 22:02:56 CEST 2012 x86_64 GNU/Linux
Module                  Size  Used by
xt_hl                   1369  6 
ip6t_rt                 2112  3 
nf_conntrack_ipv6       6650  7 
nf_defrag_ipv6          6401  1 nf_conntrack_ipv6
ipt_REJECT              2281  1 
xt_LOG                 11943  9 
xt_limit                2041  12 
aes_x86_64              7508  3 
cryptd                  8741  0 
aes_generic            26138  1 aes_x86_64
xt_tcpudp               2471  18 
xt_addrtype             2853  4 
xt_state                1295  14 
ip6table_filter         1396  1 
ip6_tables             18198  2 ip6table_filter,ip6t_rt
nf_conntrack_netbios_ns     1077  0 
nf_conntrack_broadcast     1285  1 nf_conntrack_netbios_ns
nf_nat_ftp              1668  0 
nf_nat                 15100  1 nf_nat_ftp
nf_conntrack_ipv4       6871  9 nf_nat
nf_defrag_ipv4          1339  1 nf_conntrack_ipv4
nf_conntrack_ftp        6261  1 nf_nat_ftp
nf_conntrack           61584  8 nf_nat_ftp,nf_conntrack_netbios_ns,nf_nat,xt_state,nf_conntrack_broadcast,nf_conntrack_ftp,nf_conntrack_ipv4,nf_conntrack_ipv6
iptable_filter          1456  1 
ip_tables              16946  1 iptable_filter
x_tables               16954  12 ip6table_filter,xt_hl,ip_tables,xt_tcpudp,xt_limit,xt_state,xt_LOG,iptable_filter,ip6t_rt,ipt_REJECT,ip6_tables,xt_addrtype
dm_mod                 70918  6 
arc4                    1410  2 
radeon                852098  2 
vboxnetflt             16871  0 
vboxdrv              1792406  1 vboxnetflt
i2c_algo_bit            5391  1 radeon
drm_kms_helper         33051  1 radeon
ttm                    64320  1 radeon
drm                   208958  4 ttm,drm_kms_helper,radeon
loop                   18160  0 
snd_atiixp_modem        9414  0 
snd_atiixp             12985  2 
snd_ac97_codec        113300  2 snd_atiixp_modem,snd_atiixp
fuse                   68768  0 
shpchp                 26305  0 
edac_mce_amd           12469  0 
joydev                  9991  0 
snd_pcm                74958  3 snd_ac97_codec,snd_atiixp_modem,snd_atiixp
pci_hotplug            23564  1 shpchp
edac_core              36656  0 
i2c_piix4               8224  0 
snd_page_alloc          7217  3 snd_pcm,snd_atiixp_modem,snd_atiixp
powernow_k8            13360  0 
snd_timer              18966  1 snd_pcm
8139too                20983  0 
snd                    58997  9 snd_ac97_codec,snd_timer,snd_pcm,snd_atiixp_modem,snd_atiixp
serio_raw               4653  0 
8139cp                 19599  0 
mii                     4123  2 8139cp,8139too
hp_wmi                  7866  0 
soundcore               5410  1 snd
i2c_core               20369  5 drm,i2c_piix4,drm_kms_helper,i2c_algo_bit,radeon
k8temp                  3403  0 
ac97_bus                1238  1 snd_ac97_codec
sparse_keymap           3056  1 hp_wmi
evdev                   9754  14 
battery                 6517  0 
thermal                 7959  0 
video                  11307  0 
ac                      2376  0 
button                  4502  0 
mperf                   1299  1 powernow_k8
wmi                     8475  1 hp_wmi
psmouse                70792  0 
processor              26567  2 powernow_k8
b43                   353506  0 
ssb                    48803  1 b43
pcmcia                 35785  2 b43,ssb
bcma                   22757  1 b43
mmc_core               82070  2 b43,ssb
mac80211              395680  1 b43
cfg80211              170106  2 b43,mac80211
rfkill                 15604  3 cfg80211,hp_wmi
pcmcia_core            12253  1 pcmcia
ext4                  424175  2 
crc16                   1359  1 ext4
jbd2                   73919  1 ext4
mbcache                 5977  1 ext4
sr_mod                 14823  0 
cdrom                  35648  1 sr_mod
sd_mod                 29239  3 
pata_acpi               3408  0 
pata_atiixp             4000  2 
ata_generic             3295  0 
libata                167611  3 pata_acpi,ata_generic,pata_atiixp
ohci_hcd               21752  0 
ehci_hcd               41026  0 
scsi_mod              132974  3 libata,sd_mod,sr_mod
usbcore               147565  3 ohci_hcd,ehci_hcd
usb_common               954  1 usbcore
             total       used       free     shared    buffers     cached
Mem:        892988     792436     100552          0      65084     179964
-/+ buffers/cache:     547388     345600
Swap:      2097148      79772    2017376

/usr/lib/pm-utils/sleep.d/00logging suspend suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/00powersave suspend suspend:

/usr/lib/pm-utils/sleep.d/00powersave suspend suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/01grub suspend suspend:

/usr/lib/pm-utils/sleep.d/01grub suspend suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/49bluetooth suspend suspend:

/usr/lib/pm-utils/sleep.d/49bluetooth suspend suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/50netcfg suspend suspend:
suspending interface wlan0 with profile firecat4153
:: firecat4153 down [done]

/usr/lib/pm-utils/sleep.d/50netcfg suspend suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/75modules suspend suspend:

/usr/lib/pm-utils/sleep.d/75modules suspend suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/90clock suspend suspend:

/usr/lib/pm-utils/sleep.d/90clock suspend suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/94cpufreq suspend suspend:

/usr/lib/pm-utils/sleep.d/94cpufreq suspend suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/95led suspend suspend:

/usr/lib/pm-utils/sleep.d/95led suspend suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/98video-quirk-db-handler suspend suspend:
Kernel modesetting video driver detected, not using quirks.

/usr/lib/pm-utils/sleep.d/98video-quirk-db-handler suspend suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/99video suspend suspend:
kernel.acpi_video_flags = 0

/usr/lib/pm-utils/sleep.d/99video suspend suspend: success.
Tue Jul 31 21:18:53 PDT 2012: performing suspend
Tue Jul 31 21:19:26 PDT 2012: Awake.
Tue Jul 31 21:19:26 PDT 2012: Running hooks for resume
Running hook /usr/lib/pm-utils/sleep.d/99video resume suspend:

/usr/lib/pm-utils/sleep.d/99video resume suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/98video-quirk-db-handler resume suspend:

/usr/lib/pm-utils/sleep.d/98video-quirk-db-handler resume suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/95led resume suspend:

/usr/lib/pm-utils/sleep.d/95led resume suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/94cpufreq resume suspend:

/usr/lib/pm-utils/sleep.d/94cpufreq resume suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/90clock resume suspend:

/usr/lib/pm-utils/sleep.d/90clock resume suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/75modules resume suspend:
Reloaded unloaded modules.

/usr/lib/pm-utils/sleep.d/75modules resume suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/50netcfg resume suspend:
resuming interface wlan0 with profile firecat4153
:: firecat4153 up [done]

/usr/lib/pm-utils/sleep.d/50netcfg resume suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/49bluetooth resume suspend:

/usr/lib/pm-utils/sleep.d/49bluetooth resume suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/01grub resume suspend:

/usr/lib/pm-utils/sleep.d/01grub resume suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/00powersave resume suspend:

/usr/lib/pm-utils/sleep.d/00powersave resume suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/00logging resume suspend:

/usr/lib/pm-utils/sleep.d/00logging resume suspend: success.
Tue Jul 31 21:19:47 PDT 2012: Finished.

Offline

#7 2012-08-01 17:12:38

heywire
Member
Registered: 2012-04-27
Posts: 3

Re: pm-utils hook not working as it should

I'm not sure if this is the proper way to get it working, but it worked for me (I found this post when searching for a solution).  After looking at the log, I noticed that all of the other hooks were in /usr/lib/pm-utils/sleep.d.  So I moved my hook there and it is working fine.

Offline

#8 2012-08-01 22:34:11

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: pm-utils hook not working as it should

Yeah it will work there, but it SHOULD be working when put in /etc/pm/sleep.d according to all the documentation! I'm wondering if this is a bug...anyone have a hook actually working on it's own in /etc/pm/sleep.d?

Scott

Edit:

Well, this is rather odd. As a workaround that keeps the hook scripts in /etc/pm/sleep.d, I found that adding an empty file(s) in /usr/lib/pm-utils/sleep.d with the same name(s) of the hook(s) in /etc/pm/sleep.d will trigger the hook(s) to execute.  I don't think this is the way it's supposed to work....but good enough for now.

Edit #2:

Bug report here

Last edited by firecat53 (2012-08-01 22:55:38)

Offline

#9 2012-08-01 22:49:04

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,178

Re: pm-utils hook not working as it should

Using /usr/lib/pm-utils/ is not a solution. User overrides are meant to be under /etc/pm. I checked and my suspend hook for alsa isn't getting triggered on sleep either.  But I don't think that the right thing to do is add it under /usr/lib...

Last edited by cfr (2012-08-01 22:50:19)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#10 2012-08-02 11:28:10

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: pm-utils hook not working as it should

Uhm, i'm using pm-utils 1.4.1-5 and i have not this kind of problem...all of my hooks are executed :

Running hook /etc/pm/sleep.d/99video thaw hibernate:

/etc/pm/sleep.d/99video thaw hibernate: success.
Running hook /etc/pm/sleep.d/98video-quirk-db-handler thaw hibernate:

/etc/pm/sleep.d/98video-quirk-db-handler thaw hibernate: success.
Running hook /etc/pm/sleep.d/95led thaw hibernate:

/etc/pm/sleep.d/95led thaw hibernate: success.
Running hook /etc/pm/sleep.d/94cpufreq thaw hibernate:

/etc/pm/sleep.d/94cpufreq thaw hibernate: success.
Running hook /etc/pm/sleep.d/90clock thaw hibernate:

/etc/pm/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 /etc/pm/sleep.d/75modules thaw hibernate:

/etc/pm/sleep.d/75modules thaw hibernate: success.
Running hook /etc/pm/sleep.d/53calised thaw hibernate:

/etc/pm/sleep.d/53calised thaw hibernate: success.
Running hook /etc/pm/sleep.d/49bluetooth thaw hibernate:

/etc/pm/sleep.d/49bluetooth thaw hibernate: success.
Running hook /etc/pm/sleep.d/10pidgin thaw hibernate:

/etc/pm/sleep.d/10pidgin thaw hibernate: success.
Running hook /etc/pm/sleep.d/01grub thaw hibernate:

/etc/pm/sleep.d/01grub thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/00powersave thaw hibernate:
Blacklisting laptop-mode.
Blacklisting hal-cd-polling.
Blacklisting intel-audio-powersave.
Blacklisting journal-commit.
Blacklisting pcie_aspm.
Blacklisting readahead.
Blacklisting sata_alpm.
Blacklisting sched-powersave.
Blacklisting wireless.
Blacklisting xfs_buffer.
Blacklisting laptop-mode.
Blacklisting hal-cd-polling.
Blacklisting intel-audio-powersave.
Blacklisting journal-commit.
Blacklisting pcie_aspm.
Blacklisting readahead.
Blacklisting sata_alpm.
Blacklisting sched-powersave.
Blacklisting wireless.
Blacklisting xfs_buffer.
service successfully resumed

/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.
gio  2 ago 2012, 13.27.04, CEST: Finished.

And i'm sure they're really executed. Hope this can help...

Offline

#11 2012-08-02 12:34:47

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: pm-utils hook not working as it should

@nierro: 2 questions:
1. Do you have any hooks in /etc/sleep/pm.d that are NOT also in /usr/lib/pm-utils/sleep.d? Most of yours look like duplicate named files
2. For any hooks not also in /usr/lib/pm-utils/sleep.d, do they work for both hibernate AND suspend-to-ram?

Scott

Offline

Board footer

Powered by FluxBB