8

I'm having a problem with my notebook suspending, but then waking up when I don't want it to (either immediately, or much later when in the bag - I may have two issues to solve here). But for the moment this question is about troubleshooting: is there a command I can run that will tell me what the trigger was for the last resume action? E.g. whether a key was pressed, or the power button, whether it was a wake-on-lan signal, whether it was switching from AC power to batter, etc, etc.

It appears that on Windows you can type powercfg -lastwake to find this out. So I'm looking for the Linux equivalent of that command.

If there is no such command, what do I need to look for, in which log file?

(Mint 16, xfce, Lenova Thinkpad, kernel 3.11.0-12-generic)

3

Since you've got a ThinkPad, besides the other suggestions (preliminary the systemd hint), if you're using the thinkpad_acpi driver, you might want to have a look at /sys/devices/platform/thinkpad_acpi/wakeup_reason. This file contains a number telling you whether the embedded controller woke up your laptop for reasons like low battery (at least I thought it did), dock-removal request, etc.

As Documentation/laptops/thinkpad-acpi.txt states:

wakeup_reason:
    Set to 1 if the system is waking up because the user
    requested a bay ejection.  Set to 2 if the system is
    waking up because the user requested the system to
    undock.  Set to zero for normal wake-ups or wake-ups
    due to unknown reasons.
4

Systems with systemd

On systems that make use of systemd you can look through systemd's log using the journalctl command.

Example

Here, for example my system went to sleep from the lid being closed and then when I opened it, you'd see events related to this like so:

$ journalctl | less
...
May 19 09:04:47 greeneggs.bubba.net kernel: PM: Syncing filesystems ... done.
May 19 09:04:47 greeneggs.bubba.net kernel: PM: Preparing system for mem sleep
May 19 09:33:42 greeneggs.bubba.net kernel: Freezing user space processes ... (elapsed 0.002 seconds) done.
May 19 09:33:42 greeneggs.bubba.net systemd[1]: Time has been changed
May 19 09:33:42 greeneggs.bubba.net systemd-logind[772]: Lid opened.
...

Systems without systemd

For systems that do not use systemd you have a variety of places to look. You could for starters look in the dmesg log. You could also look in /var/log/syslog for messages related to power management or ACPI related events.

I would start by taking a look in /var/log/pm_suspend.log, assuming it exists. Especially on distros such as Linux Mint, you'll likely find messages like this there:

Thu Feb 21 21:21:50 GMT 2013: Running hooks for hibernate.
Running hook /usr/lib/pm-utils/sleep.d/000kernel-change hibernate hibernate:
/usr/lib/pm-utils/sleep.d/000kernel-change hibernate hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/00logging hibernate hibernate:
...

References

  • But, systemd isn't default in Mint or Debian. It's only included as a preview in Debian-stable currently. – insignificant zebra May 27 '14 at 2:05
  • @GuyHughes - yes I know, I'm looking for the way to do this under previous versions. – slm May 27 '14 at 2:11
0

You can start with dmesg, check man dmesg but you might want to try dmesg -k.

  • dmesg -k | wc -l gives 3298 :-) BTW, does this tell me something different to looking at /var/log/kern.log ? – Darren Cook May 27 '14 at 1:59
  • @DarrenCook just identify when the suspend/resume happened and analyse that section which will wc -l to much less. – insignificant zebra May 27 '14 at 2:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.