on Technology

Recovering from power outages with a Linux Mac Mini

My Debian GNU/Linux server Pluto, which is located in my apartment in Cambridge, is running on a Mac Mini (PowerPC). Over the past few days, I've had several power outages. When the power comes back on, my Windows computer turns back on and, if I need to, I can remotely connect to it from the office. Pluto however, does not automatically turn back on. I need to physically turn it on when I get home from work. This is not acceptable!

On a PC, there is a BIOS option called PWRON After PWR-Fail. This simply turns the computer back on if the power goes out while it is running. Great, but the Mac Mini doesn't have a standard BIOS; it has OpenFirmware! I did lots of Googling and came up with solutions specific to Mac OS X, but that doesn't help me since I'm running Linux. I even discovered the command line utility pmset which can be used to modify power management settings from within OS X (and a nifty option called autorestart which causes the Mac to automatically restart after power failure). I thought maybe I could find the pmset utility for Linux and install that, but that turned up nothing as well.

Eventually, I found the answer in this forum post on an Ubuntu forum. It's amazing how the Ubuntu operating system has created such a huge wealth of information for the Linux community. This huge pool of questions and answers has made finding solutions to common (or not so common) Linux issues much easier over the past few years.

As root, execute the following command:

echo 'server_mode=1' > /proc/pmu/options

You can confirm the changes have been made by running:

cat /proc/pmu/options

If server_mode=1, then you're all set. You can try unplugging the power from your Mac Mini, waiting a few minutes, and plugging it back in. The Mini should turn on as soon as you plug in the power.

Write a Comment

Comment

  1. This is exactly what I was looking for, but when I try to modify /proc/pmu/options, I get “Permission denied”. One would think that sudo would do it, but this is not the case. Did you have to do anything ‘special’ for this to work?

  2. Hey dtsomp,

    Can you ‘sudo cat /proc/pmu/options‘? If you can’t even do that, then something is definitely funky.

    If you can cat it fine, then are you using the echo method I mentioned above to change it or are you trying to edit it with an editor (vi/emacs/nano/etc)?

    I didn’t do anything other than what I mentioned above, so it should work for you as well.

  3. I take that back. I just checked my configuration again and for some reason server_mode has been reset to 0. When I try to echo server_mode=1 I’m also getting a permission denied message (even doing it as sudo)!

    I’m going to play around with this a bit and I’ll post any updates.

  4. Ah ha! I needed to sudo su to become the root user and THEN I was able to do echo server_mode=1 > /proc/pmu/options without getting a “Permission Denied” message.