Software & AppsOperating SystemLinux

How To Configure UPS with USB Connection in Ubuntu using NUT Driver

Ubuntu 15

In this comprehensive guide, we will walk you through the process of configuring an Uninterruptible Power Supply (UPS) with a USB connection in Ubuntu using the Network UPS Tools (NUT) driver.

Quick Answer

To configure a UPS with a USB connection in Ubuntu using the NUT driver, you need to install NUT on your system, edit the ups.conf file to add your UPS device, set the correct permissions for the USB device, start the UPS driver, and check the UPS status using the upsc command.

Introduction

A UPS is a crucial component of your server infrastructure that ensures the continuous operation of your system in case of power failure. To monitor and manage a UPS in Ubuntu, we use a set of tools and drivers collectively known as Network UPS Tools (NUT).

Pre-requisites

Before we start, ensure that your UPS is connected to your Ubuntu system via USB and is detected by the system. You can verify this by running the command lsusb -v. Look for a line similar to 0463:ffff MGE UPS Systems UPS, which indicates that the UPS is correctly connected.

Installing NUT

If you haven’t already installed NUT on your system, you can do so by running the following command:

sudo apt-get install nut

This command uses the apt-get package manager to install the NUT package. The sudo command is used to run the command with root privileges.

Configuring NUT

The main configuration file for NUT is located at /etc/nut/ups.conf. Open this file in a text editor with root privileges:

sudo nano /etc/nut/ups.conf

In this file, you need to add a section for your UPS device. For an Eaton 5E UPS, you can use the usbhid-ups driver. Add the following lines to the file:

[Eaton5E]
driver = usbhid-ups
port = auto

Here, [Eaton5E] is the name you choose for your UPS. The driver line specifies the driver to use, and port = auto allows the system to automatically detect the UPS.

Setting Permissions

You need to set the correct permissions for the USB device to allow NUT to access it. Run the following command:

sudo chmod 0666 /dev/bus/usb/[bus number]/[device number]

Replace [bus number] and [device number] with the appropriate values from the lsusb output. The chmod command changes the permissions of a file, and 0666 allows read and write access for all users.

Starting the UPS Driver

Once the configuration is done, you can start the UPS driver by running the following command:

sudo upsdrvctl start

The upsdrvctl command is used to control the UPS drivers. The start option starts the driver.

Checking the UPS Status

To check the status of the UPS, run the following command:

upsc Eaton5E

This command should return information about the UPS, such as battery charge, runtime, voltage, and more.

Conclusion

This guide should have provided you with a comprehensive understanding of how to configure a UPS with a USB connection in Ubuntu using the NUT driver. If the usbhid-ups driver does not work, you can try using the blazer_usb driver instead. Always ensure that you have the latest version of NUT installed and that your system is up to date.

For more information on NUT and its drivers, you can refer to the official NUT documentation.

How can I check if my UPS is correctly connected to my Ubuntu system?

You can verify the connection by running the command lsusb -v in the terminal. Look for a line similar to 0463:ffff MGE UPS Systems UPS, which indicates that the UPS is correctly connected.

How do I install NUT on Ubuntu?

You can install NUT by running the command sudo apt-get install nut in the terminal. This command uses the apt-get package manager to install the NUT package. The sudo command is used to run the command with root privileges.

How do I configure NUT for my UPS?

The main configuration file for NUT is located at /etc/nut/ups.conf. Open this file in a text editor with root privileges using the command sudo nano /etc/nut/ups.conf. In this file, you need to add a section for your UPS device using the appropriate driver and port configuration.

How do I set the correct permissions for the USB device?

To set the correct permissions for the USB device, run the command sudo chmod 0666 /dev/bus/usb/[bus number]/[device number]. Replace [bus number] and [device number] with the appropriate values from the lsusb output. The chmod command changes the permissions of a file, and 0666 allows read and write access for all users.

How do I start the UPS driver?

Once the configuration is done, you can start the UPS driver by running the command sudo upsdrvctl start in the terminal. The upsdrvctl command is used to control the UPS drivers, and the start option starts the driver.

How can I check the status of my UPS?

To check the status of the UPS, run the command upsc [UPS name] in the terminal. Replace [UPS name] with the name you chose for your UPS in the configuration file. This command should return information about the UPS, such as battery charge, runtime, voltage, and more.

What can I do if the `usbhid-ups` driver does not work?

If the usbhid-ups driver does not work, you can try using the blazer_usb driver instead. Modify the configuration file /etc/nut/ups.conf accordingly, replacing the driver line with driver = blazer_usb. Always ensure that you have the latest version of NUT installed and that your system is up to date.

Where can I find more information about NUT and its drivers?

For more information on NUT and its drivers, you can refer to the official NUT documentation. The documentation provides detailed information on configuring and managing UPS devices with NUT.

Leave a Comment

Your email address will not be published. Required fields are marked *