How to find reason a notebook wakes up?

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)

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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

Method 2

For the sake of completeness, there is another solution mentioned in this answer to a similar question.

Awakened by power button:

$ sudo dmidecode | grep Wake-up
    Wake-up Type: Power Switch

Awakened by RTC clock:

$ sudo dmidecode | grep Wake-up
    Wake-up Type: APM Timer

Awakened by keyboard:

$ sudo dmidecode | grep Wake-up
    Wake-up Type: PCI PME#

Method 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.

Method 4

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


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x