Protect Your Linux Systems With UPS

Guard Linux systems against unexpected power failures with a open-source-compatible uninterruptible power supply.

Protecting your customers' systems from power failure is a good idea. The good news is that you can do it easily, and relatively inexpensively, even with a Linux workstation, assuming you use the right uninterruptible power supply (UPS) and the necessary software.

At first blush, it may seem odd to pick a UPS for software availability. But with Linux, picking a hardware peripheral by Linux software availability is the best way to guarantee a trouble-free software installation and a trouble-free operation afterwards.

First, before you even buy the UPS hardware, find out whether Linux software exists for it. To do so, check the UPS vendor's site for the unit you are considering.

id
unit-1659132512259
type
Sponsored post

Here are the other desirable features for your UPS:

If you find a UPS system you like, but the vendor doesn't supply Linux UPS software, you may be able to find an open-source software package of network utilities commonly referred to by developers as "NUT" for Network Utilities Tools that supports the UPS you're considering. But one consideration, especially for a workstation user, is that many NUT packages are much more difficult to set up.

The Linux distribution on the system I used for this Recipe is Fedora Core 2. But the vendor Linux package described here should work on any mainstream Linux distribution. Also, the open-source package should install easily on any Linux distribution with automated installation and via RPM, source, or tarball (Linux slang for an archive file in tar or tar.gz format, with the gz being a form of ZIP-like compression) on practically any distribution.

Selecting UPS Hardware for Linux

A UPS is essentially a voltage-regulated inverter wrapped around a big battery. The bigger the battery, the longer the uptime of your workstation running on that battery. Since a UPS can expensive, shop around to keep within your budget. For this Recipe, I wanted to keep my total cost below $125.

My previous UPS, a Belkin 425VA, cost about $100, including shipping, when I bought it in early 2001. While the unit still works, after the serial port jack broke off during a move, there wasn't much point in replacing the battery. Given that power electronics don't improve with age, four years of service meant this UPS was ready for retirement. Since my power requirements hadn't changed much—I got a bigger CPU, but had replaced a15-inch CRT monitor a more energy-efficient 17-inch LCD flat-panel—I didn't see a reason to spend much more than I had four years earlier.

I wanted to buy the biggest battery I could find in a UPS that did power conditioning, subject to reliability constraints. In general, a package in the $75 to $150 range from any reputable vendor should serve typical workstation needs: low-to-midrange CPU, single hard drive, DVD drive, and monitor. But if you need more specific guidance, or you're dealing with something bigger than a workstation, many UPS vendors have wizards on their Web sites to assist you in your choice.

I shopped around, but in the end decided to stick with Belkin. It's a reputable brand, and I've had good experience with them. I found a Belkin with storage capacity comparable in price to Cyberpower. So my new UPS is a Belkin Battery Backup with Surge Protection (550VA), Part #F6C550-AVR. I believe the Belkin vendor proprietary package, Bulldog Plus, to be fairly typical for this type of software.

Installing the Software in Six Steps

OK, since you already know why it's necessary to install the software—here's how! I started by downloading the Bulldog Plus Software Manual. Then I followed the instructions. These should work for any Belkin UPS running this software package.

That's it!

Note: If this program hadn't been written for Red Hat 5.2 and similar vintage Linux distros, even the icon setup would probably have been unnecessary. Given the differences between legacy and modern distros, I was pleasantly surprised that it installed and worked without significant problems.Operating Your UPS

Assuming you've created the icon as shown above, double-click the icon and enter the root password when you're prompted for it, as shown here:

The user interface is fairly self-explanatory, but if you need more information on operation, go to Help > Content. Then go to the entry that interests you or just read the manual. Very little of its functionality is covered here, because in general, the defaults should work well enough for a typical workstation configuration.

The regular monitoring software can also be configured to watch multiple workstations from wherever it is installed.

Remote Control via Web Interface

To run the Web interface, go to: Configure (top left button) > Network (pull-down menu) > HTTP >. Then enable the HTTP function checkbox, which is shown disabled here:

Once you’ve done that, you can open the Web interface, as shown below at the http://localhost:port (port=whatever number you assigned).

The Web interface handles the most rudimentary security level. For example, I could not access pages within the UPS control software via http://localhost:80/filename. Improper attempts to access it got an "Authentication Error" page.

For on-site monitoring from any workstation within a LAN, you can probably secure the UPS best by setting your network firewall to incoming/outgoing Deny All to whichever port number you chose for your UPS Web server in the install. Note: This is the other reason why I recommended setting this during the install process to anything but the default port 80.

I don't recommend using the UPS Web-monitoring software for off-site remote monitoring. The password to enable an admin to modify settings (e.g. Shutdown NOW) is sent over the Net as plain text. The best security fix is to use a mini-SSL (secure sockets layer) server, but that's not what Bulldog Plus did. The NUT package can be configured for SSL, so this is the best choice for offsite remote monitoring.

UPS Testing

I tested the UPS software by simply shutting down the power. The program shut down the computer one minute after power failure and the UPS itself four minutes later, exactly as I set it. The "autosave" button in the Shutdown function was also enabled; it did not save the new text in the Kwrite window I had open, but saving open application files really is the user's problem anyway. If you're about to leave your workstation, save.

The time settings I used are for test purposes only. Since I run a cordless phone with it, my normal setting would be five minutes and ten minutes. That would give someone time to unplug the cordless and plug in a "dumb" phone as well as to permit an orderly unattended shutdown.

The following image shows the shutdown time set screen, which you access via Configure > Actions > Shutdown:

Fixing Software Problems

No matter which UPS you use, there will probably be at least some user-identified software issues. To find out if these issues matter to you, use the Web. For Belkin issues, I can recommend Peter Selinger's page Linux and the Belkin Universal UPS. Here you can find Belkin Bulldog Plus user-driven bug fixes, as well as a discussion of the belkinunv serial-only driver.

For example, here's a relevant passage from that page: "Note: The belkinunv NUT driver requires a modification to the system's startup/shutdown scripts to enable an unsupervised shutdown/recovery. The necessary changes are described in the section Soft Shutdown Workaround on the protocol description page."

Look over Selinger's page mentioned above if not having unsupervised shutdown/recovery is a problem for you. The problem the author cited with soft start on the vendor UPS software really does not apply to the workstation user unless, that is, you want a system to automatically reboot after power failure. This is a problem for a server that runs unattended. If you need the UPS to restart when the power does, follow the instructions on Selinger's page.

If my system gets shut down because of a power problem, I prefer for it to stay down until I personally restore power. More than once, I've seen power come up for a couple of seconds and then go back down while utility power is being restored. So I don't want my system turning itself on (and sometimes back off) until I'm confident that the power problems are over for a while.

Here's the Belkin Bulldog Plus software user bug fix you should put in from this source. First, log in as root. Then:

Vendor-Proprietary Monitor or Open Source?

In general, you can expect a vendor's proprietary UPS software to be relatively easy to install and to include an X-Windows user interface. If the existence or functionality of vendor software is an issue for you, download the appropriate manual before buying to find out whether the software will fit your needs.

Belkin's proprietary program works well enough for a single-user workstation, in my experience. If you need something scriptable, try NUT (the open source UPS monitor/control program discussed below), and see if it works with your UPS.

While the Belkin proprietary software can be configured to run multiple workstations, the NUT package has many options. Also, the NUT package can be configured to handle a server room or larger facility using many UPS systems. It also can run UPS configurations from multiple vendors.

I'd use NUT for remote monitoring and control, because it has an ACL (Access Control List) file. This is important because the IP addresses you specify in the ACL—which defaults to localhost—are white-listed. So they should be the only addresses that can communicate with the UPS. More important, there is a way to set it up for SSL to provide secure, encrypted communication. That information can be found after installation in /usr/share/doc/nut-2.0.0/docs/ssl.txt.

Network UPS Tools - Open Source UPS monitor / control software

NUT is a command line interface-based (CLI) program. To find out if your current or proposed UPS works with NUT, go to the NUT page (mirrored from the MGE UPS Systems page) on the subject.

The "development tree" will have a wider choice of drivers than the "stable" tree, but the risk of their not working is higher. Try the stable tree list first.

NUT installs easily via the yum automated installer for Fedora/Red Hat. Presumably, it will install equally easily via the apt-get (or Debian / Debian-derived) and urpmi (from Mandrake) installers for other distributions, assuming repository support.

Unless you enjoy dealing with dependencies manually, try yum install nut, apt-get install nut, or urpmi nut, according to which installer fits your distribution. Determine whether these programs will install NUT for you before going to the download site listed below.

If you want to learn more about NUT UPS sofware, here are two good resources:

Congratulations! You’ve now added something to the list of things you don't have to worry about. Your Linux systems are now protected against unexpected power failures.

A. LIZARD is an Internet consultant in the San Francisco Bay Area. He has been writing for technology magazines and Web sites since 1987.