Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Start up automatically after a power failure - APC UPS

Hi,

I have added an APC Smart-UPS CS 650VA to the Intel iMac (Snow Leopard 10.6.4) that acts as the family file/itunes/bento/etc server. I can see the UPS in the Energy Saver Preferences Pane and have set it to shutdown after 5 minutes on battery power as well as having checked "start up automatically after a power failure"
My issue is that when I pull the plug on the UPS to test it - the iMac runs for 5 minutes and shuts down gracefully (yay!) however when I plug the UPS back in, the iMac does not restart - I need to press the power button on the iMac OR the UPS. I was expecting/hoping that when the UPS went back to "wall" power it would send a signal to the iMac and restart it.
If the UPS runs out of power completely and then gets back on power then the iMac will come back on - this happens whether the iMac shuts down gracefully (as above) or goes down hard (which has happened while I was testing the max uptime of the UPS.

Any thoughts / help appreciated!

Thanks,
Glenn

Intel iMac Core 2 Duo, Mac OS X (10.6)

Posted on Aug 14, 2010 8:40 AM

Reply
24 replies

Aug 17, 2010 8:24 AM in response to BSteely

BSteely wrote:
Then why is there a Start up automatically after a power failure option on the UPS tab of System Preferences > Energy Saver?


So the Mac can start up after a power failure. But if power never left its AC input, how can that be considered a power failure? From the Mac's perspective, there wasn't one.


Yes, on the Power tab, that's what happens.

But what is the same option +*on the UPS tab+* supposed to do? That set of options is in effect +only when the UPS is providing battery power.+

It's either a bug because it doesn't work, or it's a bug because it can't work. Either way, it's a bug.


Maybe. But it hardly seems like it would be confined to a Mac. Are you saying a PC that has been completely shut down can somehow restart under the same conditions?


I don't do Windoze, and that's not the issue anyway. If the option can work, but doesn't, it's a bug. If the option can't work, it should be removed.

Aug 17, 2010 9:50 AM in response to Glenn Gerrard

Can you give the exact model number of your UPS?
I have not been able to find your exact model description on the APC web site.

Something that is not being understood well here is the difference between 'dirty' and 'clean' shutdowns, power states, and how a UPS communicates with a device. A dirty shutdown is the full removal of power from a device. This is what happens when a non-UPS protected device loses power from the wall, or when you yank the power cord from the back of your computer. A clean shutdown is when the system is told to turn off, but power is not removed before this process completes. The important difference in how this applies to the intended behavior here is how the device knows or perceives how the shutdown occurred and what behavior is expected when power returns.

Another key point here is that modern computer systems always have a small amount of power applied to them even when apparently 'shut down'. This 'soft power' state was introduced to allow for special power up capabilities like keyboard input (which the Mac has used since the Classic days), and to increase the longevity of the hardware by not creating a power spike effect seen when electronics are 'hard powered'. Thus, even when your computer is 'off', it knows if there is power present or not.

During a dirty shutdown, the system is never allowed to 'remember' that it was shutdown via normal means and thus when it regains power it knows to behave according to the power options saved to the system. This can also be simulated, by telling the system to act like it has been shut down 'dirty' via a saved command. This is what the command in question here is intended to do, but may not be supported or applied as intended. This process happens before the system shuts down, so that no communication is needed after power returns, so there's no need to argue about how the computer knows to turn on after the power returns - the return of power is the signal needed to follow the information already available to the system, if it is supporting that command properly.

More information about this process can be found here:
http://www.radiotope.com/node/82

Some APC UPS have a 'master power' socket that when the connected device shuts down will cause the other sockets to be turned off in a 'dirty shutdown'. If the UPS in question has this ability, this could be a workaround by connecting the iMac to one of the 'slave' sockets and connecting another device to the master.

Aug 17, 2010 10:14 AM in response to Euchre

Euchre wrote:
. . .
Some APC UPS have a 'master power' socket that when the connected device shuts down will cause the other sockets to be turned off in a 'dirty shutdown'. If the UPS in question has this ability, this could be a workaround by connecting the iMac to one of the 'slave' sockets and connecting another device to the master.


I have an APC with that feature. Tell me this: what would I connect to the Master socket?

The UPS shuts off the slaves when the master is no longer drawing a load. How would I make that device stop drawing power if my Mac is connected to a slave outlet, not to mention the UPS's USB cable?

Aug 17, 2010 1:42 PM in response to Glenn Gerrard

Glenn Gerrard wrote:
All - It seems this is not going to work,


I just replicated and reported this to AppleCare (Case# 173728222), and sent an email with screen prints and system log documenting it.

They aren't exactly interested. The first guy had no idea what a UPS was, and I don't think the second-level guy did, either, but says that since it involves a 3rd-party device, AppleSupport won't get involved. He'll "report" it to engineering, but says there won't be any follow-up.

I'll also report it via the BugReporter site, but that probably won't do any good, either.

So apparently, it's a useless option. 😟

Aug 17, 2010 3:39 PM in response to Pondini

OK - I got it to work.

Euchre - I quoted the wrong UPS, it is the Back-UPS 650 CS, as you can see from the extensive manual ( http://www.apcmedia.com/salestools/ASTE-6Z7VBGR0EN.pdf) I had nothing to go on

Pondini - Many thanks for recreating the issue and creating the trouble ticket - it seems things are "working as designed" though

The underlying issue(s) is that the UPS doesn't power-cycle itself (as suggested by Bsteely) and that even when it does, if the shutdown is graceful (ex. shutdown -h now) then the Mac has no reason to come back on when the UPS does power cycle.

Here's the how/what/why of getting it working:
installed apcupsd ( http://www.apcupsd.com/) and followed the instructions for install/setup there (this removes the UPS tab in System Preferences)

edited the launchd entry for apcupsd to start with the -p --kill-on-powerfail switch. This tells the APC to shut itself off if the power fails (on the Back-UPS the fixed time for this is a ~180 second window)

edited the apcupsd.conf file to shutdown the iMac in 60 seconds or 50% of battery power left, or 5 minutes of battery power left which ever comes first

edited the apccontrol file to call /usr/libexec/upsshutdown instead of shutdown

edited /usr/libexec/upsshutdown to send "shutdown -hu now" in both a normal shutdown or UPS shutdown. the -u simulates a dirty shutdown (see man shutdown) so when the UPS does powercycle it brings the Mac back online.

I have tested pulling the power and within 60 seconds the Mac goes down, about 2 minutes later the UPS shuts down. When main power is back the UPS comes back and the Mac reboots. Additionally, if main power comes back during the 2 minute window, the UPS still goes down and then power cycles (so it doesn't power cycle twice if you follow).

I would prefer not to have used the -p --kill-on-powerfail switch, however I could not figure out how to insert the "normal" -killpower switch via apccontrol in the halt script (or where the halt script is in OS X actually) but I am open to suggestions.

I think the UPS / Start up after a power failure is working - if the UPS drains completely the Mac goes down hard, but reboots as soon as power is back. I think it's a case of working as designed versus working as expected!

Thanks,
Glenn

Aug 17, 2010 10:58 PM in response to Pondini

It would have to be another device that would intelligently shut down when the power goes to backup. In all likelihood that would be another computer. This feature is more common on larger UPS units often used where there are multiple computers. If this isn't the case for you, then I'm a little stuck as to what might be good to plug into that master socket.

Aug 18, 2010 1:02 AM in response to Pondini

Actually - When I woke up this morning I realized 2 important points: The fixed shutdown on the Back-UPS is 120 Seconds (not 180) and I could have made this a little less of a kludge. So here are slightly better steps:

installed apcupsd ( http://www.apcupsd.com/) and followed the instructions for install/setup there (this removes the UPS tab in System Preferences). There is a .dmg, so it's not that difficult to get installed

edited the launchd entry for apcupsd to start with the -p --kill-on-powerfail switch. This tells the APC to shut itself off if the power fails (on the Back-UPS the fixed time for this is a ~120 second window)
"sudo vi /Library/StartupItems/apcupsd"

edited the apcupsd.conf file to shutdown the iMac in 60 seconds or 80% of battery power left, or 5 minutes of battery power left which ever comes first (Basically we want the Mac to shutdown well in advance of the impending power cut (120 seconds))
"sudo vi /etc/apcupsd/apcupsd.conf"

edited the apccontrol file to add the -u switch to the shutdown it calls
"sudo vi /etc/apcupsd/apccontrol"

kill and restart apcupsd

That's it - when the power comes back, the Mac reboots. If power comes back before the 120 second time out on the UPS, the UPS still power cycles and then the Mac reboots

Agreed that I might consider it a little past "average user", though I consider myself to be an average user

Thanks to everyone for the help/ideas/support

Start up automatically after a power failure - APC UPS

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.