Featured image of post Configuring a UPS to Support Synology Sharing on Debian or fnosNAS

Configuring a UPS to Support Synology Sharing on Debian or fnosNAS

If you have a Synology NAS and a UPS connected via USB, you may want other devices (like servers running Debian or fnosNAS) to take advantage of the UPS status shared by the Synology for safe shutdowns or monitoring.

How to Configure a UPS Supporting Synology Sharing on Debian or fnosNAS

In modern home or small office network environments, an Uninterruptible Power Supply (UPS) is an essential tool for protecting devices from power interruptions. If you have a Synology NAS connected to a UPS via USB, you may want other devices (such as servers running Debian or fnosNAS) to utilize the UPS status shared by the Synology for safe shutdowns or monitoring. This article provides a detailed guide on how to configure a UPS supporting Synology sharing on Debian or fnosNAS, covering the required tools, installation steps, and configuration methods. Whether you are a Linux novice or an experienced user, this tutorial will be helpful!

What is Synology Shared UPS?

Synology NAS supports connecting a UPS via USB and can be set up as a “Network UPS Server.” This means that the Synology can share the UPS status (such as battery level and power outages) with other devices over the network. Client devices can monitor these statuses and perform actions like shutdowns when necessary. This approach is particularly suitable for scenarios where multiple devices share the same UPS, such as home servers, network switches, or other Linux devices.

This article will use Debian as an example for the configuration instructions; however, fnosNAS users can refer to similar steps, with adjustments made for specific system paths or commands.

Synology NAS

Prerequisites

Before starting the configuration, please ensure the following conditions are met:

  1. Synology NAS connected to UPS and Network UPS Server enabled:

    • In Synology DSM, go to “Control Panel > Hardware & Power > UPS.”
    • Check “Enable UPS Support” and “Enable Network UPS Server.”
    • Click “Allowed Synology Devices” and enter the IP address of the client device (e.g., your Debian server).
  2. Network Environment:

    • Ensure that the Synology NAS and client devices are on the same local area network.
    • It is also advisable to connect the network switch or router to the UPS to maintain network communication in the case of a power outage.
  3. Client System:

    • This article uses Debian 12 as an example; fnosNAS users can follow similar steps.
    • Ensure you have root or sudo privileges.
  4. Tool Requirements:

    • The installation of NUT (Network UPS Tools) is required, which is a commonly used UPS management tool for both Synology and Linux systems.

Step 1: Install NUT on Debian

NUT is an open-source tool that facilitates communication with Synology’s UPS server. Here are the steps to install NUT on Debian:

  1. Update the package index:

    1
    
    sudo apt update
    
  2. Install NUT:

    1
    
    sudo apt install nut
    
  3. Verify the installation: Check if NUT is correctly installed:

    1
    
    nut-upsmon -v
    

    If version information displays, the installation was successful.

For fnosNAS (TrueNAS), you may need to install NUT via the command line or plugins. For TrueNAS Core, you can install it using pkg install nut; if you are using TrueNAS SCALE (based on Debian), the steps are the same as above.

Step 2: Configure NUT to Connect to the Synology UPS Server

After installation, you need to configure NUT to act as a client connecting to the Synology’s network UPS server.

  1. Edit the NUT configuration file: The NUT configuration files are typically located in the /etc/nut/ directory. First, edit nut.conf:

    1
    
    sudo nano /etc/nut/nut.conf
    

    Ensure the following content exists:

    1
    
    MODE=netclient
    
  2. Configure UPS monitoring: Edit the upsmon.conf file:

    1
    
    sudo nano /etc/nut/upsmon.conf
    

    Add the following content, replacing SYNOLOGY_IP with the actual IP address of your Synology NAS:

    1
    
    MONITOR ups@SYNOLOGY_IP 1 monuser secret slave
    
    • ups: The default name for the UPS in Synology.
    • monuser and secret: The default username and password for Synology (found in /usr/syno/etc/ups/upsd.users, or leave as default).
    • slave: Indicates that this device is a client of the UPS.
  3. Save and exit: Press Ctrl+O to save, then Ctrl+X to exit.

Step 3: Start and Test the NUT Service

Once the configuration is complete, start the NUT service and test the connection:

  1. Start the NUT client service:

    1
    2
    
    sudo systemctl start nut-monitor
    sudo systemctl enable nut-monitor
    

    The enable command ensures that the service starts automatically upon system reboot.

  2. Check the status: Verify if NUT is running:

    1
    
    sudo systemctl status nut-monitor
    

    If the status displays as active (running), then the service is started successfully.

  3. Test UPS connection: Use the following command to check communication with the Synology UPS server:

    1
    
    upsc ups@SYNOLOGY_IP
    

    If successful, you will see the UPS status information, such as battery level and power status.

Step 4: Set Up Shutdown Policy for Power Outages (Optional)

To ensure the Debian system can safely shut down during a power outage, you can configure a shutdown policy using NUT.

  1. Edit upsmon.conf: Open the configuration file again:

    1
    
    sudo nano /etc/nut/upsmon.conf
    

    Add or adjust the following options:

    1
    2
    3
    4
    5
    
    SHUTDOWNCMD "/sbin/shutdown -h now"
    NOTIFYCMD /usr/sbin/upssched
    NOTIFYFLAG ONLINE SYSLOG+WALL
    NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
    NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC
    
    • SHUTDOWNCMD: Defines the shutdown command.
    • NOTIFYFLAG: Sets the notification method for power outages or low battery.
  2. Restart the NUT service:

    1
    
    sudo systemctl restart nut-monitor
    
  3. Simulate a test: Disconnect the UPS power and observe whether the Debian system can automatically shut down when the battery level is low.

Notes and Common Issues

  1. Compatibility with Synology DSM Versions: This tutorial is tested on DSM 7.x; earlier versions (like DSM 6.x) may require configuration adjustments.

  2. Network Latency: If the network switch is not connected to the UPS, communication may break during a power outage, preventing the client from receiving status updates.

  3. fnosNAS Differences: TrueNAS Core uses a FreeBSD kernel, and configuration file paths may differ (e.g., /usr/local/etc/nut/), but the configuration logic remains the same.

  4. Security: The default monuser/secret password is relatively weak; it is recommended to change it to a custom password on both Synology and the client, ensuring consistency on both ends.

Conclusion

By following these steps, you can successfully configure a UPS supporting Synology sharing on Debian or fnosNAS. Not only does this protect your devices from power interruptions, but it also enables multi-device collaboration in managing UPS status. This solution is simple and efficient for both home users and small businesses.

If you encounter any issues during the configuration process, feel free to leave a comment below! Also, remember to subscribe to my blog for more practical tutorials related to technology and programming.

Keywords: Synology UPS Sharing, Debian UPS Configuration, fnosNAS UPS, Network UPS Server, NUT Installation Tutorial