This forum is in permanent archive mode. Our new active community can be found here.

UPS and Unix

edited January 2009 in Technology
I know a lot of UPS systems come with software to connect to a Windows machine that will allow you to shut down the machine gracefully in the event of a power failure. Does anyone know of a similar system for Unix/Linux machines?

I realize that most newer machines have an option in the BIOS that tells the computer what to do after a power failure but I'd like to try and find a solution that does not involve the server losing power but instead involves the server gracefully shutting down when the UPS tells it power has been cut and also results in the server booting up when power returns.

Where I live we have two kinds of power failures. We have the very short 2-5 seconds blips that occur perhaps once or twice a year and we have the 4+ hour ones that occur once every few years (if at all). The UPS will take care of the short blips (I don't want the server to shutdown until power is off for 5 minutes or UPS reserve hits 30%) and for longer blips I just leave the server powered down until everything comes back up.
«1

Comments

  • I'd have though UPS systems would work well with Linux due to the majority of servers being Linux based.
  • I'd have though UPS systems would work well with Linux
    They work splendidly with Linux servers, provided you're using professional UPSs and not the consumer grade crap you see at Circuit City. ;^)
  • They work splendidly with Linux servers, provided you're using professional UPSs and not the consumer grade crap you see at Circuit City. ;^)
    Google is your friend
    I was hoping for some first hand experience or recommendations.

    I've found a few in the $100-$200 range that would suit my needs (and work with Unix) but nothing that allows for rebooting when commercial power is restored.
  • I've found a few in the $100-$200 range that would suit my needs (and work with Unix) but nothing that allows for rebooting when commercial power is restored.
    Think about that for a second. Booting up a shut-down computer when power is restored has nothing to do with the operating system. The computer is off. Most UPSes connect via USB cable. A lot of computer can wake on LAN, but I've never heard of one that wakes on USB. If you want your computer to boot when power is restore, that is a setting you change in the BIOS and has nothing to do with the UPS.
  • I've found a few in the $100-$200 range that would suit my needs (and work with Unix) but nothing that allows for rebooting when commercial power is restored.
    Think about that for a second. Booting up a shut-down computer when power is restored has nothing to do with the operating system. The computer is off. Most UPSes connect via USB cable. A lot of computer can wake on LAN, but I've never heard of one that wakes on USB. If you want your computer to boot when power is restore, that is a setting you change in the BIOS and has nothing to do with the UPS.
    I have only seen the option to restore from a power failure not from a shutdown. I don't think what I am looking for exists.

    I thought of a work around involving a robot that pushes the power button when power comes back on (when you lose power a relay closes the contacts between the robot and the commercial power. Once commercial power is restored the robot pushes the button and then opens the contacts. The robot would have some sort of capacitor inside of it to hold enough juice to allow it to open the contacts that provide it with commercial power.) The other option would require the UPS itself to have a network port built-in and be able to use the 'wake on lan' function of the server's NIC card.
  • I thought of a work around involving a robot that pushes the power button when power comes back on (when you lose power a relay closes the contacts between the robot and the commercial power. Once commercial power is restored the robot pushes the button and then opens the contacts. The robot would have some sort of capacitor inside of it to hold enough juice to allow it to open the contacts that provide it with commercial power.) The other option would require the UPS itself to have a network port built-in and be able to use the 'wake on lan' function of the server's NIC card.
    None of that is necessary.

    Using the software, you configure the OS to shutdown if the UPS tells it that it is running on battery. Then the computer will shutdown, and the UPS will stop giving it power. If the BIOS is set to boot the machine when AC power is enabled, then it should boot when the power returns. It's as simple as that. If it doesn't work, then your BIOS just doesn't have that ability.

    Personally, almost every motherboard I've had has that feature enabled, and I have to disable it. It's very annoying when you are working on a computer to have it boot as soon as you connect the power supply to the wall.

    Just so people know, I recently bought the APC Back-UPS ES 750. It is very nice. First off, it has 10 holes, so you can plug a ton of shit into it. Most importantly it has the master port control feature. The way that works is this. You connect your PC to the master port. Then you connect your monitors, speakers, or other perhipherals to the controlled ports. Then you push the button to enable the master control feature. Now whenever your computer shuts down, or goes to sleep, the UPS will completely cut power to your monitors or speakers. This is big savings on the electric bill if you have speakers or monitors that like to go to sleep, but still use electricity while you are sleeping or away from home. Also, if you have your computer's power management configured properly, you can get it to enter what is known as S3 sleep. S3 sleep is when your computer turns almost all the way off. However, if you push a button, it will wake up almost as quickly as it would if you had merely locked the screen. I've got this working on my computer. it's pretty awesome. I can have my room be completely quiet all night while I sleep, but when I wake up, I don't have to wait for the machine to boot.
  • Couldn't you just create a breadboard that counted to 60 once the power came back and then jumped the power switch?
  • Also, if you have your computer's power management configured properly, you can get it to enter what is known as S3 sleep. S3 sleep is when your computer turns almost all the way off. However, if you push a button, it will wake up almost as quickly as it would if you had merely locked the screen. I've got this working on my computer. it's pretty awesome. I can have my room be completely quiet all night while I sleep, but when I wake up, I don't have to wait for the machine to boot.
    S3 is just Stand-by mode. All that gets powered down in that state is the CPU and GPU. The RAM just stays powered, with your encryption keys remaining in it if you have your HD's encrypted. It's not that hard to get working, at least under Windows, just select Stand-by and you're done. Linux just craps about with ACPI power states.

    As for wake-on-lan, I have never gotten it to work, neither anyone I know has gotten it to work. Also, I do not think you can use wake-on-lan after the power has been cut to the computer. Since the computer then goes mechanically off, instead of the soft-off powerstate where the network card is still powered. It would have to turn 'back on' to that powerstate when power returns, and I don't think that happens without, as Scott mentioned, setting the computer to just power (completely) back up after a power cut.
  • None of the computers I have owned have ever had the "turn on when power is present" option in the BIOS, I did not even know such a thing existed until just now. I have only ever seen an option of what to do if the machine loses power and then has power restored again. I have also never gotten the "wake on LAN" thing to work either.
  • I have only ever seen an option of what to do if the machine loses power and then has power restored again.
    That's the exact same thing! Look:
    it should boot when the power returns.
    In other words, when the power is restored. Just turn that option on and you're done.
  • I have only ever seen an option of what to do if the machine loses power and then has power restored again.
    That's the exact same thing! Look:
    it should boot when the powerreturns.
    In other words, when the power isrestored. Just turn that option on and you're done.
    A BIOS option that turns a machine back on after a power failure is not the same as a BIOS option that turns a machine on after it has been turned off.

    After doing some more reading online I am finding that a work around is to have your machine go into hibernation when the UPS indicates a power failure AND having that power fail option set in the BIOS. Because the machine is hibernating there will be no data loss when the power is cut and the "power on power fail" setting in the BIOS will bring it all the way back up (not just back in hibernation).
  • edited January 2009
    When you put your machine into hibernation, wouldn't your BIOS see that as the computer being turned off as it no longer draws power?

    You could use the "Power on at certain time each day" feature if you have it. It won't be as instant but works as a fallback.

    Note to self: Do not Google "Automatic turn on".
    Post edited by Omnutia on
  • Does anyone have a link that describes this "boot on AC power" BIOS option that is not a link to the BIOS option that allows a PC to reboot after a power failure? Google is failing me on this one because I can not find anything about a BIOS option of this nature that is not related to a power failure.
  • edited January 2009
    To clarify this: When no power: PC turns off gracefully. When power, fully charge UPS(?) then turn PC on. Right?
    Post edited by Omnutia on
  • To clarify this: When no power: PC turns off gracefully. When power, fully charge UPS(?) then turn PC on. Right?
    Close.

    When UPS reaches 50% (or less) power on battery (no commercial power) PC turns off gracefully. When commercial power is restored PC powers itself up (regardless of UPS battery charge level).

    I'm also looking into having a 10Kw standby generator installed at my house that runs on LP or NG.
  • When UPS reaches 50% (or less) power on battery (no commercial power) PC turns off gracefully. When commercial power is restored PC powers itself up (regardless of UPS battery charge level).
    That's getting pretty complex for a UPS, and I believe is beyond the abilities of apcupsd. Now, I've only used apcupsd with dumb UPSs, but the general feel I've gotten from it is that the package is still very much unrefined and limited in what it can do. For what you're looking for, you'll either need a UPS that you can program (probably via the serial port) or a separate SNMP server.

    With a bit of hacking, you can get any DD-WRT router to double as a low-power SNMP server. Considering the insanely low power draw that a router has on a UPS, and the fact that it'll always remain on while the UPS is supplying power, you could have a setup where the UPS is monitored by the router (if it has an SNMP monitor built in). It'd work like so:

    On power loss:
    1) Power is lost, UPS alarms and signals the router.
    2) Router begins monitoring the UPS charge level.
    3) At 50% charge, the router signals the server to hibernate.
    4) The router remains online until the UPS battery dies.

    On power restoration:
    1) Router begins to power up immediately. This process will probably take close to a minute.
    2) Router queries the UPS, waits until the UPS is charged to a reasonable level before signaling the server to boot. In case the power is promptly lost again, this way there's a safety charge to gracefully re-hibernate with.
    3) ???
    4) Profit.
  • edited January 2009
    Google is your friend
    Scott, that is crap. I've been trying for weeks to get my UPS to communicate with my family's home server (Ubuntu 8.10). APCUPSD is difficult to configure correctly and, due to rebranding, it's hard to identify exactly what kind of UPS you actually have. It's not some miracle program that works with every UPS.
    Post edited by Victor Frost on
  • A BIOS option that turns a machine back on after a power failure is not the same as a BIOS option that turns a machine on after it has been turned off.
    What? Scott didn't talk about turning the computer back on after just powering off, he talked about the computer automatically turning back on when the power is restored. You asked for help on how to turn a computer back on after it has lost power. You were given that, why do you continue to mumble about into some completely irrelevant route?
    Does anyone have a link that describes this "boot on AC power" BIOS option that is not a link to the BIOS option that allows a PC to reboot after a power failure? Google is failing me on this one because I can not find anything about a BIOS option of this nature that is not related to a power failure.
    Nobody does, because it doesn't exist. If it did, and if you set it to power on, you wouldn't be able to turn the computer off without unplugging the machine. Is it that hard to think a little bit about this?
  • I have that option in one of my towers. Its purpose is to turn the machine back on in the event of a power failure. You can still shut the machine off properly from the OS or by holding the power button for four seconds.
  • edited January 2009
    A BIOS option that turns a machine back on after a power failure is not the same as a BIOS option that turns a machine on after it has been turned off.
    What? Scott didn't talk about turning the computer back on after just powering off, he talked about the computer automatically turning back on when the power isrestored. You asked for help on how to turn a computer back on after it has lost power. You were given that, why do you continue to mumble about into some completely irrelevant route
    This is what Scott wrote:
    Using the software, you configure the OS to shutdown if the UPS tells it that it is running on battery. Then the computer will shutdown, and the UPS will stop giving it power. If the BIOS is set to boot the machine when AC power is enabled, then it should boot when the power returns. It's as simple as that. If it doesn't work, then your BIOS just doesn't have that ability.
    Scott is clearly indicating that this BIOS feature will bring a PC back online after a graceful shutdown, not from a power failure. I'm with you in saying this feature does not exist.

    I'm well aware of the BIOS option that reboots after a power failure. I have never heard of any BIOS feature that works the way Scott described.
    Post edited by HMTKSteve on
  • You could try emailing some of the UPS manufacturers and see if they have any ideas.
  • Scott is clearly indicating that this BIOS feature will bring a PC back online after a graceful shutdown, not from a power failure. I'm with you in saying this feature does not exist.
    WRONG. Look again:
    the UPS will stop giving it power.
    It will cut AC power. Period, that's it, it does NOT matter if you gracefully shut down the computer or not. Absolutely nothing. All that matters is the removing and restoring of AC power.
    I'm well aware of the BIOS option that reboots after a power failure. I have never heard of any BIOS feature that works the way Scott described.
    Scraping together my last patience with you, start thinking, PLEASE. All the freaking option say is "Boot on AC Power restore", not "Boot on power failure" just AC power restore. Enable that, and every single time the computer's AC power is restored, it will boot up. Go try this for yourself, enable that option, gracefully shut down your computer, remove AC power, and then restore AC power. Look, it boots, without there being a power failure. Stop shitting about with your misconceptions please. If we give you your lemons, go make lemon juice.


  • Scott is clearly indicating that this BIOS feature will bring a PC back online after a graceful shutdown, not from a power failure. I'm with you in saying this feature does not exist.

    I'm well aware of the BIOS option that reboots after a power failure. I have never heard of any BIOS feature that works the way Scott described.
    Don't try to put words in my mouth and tell me what I'm saying. I'm saying you are wrong, and I've been saying you are wrong. You are thinking way too hard about this.

    You have a motherboard, and a power supply. When you plug a power supply into the wall, and turn it on, and connect it to a motherboard, it provides power, even if the computer is shut down. This is necessary for the motherboard to draw at least this small amount of power, otherwise how would the power button work? Many modern motherboards have an LED to indicate they are receiving this standby power. You will notice this light turning off after a few seconds if you unplug the computer, or turn the PSU off. When you turn the computer on, the motherboard pulls full power from the PSU. When you turn the computer off, it pulls standby power again. Unless you turn the power supply off, or unless power goes out, the power supply keeps providing this standby power.

    The feature I am talking about, which has been on every modern motherboard I've seen works, like this. If the standby power disappears, thus indicating the computer was unplugged, a power failure, etc. the computer must be off. If standby power reappears after disappearing, and the feature is enabled, the computer will automatically start booting as if the power button was pressed. So the feature may be more accurately described as "Motherboard automatically pushes its own power button if power completely disappears and then reappears".

    So here's the scenario. Power goes out. UPS tells operating system to perform graceful shutdown. The UPS is still providing power from the battery, so the motherboard is still getting standby power. Thus, the feature will not boot the computer when power returns, because the computer doesn't realize power went out. However, if power isn't out long enough for the battery to drain, why did your computer shut down? You should only have the UPS shut down the computer if power really goes out. If it's one of those quick on/off situations the computer shouldn't shutdown at all. If it's not one of those situations, then the battery will drain, the computer will completely loser power, then it will reboot when power returns.

    The problem there, which I just realized, is that if your UPS is completely empty, you don't want to boot your computer. You want to give the UPS a chance to recharge the battery without also putting a strain on that battery by turning on your computer. This is why wake on LAN is useful. Wake on LAN can turn your computer on while it is receiving standby power.

    Lastly, if you have a quality UPS, it should be able to completely cut power to the computer after telling it to shut down. The computer will not receive standby power, the battery will not drain, and it will boot up when power returns.
  • edited January 2009
    otherwise how would the power button work?
    It's a switch. You press it and the contacts close, completing the circuit.

    I'm going to test this out this weekend in the following manner:

    1) Set BIOS to boot on Power Fail.
    2) Perform graceful shutdown.
    3) Pull plug out of the wall after PC shuts down.
    4) Wait a few minutes and plug power cord back into wall.

    If the PC boots back up once I plug it in then everything is cool and I all I need to do is find a quality UPS that will cut power to the PC shortly after it sees it has shutdown.

    All I know is that I have several PCs with this feature in the BIOS and they have never powered back up after a graceful shutdown followed by an interruption in AC power. Perhaps I just bought cheap shit and only the better ones have this capability. Or it could be that the hardware I used is so old that the technology did not operate in this manner until more recently.
    Post edited by HMTKSteve on
  • 1) Set BIOS to boot on Power Fail.
    If the PC boots back up once I plug it in then everything is cool and I all I need to do is find a quality UPS that will cut power to the PC shortly after it sees it has shutdown.
    And you'll have to fix the pit in your knowledge and stop calling it Boot on Power Failure. It's Boot on Power Restore. You know what, don't bother, it'll work anyway.
  • otherwise how would the power button work?
    It's a switch. You press it and the contacts close, completing the circuit.

    I'm going to test this out this weekend in the following manner:

    1) Set BIOS to boot on Power Fail.
    2) Perform graceful shutdown.
    3) Pull plug out of the wall after PC shuts down.
    4) Wait a few minutes and plug power cord back into wall.

    If the PC boots back up once I plug it in then everything is cool and I all I need to do is find a quality UPS that will cut power to the PC shortly after it sees it has shutdown.

    All I know is that I have several PCs with this feature in the BIOS and they have never powered back up after a graceful shutdown followed by an interruption in AC power. Perhaps I just bought cheap shit and only the better ones have this capability. Or it could be that the hardware I used is so old that the technology did not operate in this manner until more recently.
    Okay gentlemen, I just tested this with my server. I gracefully shut it down with the boot on power restore option set and unplugged it. I waited a few minutes and plugged it back in. Guess what? It didn't turn on! I guess the ACPI function of the motherboard tells the bios if the computer was intentionally shut down and then the bios decides if the computer really should be turned back on if the power is cut.
  • I tested today with a desktop PC at work:

    1) Yank power while turned on = Reboot
    2) Yank power while turned off = No Reboot
    3) Yank power after putting PC in hibernation = Reboot

    My server arrived and in the BIOS settings for this feature I found the following three options:

    1) Disabled
    2) Power On
    3) Last (leave it in whatever state it was before you lost power)

    Clearly not ALL current computers have the same level of support in the BIOS for this feature.
  • ......
    edited January 2009
    Okay gentlemen, I just tested this with my server. I gracefully shut it down with the boot on power restore option set and unplugged it. I waited a few minutes and plugged it back in. Guess what? It didn't turn on! I guess the ACPI function of the motherboard tells the bios if the computer was intentionally shut down and then the bios decides if the computer really should be turned back on if the power is cut.
    Have you checked that it goes into soft-off mode? Did you absent-mindedly switch off the PSU when unplugging? It works perfectly fine here, I flip the power switch on the extension cord, and voila, everything boots up because its power is restored. Double check your settings for it should just work.
    3) Last (leave it in whatever state it was before you lost power)

    Clearly not ALL current computers have the same level of support in the BIOS for this feature.
    I never heard of 'Last'. It's only logical to say that not every BIOS supports the proprietary crap of other motherboards. ACPI is just a standard that can and should be implemented everywhere for ease of use. We can assume that your BIOS on the tested computer lies to you and only has an Off and Last option. Fucking manufacturers should stop implementing their own shit and just follow the standards. It's a boolean option ffs.
    Post edited by ... on
  • My bios has a setting called "Auto" which is the same thing as Steve's "last". And a boolean on/off isn't the best thing either. I like the Auto option. It's my bios being intelligent for once.
Sign In or Register to comment.