iMac with insomnia

With 10.6 Console, you can try these some filters.

In the list on the left, select Database Searches > All Messages, and in the upper right, search for "sleep" (no quotes):

8/29/10 10:37:21 AM kernel  System Sleep
8/29/10 12:28:20 PM kernel  Previous Sleep Cause: 5
8/29/10 1:37:35 PM  configd[13] PowerManagement configd: System Sleep prevented by active remote login session (1200 second threshold).
8/29/10 1:37:35 PM  configd[13] PowerManagement configd: tty sleep preventer: /dev/ttys000
8/29/10 3:45:28 PM  kernel  System Sleep
8/29/10 4:34:07 PM  kernel  Previous Sleep Cause: 5
8/29/10 4:56:39 PM  kernel  System Sleep

It went to sleep at 10:37. It woke later at 12:28, and says that the reason it went to sleep before is "Cause 5", which is the only one I ever see. At 1:37, it tried to go to sleep, but didn't because a terminal ("tty") was open, and it stays active for 20 minutes ("1200 second threshold") with no activity. I must have done something intervening because it didn't go to sleep again until 3:45. I woke it again at 4:34, then slept at 4:56.

Under Database Searches > All Messages, "wake":

8/29/10 12:28:20 PM kernel  Wake reason = EHC2
8/29/10 12:28:20 PM kernel  System Wake
8/29/10 12:28:20 PM kernel  USB (EHCI):Port 2 on bus 0x26 has remote wakeup from some device
8/29/10 12:28:20 PM kernel  The USB device Apple Keyboard (Port 2 of Hub at 0x26200000) may have caused a wake by issuing a remote wakeup
8/29/10 12:28:51 PM [0x0-0xfd0fd].backupd-helper[2047]  Not starting Time Machine backup after wake - failed to resolve alias to backup volume
8/29/10 4:34:07 PM  kernel  Wake reason = OHC2 EHC2
8/29/10 4:34:07 PM  kernel  System Wake
8/29/10 4:34:07 PM  kernel  An Unknown USB Device (Port 1 of Hub at 0x26000000), may have caused a wake by being connected
8/29/10 4:34:07 PM  kernel  The USB device BRCM2046 Hub (Port 1 of Hub at 0x6000000) may have caused a wake by being disconnected

Note that these wake times correlate with the "Previous Sleep Cause" messages above. The first one -- "EHC2", "(EHCI): Port 2" is the keyboard. I pressed a key to wake. The second one is more interesting. I know no one was around the computer at 4:34 -- an "unknown USB device" was connected, and "BRCM2046" was disconnected simultaneously (or in immediate succession). A quick search indicates that BRCM2046 is related to Bluetooth, and that makes sense, because I use a Bluetooth mouse, and sometimes when I wake by pressing a key on the keyboard, the mouse has disconnected, and I have to wiggle it a bit to reconnect. When I move the mouse to wake, the message is different. Here is an earlier sequence:

8/28/10 5:53:19 AM  kernel  Wake reason = OHC2
8/28/10 5:53:19 AM  kernel  System Wake
8/28/10 5:53:19 AM  kernel  The USB device BRCM2046 Hub (Port 1 of Hub at 0x6000000) may have caused a wake by issuing a remote wakeup
8/28/10 5:53:19 AM  kernel  The USB device Bluetooth USB Host Controller (Port 1 of Hub at 0x6100000) may have caused a wake by issuing a remote wakeup

So that second wake at 4:37 was spurious, because the mouse decided to give up the connection. If someone was present, they would have seen the Mac wake "by itself". It also went back to sleep a little over 20 minutes later, which is what it is set for. (That Time Machine message after wake is also very common, but it does automatically back up later.)

There are also Sleep and Wake messages under Diagnostic and Usage Information > Diagnostic and Usage Messages. But these seem to be just more detail on success.

I know that playing video with Flash within Safari will allow the display to go to sleep, but not the computer. (Sometimes Flash/Safari gets "stuck" even after closing the page with the Flash, and I have to quit Safari for the system to sleep.) Using an actual media program like DVD Player will of course keep the display on, and the system will not sleep at all. In neither case are there any diagnostic messages that these things have "prevented" sleep.

I have seen the behavior you describe, where the system nods off but then immediately awakens, on an older iMac. But then after it nods off again the second time, it stays asleep. Unfortunately, it's still running 10.4 and the logs and Console app aren't as helpful. It might be some kind of hardware interaction, in which the act of toggling some state is seen as a reason to awaken.

What happens if you simply turn the computer on and don't log in? Does it go to sleep? What about booting from the OS X DVD? I don't know if it is set to sleep in that case; and if not, whether you can open System Preferences and make that change and have it stick. (Workaround: a clean install to an external drive you can boot from, although that does introduce another variable.) If it never ever sleeps in even the most vanilla scenarios, then maybe it is a hardware issue.

Tags:

Macos

Sleep

Mac