Saturday, September 22, 2012

Sleeping Lions

I've had a Mac Pro for about 4 years now and have converted my house to an almost entirely Linux/Mac environment. The only exception is the Win VM that is needed for the Public library's audio books. Wheat I've noticed with OS X is that with each upgrade Apple likes to change little things for no reason what so ever. It's an odd practice and one that causes minor head aches each feline upgrade.

The example is the sleep mechanism in OS X. 10.5 was stable, 10.6 stable still, 10.7 annoying change, 10.8 random settings change.  Why, Apple, why!? At any rate, here's an older post I was going to publish in 2011 that went unfinished and unpublished, but was the reference I needed to fix a new 10.8 issue.

Begin 2011 post:

My main workstation is a Mac Pro 2008. Its the dual quad core intel with 14gb of ram. I run OS X and a Windows XP VM / CentOS 5.5 VM on it at all times. So, when Lion (OS X 10.7) came out the other day I was interested and picked it up via the App store download. I did the upgrade, all went fine. Well, that is except for sleeping.

I usually put the machine to sleep each evening when I retire to bed. It's worked that way since I bought the machine via the small business rep at the Apple store. I like it and am used to it. Well, this didn't work in OS X 10.7. The monitor would sleep, but not the machine itself. So, I did some googleing and eventually came across a post detailing using the pmset command to see what the power management settings were. It looked something like this:

Kim-mp:etc kim$ pmset -g
Active Profiles:
AC Power        -1*
Currently in use:
 hibernatemode    0
 disksleep    10
 womp        0
 networkoversleep    0
 sleep        0 (imposed by 628)
 powerbutton    1
 ttyskeepawake    1
 hibernatefile    /var/vm/sleepimage
 autorestart    0
 panicrestart    157680000
 displaysleep    60

Curious, that process ID#628 is stopping the sleep process from taking place. Ok, what's 628?

Kim-mp:~ kim$ ps -ef | grep 628
    0   628     1   0 10:44PM ??         1:56.59 /usr/sbin/smbd

Huh. Samba is holding up my shutdown? What the? Ok, what's up with Lion and Samba now? I've got a windows based NAS (I know, its headless though and my freenas hasn't gotten set up yet) and my Windows VM that share via SMB. Jeez.

So,  a little more googling lead to an Anandtech review of OS X Lion (here!) that gave good insight into what has happened and why. Ok, no more Samba on Lion for a while till the kinks are worked out. I read on Apple's community support forums the bugs should be gone by 10.7.3 (oh joy!). So, it's either AFP or NFS. Ok, really it's just NFS so my Linux machines would be served as well.

//End 2011 post


Well, I upgraded to Mountain Lion the other day and wouldn't you know it, sleep issue again. I would put the machine to sleep, go to work or bed and when I returned to the workstation, it would be on. My first thought was the dang cat was sitting on my KB again (he and I have been going through some lessons on things he can do and things he can't).  However, today I put the machine into sleep mode and the cat was in one of the bedrooms for the majority of the day. Ok, I need to dig deeper.

So, I looked up the 2011 post above and ran the pmset -g command again.
Kim-mp:tmp kim$ pmset -g
Active Profiles:
AC Power        -1*
Currently in use:
 hibernatemode        0
 womp                 1
 networkoversleep     0
 sleep                0
 powerbutton          1
 ttyskeepawake        1
 hibernatefile        /var/vm/sleepimage
 autorestart          0
 disksleep            10
 displaysleep         60
No process issues like before. So, I gave a look over the settings.  No more panicrestart. Interesting. Womp is set to 1, but in 2011 it was set to 0. A quick man reference showed that womp was WOL during sleep. Ahhh, set to 0. Everything else looked good.

Kim-mp:tmp kim$ sudo pmset womp 0

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
Kim-mp:tmp kim$ pmset -g
Active Profiles:
AC Power        -1*
Currently in use:
 hibernatemode        0
 womp                 0
 networkoversleep     0
 sleep                0
 powerbutton          1
 ttyskeepawake        1
 hibernatefile        /var/vm/sleepimage
 autorestart          0
 disksleep            10
 displaysleep         60
Kim-mp:tmp kim$

All should be good now and hopefully Mountain Lion will finally stay asleep.

Update: It verks!

No comments:

Post a Comment