FS#21944 - [pm-utils] Suspending does not work

Attached to Project: Arch Linux
Opened by Andrej Podzimek (andrej) - Tuesday, 30 November 2010, 21:57 GMT
Last edited by Andrea Scarpino (BaSh) - Sunday, 16 January 2011, 10:15 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Jan de Groot (JGC)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description:

Suspending the machine using pm-utils and the default ('kernel') functionality does not work.

This works just fine: echo -n disk > /sys/power/state
This doesn't work: pm-hibernate

This means that the power settings widget in KDE cannot suspend the machine.

Additional info:
* package version(s)

pm-utils 1.4.0-1

* config and/or log files etc.

This is the most important line in /var/log/pm-suspend.log:
/usr/lib/pm-utils/pm-functions: line 316: echo: write error: No such file or directory

It is a piece of nonsense, since the /sys/power/state file is (of course) present and 'works' as expected when used manually. The script must see a different filesystem for some reason. Does it unmount/remount the /sys filesystem? That seems to be the only possible explanation.

The configuration is very simple:

# grep '^[^#]' /etc/pm/config.d/defaults
SLEEP_MODULE='kernel'
SUSPEND_MODULES=(xhci_hcd)

Steps to reproduce:
Try to suspend.
This task depends upon

Closed by  Andrea Scarpino (BaSh)
Sunday, 16 January 2011, 10:15 GMT
Reason for closing:  Not a bug
Additional comments about closing:  user said
Comment by Andrea Scarpino (BaSh) - Tuesday, 30 November 2010, 22:21 GMT
suspension (sleep) works here on 4.5. Which version of KDE are you using? Note that suspension does not work on 4.6 if you aren't using HAL.
Comment by Andrej Podzimek (andrej) - Wednesday, 01 December 2010, 09:25 GMT
I have KDE 4.5 installed and HAL is in use. This seems to be completely unrelated to KDE. The line from /var/log/pm-suspend.log says it all. The fact that KDE cannot suspend the system is just a symptom of the problem.
Comment by Martin Stolpe (BertiBoeller) - Saturday, 04 December 2010, 14:40 GMT
Have you included the "resume" hook into your mkinitcpio.conf?
Comment by Andrej Podzimek (andrej) - Saturday, 04 December 2010, 17:13 GMT
Sure. My swap volume is on LVM, so the "resume" hook is a must.

Anyway, the "resume" hook is unrelated to this issue. Resuming works just fine. Suspending with pm-utils is the only thing that fails. (And consequently, suspending from the KDE menu does not work, since KDE uses pm-utils as well.)

The only question is: How can it happen that the pm-functions script does not see the /sys/power/state file and claims that the file does not exist? This is the obvious cause of the problem. The /sys/power/state file *does* exist on my machine and it works as expected when used directly.
Comment by Andrej Podzimek (andrej) - Tuesday, 07 December 2010, 10:02 GMT
I added the following lines right before the 'echo' that fails:

mount > /tmp/SUSPEND_DEBUG 2>&1
echo >> /tmp/SUSPEND_DEBUG
ls -al /sys/power >> /tmp/SUSPEND_DEBUG 2>&1
echo >> /tmp/SUSPEND_DEBUG
cat /sys/power/state >> /tmp/SUSPEND_DEBUG 2>&1
echo >> /tmp/SUSPEND_DEBUG
echo "${HIBERNATE_MODE}" >> /tmp/SUSPEND_DEBUG

And this is the output:

proc on /proc type proc (rw,relatime)
sys on /sys type sysfs (rw,relatime)
udev on /dev type tmpfs (rw,nosuid,relatime,size=10240k,mode=755)
/dev/mapper/octopus-main on / type btrfs (rw,noatime)
devpts on /dev/pts type devpts (rw)
shm on /dev/shm type tmpfs (rw,nosuid,nodev)
/dev/shm on /tmp type none (rw,nosuid,nodev,bind)
/dev/mapper/octopus-main on /etc type btrfs (rw,nosuid,noatime,subvol=etc)
/dev/mapper/octopus-main on /var type btrfs (rw,nosuid,noatime,subvol=var)
/dev/mapper/octopus-main on /home type btrfs (rw,nosuid,noatime,subvol=home)
rpc_pipefs on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
gvfs-fuse-daemon on /home/andrej/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=andrej)
/dev/sdc on /media/EasternDigital type btrfs (rw,nosuid,nodev,uhelper=hal)

total 0
drwxr-xr-x 2 root root 0 Dec 6 14:29 .
drwxr-xr-x 12 root root 0 Dec 5 00:35 ..
-rw-r--r-- 1 root root 4096 Dec 7 10:50 disk
-rw-r--r-- 1 root root 4096 Dec 7 10:50 image_size
-rw-r--r-- 1 root root 4096 Dec 7 10:50 pm_async
-rw-r--r-- 1 root root 4096 Dec 7 10:50 pm_test
-rw-r--r-- 1 root root 4096 Dec 5 00:35 resume
-rw-r--r-- 1 root root 4096 Dec 6 14:29 state
-rw-r--r-- 1 root root 4096 Dec 7 10:50 wakeup_count

mem disk


A couple of quick observations:

1) There are two empty lines at the end, which means that $HIBERNATE_MODE is empty.
2) The /sys filesystem is mounted and the 'state' file does exist, despite what 'echo' says.
3) The 'mem' and 'disk' tokens are present in the /sys/power/state file, so everything should work normally.

I also re-checked that suspending with just echo -n disk > /sys/power/state works normally.
Comment by Leonid Isaev (lisaev) - Friday, 24 December 2010, 14:37 GMT
I honestly fail to see how this is a pm-utils issue. Indeed, echo "xxx" > /path/xyz will succeed even if xyz does not exist. So checking that /sys/power/state exists is pointless...

It seems like a kernel+particular harwdare (and maybe permission) issue, though. Here are a couple of relevant (perhaps) links:
https://bugs.freedesktop.org/show_bug.cgi?id=31950
https://bugzilla.redhat.com/show_bug.cgi?id=647604

EDIT: Also, just to cover all bases, I would try with SUSPEND_MODULES="" and SLEEP_MODULES="".
Comment by Andrej Podzimek (andrej) - Friday, 24 December 2010, 20:50 GMT
Yes, exactly, echo "xxx" > /path/xyz should always succeed. So the point is that it does *not* succeed when called from that line 316 of /usr/lib/pm-utils/pm-functions. And I have no idea why this happens.

The reason why I report this as a bug is pretty simple:
* Suspending works fine with modprobe -r xhci_hcd; echo -n disk > /sys/power/state. (I usually ban the USB 3.0 module anyway, in which case no unloading is needed.)
* Suspending *fails* with pm-utils (and thus with KDE as well).

That's why I think it *is* a pm-utils issue.

SUSPEND_MODULES has to be set to xhci_hcd, since xhci_hcd does not support suspending. As for SLEEP_MODULE, I have neither uswsusp (which IMO does not work for 99% of hardware and it definitely does not work for this machine), nor tuxonice (which used to be great two years ago, but it somehow died). So 'kernel' is the only possible value for SLEEP_MODULE anyway.
Comment by Leonid Isaev (lisaev) - Thursday, 13 January 2011, 22:35 GMT
Is this still an issue?

Loading...