My self-inflicted UPS and computer conundrum

July 17, 2024

Today the area where I live experienced what turned out to be an extended power outage, and I wound up going in to the office. In the process, I wound up shooting myself in the foot as far as my ability to tell from the office if power had returned to home, oddly because I have a UPS at home.

The easy way to use a UPS is just to let it run down until it powers off. But this is kind of abrupt on the computer, even if you've more or less halted it already, and it also means that the computer's load reduces the run time for everything else. In my case this matters a bit because after a power loss, my phone line is typically slow to get DSL signal and sync up, so that I can start doing PPPoE and bring up my Internet connection. So if it looks like the UPS's power is running low, my reflex is to power off the computer and hope that power will come back before the UPS bottoms out and the DSL modem turns off (and thus loses line sync).

The first problem is that this only really works if I'm going to stick around to turn the computer on should the power outage end early enough (before the UPS loses power). That turned out not to be a problem this time; the power outage lasted more than long enough to run the UPS out of power, even with only the minor load of the DSL modem, a five-port switch, and a few other small things. The bigger problem is that because of how I have my computer set up right now due to hardware reasons, if I want the computer to be drawing no power (as opposed to being 'off' in some sense), I have to turn the computer off using the hard power switch on the PSU. Once I've flipped this switch, the computer is off until I flip it back, and if I flip it back with (UPS) power available, the computer will power back up again and start drawing power and all that.

(My BIOS is set to 'always power up when AC power is restored', and apparently one side effect of this is that the chassis fans and so on keep spinning even when the system is 'powered off' from Linux.)

The magic UPS feature I would like to fix this is a one-shot push button switch for every outlet that temporarily switches the outlet to 'wait until AC power returns to give this outlet any power'. With this, I could run 'poweroff' on my computer, then push the button to cut power and have it come back when Toronto Hydro restored service. I believe it might be possible to do this with commands to the UPS, but that mostly doesn't help me since the host that would issue those commands is the one I'm running 'poweroff' on.

(The better solution would be a BIOS and hardware that turns everything off after 'poweroff' even when set to always power up after AC comes back. Possibly this is fixed in a later BIOS revision than I have.)


Comments on this page:

By dcortez at 2024-07-17 11:40:18:

My BIOS is set to 'always power up when AC power is restored', and apparently one side effect of this is that the chassis fans and so on keep spinning even when the system is 'powered off' from Linux.

That's really weird, and not something I've ever seen...

after a power loss, my phone line is typically slow to get DSL signal and sync up, so that I can start doing PPPoE and bring up my Internet connection.

How long are we talking about here? I'm on VDSL2 in Ontario, and I doubt my TP-Link W9970 takes more than a minute or two. Maybe it's less; I think OpenWRT booting up (on a different device on the same power circuit) is the bottleneck. I find VDSL2 modems to be plentiful in thrift stores, so if yours is taking more than a few minutes, maybe spend 5 or 10 dollars to try another.

Your proposed solution of separate switching for each outlet seems way too specialized to become a common feature. UPS receptacles are generally on buses, as in most power strips, so that would be a significant increase in complexity that would preclude its use on inexpensive "consumer" models. And then you'd still need to buy a relatively expensive new UPS—so why not just buy a cheap one and dedicate it to your network equipment?

I got my current UPS for free from an ex-employer's e-waste bin, but they show up in thrift stores too. I think people just don't want to bother with batteries, or balk at the cost of the official ones. Unofficial ones can be had for 25 to 50 dollars, and last a few years (three, like clockwork, in my experience). Generally, any 12-volt sealed lead acid battery that physically fits will work—so you can go smaller to save money—but you may need a pair of F1-to-F2 adapters if the terminal types don't match.

By dcortez at 2024-07-17 17:41:16:

It occurs to me that if you don't need the relevant fans controlled by software or firmware, the simple fix would be to power them from elsewhere. There are fan control hubs that connect to molex or SATA cables, and those cables don't normally have standby power. There are also direct molex-to-fan adapters, but the fans might be too loud without a "low noise adapter" (my Noctua fans came with them; I think they're resistors).

From 193.219.181.219 at 2024-07-17 18:58:09:

I have to turn the computer off using the hard power switch on the PSU. Once I've flipped this switch, the computer is off until I flip it back, and if I flip it back with (UPS) power available, the computer will power back up again and start drawing power and all that.

I ended up using a TP-Link P110 "smart plug" for a related remote-reboot purpose and so far it does the job well – has a physical button, the usual cloud app stuff that's not too shady as far as these things go, and a usable local protocol that I managed to make a Perl CGI frontend for (both python-kasa and go-tapo work as CLI after the last firmware changes).

By cks at 2024-07-17 19:08:33:

This time around my VDSL2 link took just over five minutes to come up from when the DSL modem started, based on its logs. Some of that delay may have been the local DSLAM booting and getting to the point where the modem thought it was even worth trying, but the modem's logs definitely say that it tried xDSL G.994 training repeatedly without any success. This modem is alarmingly old by now, so I suppose I should have a spare in general.

Unfortunately I want to see case fan RPMs and to have the fan speed controlled by the BIOS, which requires them to be hooked up to the motherboard. It's possible that something funny was going on the one (recent) time I noticed this (I don't power my home desktop off very often; it runs 24/7). If I power it down again in the near future I'll try to remember to look again.

By dcortez at 2024-07-17 21:11:05:

Some of that delay may have been the local DSLAM booting

Does your connection normally drop when the power goes out? Bell Canada usually has these on backup power, though perhaps your "extended" outage was just too long. For a remote DSLAM, it's typically four 12-volt batteries in a short brown square-ish pedestal with an electric meter. Usually beside a larger brown cabinet; but sometimes across the street, or pole-mounted in one odd case. (Check a street view of 34 Indian Road in Ottawa for the mounted example—below the electrical cut-out fuses—or 1308 Adirondack Drive for a typical one. Bell attached a generator to the second one during the last multi-day outage, perhaps for the nearby fire station.)

I assume you've already ruled out wake-on-LAN for whatever reason, probably because the machine in question handles your PPPoE and routing—or else you'd have pinged your router.

I wonder whether Bell's fibre connections have backup power and can start up more quickly. People on DSLReports are saying that some third-party ISPs, notably TekSavvy, are selling service via Bell fibre now, which has me considering an upgrade. I guess this remains kind of precarious: still expensive to the wholesalers, with no low-speed options, and a bad court ruling could bring it back to financial non-viability.

Regarding the fans, could there exist some Linux utility—or ACPI-related /sys kludgery—capable of setting their speeds from a shutdown script, possibly to zero? It might be worth checking that, and blowing out the accumulated dust, the next time a kernel security update demands a reboot. I've never tried on a desktop; but Debian has a "fancontrol" package, whose configuration defines a "minimum speed at which the fan still spin." Alternately, I think people have figured out the USB protocols for some fan controllers, such that the speeds can be read and controlled (though not via BIOS as you'd prefer).

By cks at 2024-07-18 11:47:25:

My DSL connection has always survived a power outage that wasn't long enough to run my UPS down (after the UPS gets run down, I can't tell), so there's clearly some battery backup. I don't know if there was enough to survive through the entire 10 hours or so. Wake on LAN is out partly because I have no other machine to generate the necessary WoL traffic, and also because I currently seem to need to hard power off my desktop to get it to no power draw, fans not spinning so they can be cleaned, and so on.

(I suspect that the slow DSL start is partly my DSL modem, which might go away with another one, but then I'd have to pick one (with wifi but without mandatory routing), set it up, and so on.)

By dcortez at 2024-07-18 15:10:21:

then I'd have to pick [a DSL modem] (with wifi but without mandatory routing)

I'm a bit confused about how wi-fi would work without routing. "Bridged mode" is the only way I know of to avoid routing—the W9970 supports it, as does the easily-found SmartRG 505N and probably most models by those vendors. I don't know if they can work with PPPoE via wi-fi, which is my best guess for what you mean.

Personally, I avoid doing wi-fi (or anything else "interesting") on devices with OEM firmware. I'd have to evaluate whether it's reliable, whether the device has backdoors or unfixed flaws ("alarmingly old"...), and so on. OpenWRT-compatible routers for DSL speeds are so easy to find cheaply. But, yeah, figuring all this out is a bit of a project.

By cks at 2024-07-18 15:35:42:

In my DSL modem (which is in fact a SmartRG 505N), I can turn on its wifi base station without making the device into a router; it bridges the wireless network onto the local network. My desktop acts as the (wireless) DHCP server, DNS server, and gateway, passing IPv6 traffic and NAT'ing IPv4 traffic over the PPPoE link. The PPPoE stuff runs on the desktop (along with firewall rules and so on).

(I think in theory I could run PPPoE on my Linux laptop even when it's connected with wifi, assuming I brought the interface up with a manual IP and so on, but I've never tested that. It's been a long time since I even tested wired PPPoE from the laptop, although I did set it up and get it working once for reasons.)

Written on 17 July 2024.
« People at universities travel widely and unpredictably
SSH has become our universal (Unix) external access protocol »

Page tools: View Source, View Normal.
Search:
Login: Password:

Last modified: Wed Jul 17 00:44:09 2024
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.