Did I back up whatever the heck I did to get my server to shut down when it switches to UPS after yesterday's #Debian reinstall? No, of course I didn't! Do I remember what I did several years ago? No, of course not! Looks like this afternoon's #linux adventure is all planned out. My brain is mumbling something about upsmon, but it doesn't have any other details to offer.
🇨🇦Samuel Proulx🇨🇦
in reply to 🇨🇦Samuel Proulx🇨🇦 • • •Sensitive content
I know, let's ask AI! What could go wrong?
Q: How can I get a computer running Debian bookworm to shut down cleanly when it switches to the UPS? The UPS is connected to my computer via a USB cable, but I have no idea what kind it is.
A: To configure your Debian Bookworm system to shut down cleanly when the UPS switches to battery power, you can use a UPS management tool like **apcupsd** or **NUT (Network UPS Tools)**. Here's a step-by-step guide:
### 1. Install a UPS Management Tool
Choose one of the following tools based on your UPS type:
#### Option A: Using ``apcupsd`` (for APC UPS or compatible devices)
1. Install ``apcupsd``:
```bash
sudo apt install apcupsd
```
2. Configure it:
- Edit the configuration file:
```bash
sudo nano /etc/apcupsd/apcupsd.conf
```
- Set parameters like ``UPSNAME`, `UPSCABLE`, `UPSTYPE`, and `DEVICE``. For example:
```
UPSCABLE usb
UPSTYPE usb
DEVICE
```
- Save and exit.
3. Restart the service:
```bash
sudo systemctl restart apcupsd
```
4. Test the setup:
```bash
apcaccess status
```
#### Option B: Using ``NUT`` (for broader UPS support)
1. Install ``NUT``:
```bash
sudo apt install nut
```
2. Detect your UPS:
```bash
sudo nut-scanner
```
This will help identify the driver for your UPS.
3. Configure ``NUT``:
- Edit ``/etc/nut/ups.conf`` to define your UPS.
- Edit ``/etc/nut/upsd.conf` and `/etc/nut/upsmon.conf`` for monitoring and shutdown behavior.
4. Start and enable the service:
```bash
sudo systemctl enable nut-driver.service
sudo systemctl start nut-driver.service
```
### 2. Configure Automatic Shutdown
Both tools allow you to configure thresholds for battery level or runtime. When these thresholds are met, the system will shut down gracefully. Refer to the documentation for the specific tool you choose.
### 3. Test the Setup
Simulate a power outage to ensure the system shuts down as expected.
### Notes:
- If you don't know your UPS type, try connecting it via USB and running ``lsusb` to identify it. Alternatively, use `nut-scanner`` from the NUT package.
- For APC UPS devices, ``apcupsd` is typically easier to set up. For other brands, `NUT`` offers broader compatibility.
Let me know if you need further assistance!
🇨🇦Samuel Proulx🇨🇦
in reply to 🇨🇦Samuel Proulx🇨🇦 • • •🇨🇦Samuel Proulx🇨🇦
in reply to 🇨🇦Samuel Proulx🇨🇦 • • •Okay, does the AI know more about my own hardware than I do?
Scanning USB bus.
No start IP, skipping NUT bus (old connect method)
[nutdev1] driver = "usbhid-ups"
port = "auto"
vendorid = "051D"
productid = "0002"
product = "Back-UPS XS 1500G FW:866.L9 .D USB FW:L9"
serial = "3B1711X25292"
vendor = "American Power Conversion"
bus = "001"
🇨🇦Samuel Proulx🇨🇦
in reply to 🇨🇦Samuel Proulx🇨🇦 • • •MostlyBlindGamer
in reply to 🇨🇦Samuel Proulx🇨🇦 • • •🇨🇦Samuel Proulx🇨🇦
in reply to MostlyBlindGamer • • •