Unable to configure UPS from web.

Patrick_3000

Contributor
Joined
Apr 28, 2021
Messages
167
I am unable to configure the UPS from the web, and all attempts to start the UPS service give the error message "UPS service failed to start." This is probably because I've had the UPS service set up for years, and it worked with previous versions of Truenas, but probably due to a bug, it no longer does. This has been discussed in multiple past threads, for example this one: https://www.truenas.com/community/threads/unable-to-save-ups-config.87877/.

My problem is that the recommended solution in those other threads is to use sqlite to manually edit the Truenas database (which I guess is located at /data/freenas-v1.db) and delete the UPS entry. However, I have absolutely no idea how to do that, have never used sqlite; and am afraid that editing the database would break Truenas.

Does anyone have any other suggestions? Perhaps there's another way to reset the UPS config without editing the database? Or some pointers on editing the database, either with sqlite or another approach?
 
Last edited:
Joined
Jun 2, 2019
Messages
591
1. TrueNAS CORE or SCALE? Or deprecated FreeNAS?
2. Version?
3. Make/Model UPS
 
Last edited:

Dice

Wizard
Joined
Dec 11, 2015
Messages
1,410

Patrick_3000

Contributor
Joined
Apr 28, 2021
Messages
167
TrueNAS Core, version 12.0-U8.1. The UPS is a Cyber Power CPS800AVR, which is on the supported list, but I don't think that matters because the problem is that the UPS service is not configurable at all. I can't even clear the settings and start from scratch because the "save" button for the UPS service is greyed out. It also doesn't matter if I unplug the USB communication cable with the UPS.

Additionally, yes, the threads that mention this are from a couple of years ago, from previous versions of TrueNAS Core, but I think I'm having the same problem as is mentioned in those threads. I've had this same installation since approximately 2015, originally as FreeNAS, and then I upgraded it in place to TrueNAS Core and have updated it regularly to the latest version ever since. The UPS service used to work, but one of updates seemingly broke it in the web GUI, and I didn't notice, probably for a couple of years, because I rarely look at the settings and almost never have power failures. A fresh install, which would probably solve it, would be difficult because the installation is highly configured, and I have a user who relies on the data heavily. I could try doing a fresh install overnight, which would be a last resort, but it's not a preferred solution.

If there is a relatively low-risk way to edit the database at /data/freenas-v1.db and delete the UPS entry, that would be the best solution, but I don't know how to do that.
 
Last edited:

Dice

Wizard
Joined
Dec 11, 2015
Messages
1,410
Alright,
I'm sorry I cant help you here :/

Good luck.
 

Patrick_3000

Contributor
Joined
Apr 28, 2021
Messages
167
I think I may be closer to a solution. I exported the current configuration file using the "Save Config" option under system, general, then installed SQLite on my laptop (which is Linux Mint, not sure if works the same way under Windows). Then I used SQLite to edit the configuration file, which was easy to do in the GUI, and deleted the UPS entry.

Next, I'm going to restore the edited configuration file, without the UPS entry, but I can't do that until tonight because the installation is currently in use. Hopefully this will solve the problem. If it breaks, I can at least restore the unedited config file and go back to what I have.
 

Dice

Wizard
Joined
Dec 11, 2015
Messages
1,410
Nifty!
 

Patrick_3000

Contributor
Joined
Apr 28, 2021
Messages
167
As an update, exporting a config file and editing it with an sqlite browser, then uploading it back into Truenas did not work. Truenas somehow detected that the file had been edited and threw an "invalid configuration" error message and refused to accept the upload.

I have now solved the problem by doing a fresh install of Truneas Core and reentering all configuration information manually. It took a couple of hours, but it was worth it to avoid any further hassles with the corrupted UPS entry. I have now been able to successfully start the UPS service.

Just for the record: it seems that anyone who had the UPS service running on a system before approximately version 11 of Truenas Core (fka Freenas), and who has upgraded in place sequentially all the way to version 12 or 13, is likely to have a corrupted entry for the UPS service in /data/freenas-v1.db which makes it impossible to start or configure the UPS service. Many people have posted about this. I included one such link at the top of this thread. Some people who have had the problem have manually edited /data/freenas-v1.db using an sqlite editor and deleted the UPS service entry, but I couldn't figure out how to do that. Of course, a fresh install solves the problem but is a bit of a hassle.
 
Top