How to force Mac to into dirty shutdown state on every power off?

3

As Far as I can tell no one has actually solved this debacle. How do you get a mac mini to power on every time the UPS it is connected to restores power? It is easy enough to have the UPS communicate that power is about to turn off so have the mac run the command halt -u, or shutdown -h -u, etc, and many solutions such as powerchute from APC guarantee that it will shutdown etc. But it is not guaranteed that the mac will turn back on. If this bit/ file was permanently set so mac the mac believed that it dirty shutdown every time, whatever hardware is responsible for the power sensing of the power restored would always boot the mac when power is restored, even if the mini was powered off during while it booted. Currently if your mini powers off without dirty shutdown being set you are boned, and you must physically press the power button on the back for it to restart, which is unacceptable if the mini is says 5000 miles away or at the bottom of the ocean. You should be able to get this functionality even if no UPS is involved just by having the mac always try to reboot when power is restored. Has anyone ever figured this out?

ghostsource

Posted 2010-06-30T15:30:24.473

Reputation: 167

So why not just have the UPS kill power out from underneath the computer? – Jeremy L – 2010-06-30T16:15:09.763

2Because killing the power like that leads to corrupt files/filesystems, and no end of other problems? – Dentrasi – 2010-06-30T16:57:22.067

antrasi is right obviously you cannot just cut power. in the man page for shutdown it says that it shuts down the system and then halts for 5 minutes before removing power so that the UPS can cut the power simulating a dirty shutdown. – ghostsource – 2010-06-30T17:16:01.210

Just out of curiosity, do you often find that your Mini is 5000 miles away, or stuck at the bottom of the ocean, then? – Connor W – 2011-05-25T13:37:08.093

2Yes I do. I deploy them into remote locations where they may not be serviceable by a human for days at a time, and we are talking about hundreds of them – ghostsource – 2011-06-01T15:36:11.070

Answers

2

Make sure you only shut down with shutdown -u, and be sure to disconnect power within the next 5 minutes. And, of course, make sure to keep "Start up automatically after a power failure" checked in System Preferences > Energy Saver.

If you try to keep that "dirty" bit set when doing a normal shutdown, it will automatically reboot the moment it finishes shutting down, unless you can magically yank power at just the right moment.

Apple's only modern hardware designed to be booted remotely is the Xserve server, which supports Lights Out Management (LOM). See ipmitool(1) for more information.

Spiff

Posted 2010-06-30T15:30:24.473

Reputation: 84 656

point taken. Thanks for the insight. Although I did not find how to se the dirty it would not be a solution anyways. thanks for your help. I would vote for this solution if I could – ghostsource – 2010-07-01T02:34:44.887

One more thought. If you want an inexpensive, small machine running some form of Mac OS X to install at the bottom of the sea, that always boots when power is applied, consider an Apple TV. Apple TVs run a stripped-down version of Mac OS X v10.4.x, but I wouldn't be surprised if the Apple TV enthusiast community has found ways to install a more full or more recent version of Mac OS X on it. @ghostsource – Spiff – 2010-07-01T03:27:20.820

0

If waiting up to 24 hours before restart is an option, you can turn on "Start Up or Wake" in System Preferences => Energy Saver => Schedule.

waiwai933

Posted 2010-06-30T15:30:24.473

Reputation: 2 293

1This does not work. If you schedule a wakeorpoweron using pmset which is the same as what you are saying, if the power is disconnected the poweron will never occur, try it. This only works if you performa proper shutdown and there is not power disconnect – ghostsource – 2010-06-30T16:04:36.700

@ghostsource What if you also check "Start up automatically after a power failure"? Doesn't that cover all methods of shutdown? – waiwai933 – 2010-06-30T17:53:35.737

This method will boot the mac in the case of a power cut. However this setting will not trigger in case of a proper shutdown which is what we want to have happen ( the upc tells the mac to shutdown). – ghostsource – 2010-06-30T18:39:29.003

@ghostsource Right. Do both the "Start Up or Wake" and the "Start up automatically after a power failure". The first setting boots the computer up for a proper shutdown and the second boots it up in case of ungraceful shutdown. – waiwai933 – 2010-06-30T18:50:36.353

The first setting does not reboot the computer after a proper shutdown and power removal. In terms of the ACPI the wakeorpoweron will only work in the g2 state, this is a state in which the computer can be started from wake on lan. The solution I am looking for will boot the mac from a g3 state which is mechanical off. The only time the mini is able to do achieve a power on from a g3 state is during a power cut. Somehow the the rtc or smc keeps track of this and tells the system to power back on when it senses power. – ghostsource – 2010-06-30T19:10:05.877