networkupstools / nut

The Network UPS Tools repository. UPS management protocol Informational RFC 9271 published by IETF at https://www.rfc-editor.org/info/rfc9271 Please star NUT on GitHub, this helps with sponsorships!
https://networkupstools.org/
Other
2.03k stars 349 forks source link

Can't connect to UPS: Permission denied #1459

Closed OttoUsualConsumer closed 2 years ago

OttoUsualConsumer commented 2 years ago

Hello guys,

I'm new with Linux Mint and I tried connecting my UPS with NUT. I got everything configured but if I open systemctl status nut-server it says:

Can't connect to UPS [ups] (nutdrv_qx-ups): Permission denied

Complete output is:

● nut-server.service - Network UPS Tools - power devices information server
     Loaded: loaded (/lib/systemd/system/nut-server.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-06-29 13:20:02 CEST; 7min ago
   Main PID: 3367 (upsd)
      Tasks: 1 (limit: 38197)
     Memory: 764.0K
     CGroup: /system.slice/nut-server.service
             └─3367 /lib/nut/upsd

Jun 29 13:20:02 Rumhau-PC upsd[3366]: listening on 192.168.178.28 port 3493
Jun 29 13:20:02 Rumhau-PC upsd[3366]: listening on 127.0.0.1 port 3493
Jun 29 13:20:02 Rumhau-PC upsd[3366]: Can't connect to UPS [ups] (nutdrv_qx-ups): No such file or directory
Jun 29 13:20:02 Rumhau-PC upsd[3366]: Can't connect to UPS [ups] (nutdrv_qx-ups): No such file or directory
Jun 29 13:20:02 Rumhau-PC upsd[3366]: /etc/nut/upsd.users is world readable
Jun 29 13:20:02 Rumhau-PC upsd[3366]: /etc/nut/upsd.users is world readable
Jun 29 13:20:02 Rumhau-PC upsd[3367]: Startup successful
Jun 29 13:20:02 Rumhau-PC systemd[1]: Started Network UPS Tools - power devices information server.
Jun 29 13:20:02 Rumhau-PC upsd[3367]: User upsmaster@127.0.0.1 logged into UPS [ups]
Jun 29 13:25:02 Rumhau-PC upsd[3367]: Can't connect to UPS [ups] (nutdrv_qx-ups): Permission denied

I don't know why and dont understand why the permission is denied. I already checked, if nut has permission to the files in /etc/nut, and it has.

journalctl -xe says:

-- 
-- The job identifier is 1895.
Jun 29 13:30:22 Rumhau-PC upsmon[3370]: Poll UPS [ups@127.0.0.1] failed - Driver not connected
Jun 29 13:30:23 Rumhau-PC sudo[7913]: pam_unix(sudo:session): session closed for user root
Jun 29 13:30:26 Rumhau-PC rtkit-daemon[1325]: Supervising 2 threads of 2 processes of 1 users.
Jun 29 13:30:26 Rumhau-PC rtkit-daemon[1325]: Supervising 2 threads of 2 processes of 1 users.
Jun 29 13:30:27 Rumhau-PC upsmon[3370]: Poll UPS [ups@127.0.0.1] failed - Driver not connected
Jun 29 13:30:32 Rumhau-PC upsmon[3370]: Poll UPS [ups@127.0.0.1] failed - Driver not connected
Jun 29 13:30:37 Rumhau-PC upsmon[3370]: Poll UPS [ups@127.0.0.1] failed - Driver not connected
Jun 29 13:30:42 Rumhau-PC upsmon[3370]: Poll UPS [ups@127.0.0.1] failed - Driver not connected
Jun 29 13:30:47 Rumhau-PC gnome-terminal-[3909]: g_menu_insert_item: assertion 'G_IS_MENU_ITEM (item)' failed
Jun 29 13:30:47 Rumhau-PC upsmon[3370]: Poll UPS [ups@127.0.0.1] failed - Driver not connected
Jun 29 13:30:52 Rumhau-PC upsmon[3370]: Poll UPS [ups@127.0.0.1] failed - Driver not connected
Jun 29 13:30:57 Rumhau-PC upsmon[3370]: Poll UPS [ups@127.0.0.1] failed - Driver not connected
Jun 29 13:31:02 Rumhau-PC upsmon[3370]: Poll UPS [ups@127.0.0.1] failed - Driver not connected
Jun 29 13:31:07 Rumhau-PC upsmon[3370]: Poll UPS [ups@127.0.0.1] failed - Driver not connected
Jun 29 13:31:08 Rumhau-PC gnome-terminal-[3909]: g_menu_insert_item: assertion 'G_IS_MENU_ITEM (item)' failed
Jun 29 13:31:12 Rumhau-PC upsmon[3370]: Poll UPS [ups@127.0.0.1] failed - Driver not connected
Jun 29 13:31:17 Rumhau-PC upsmon[3370]: Poll UPS [ups@127.0.0.1] failed - Driver not connected
Jun 29 13:31:22 Rumhau-PC upsmon[3370]: Poll UPS [ups@127.0.0.1] failed - Driver not connected
Jun 29 13:31:27 Rumhau-PC upsmon[3370]: Poll UPS [ups@127.0.0.1] failed - Driver not connected
Jun 29 13:31:31 Rumhau-PC gnome-terminal-[3909]: g_menu_insert_item: assertion 'G_IS_MENU_ITEM (item)' failed
Jun 29 13:31:32 Rumhau-PC upsmon[3370]: Poll UPS [ups@127.0.0.1] failed - Driver not connected

If I start sudo upsdrvctl start The output is:

Network UPS Tools - UPS driver controller 2.7.4
Network UPS Tools - Generic Q* USB/Serial driver 0.28 (2.7.4)
USB communication driver 0.33
Duplicate driver instance detected! Terminating other driver!
Using protocol: Q1 0.07
Can't autodetect number of battery packs [-1/13.60]
Battery runtime will not be calculated (runtimecal not set)

so according to my understanding, in principle everything is ok.

Here my config files:

ups.conf:
user = root
pollinterval = 1
maxretry = 5

[ups]
driver = nutdrv_qx
port = auto
desc="Green Cell UPS01LCD"
vendorid = "0001"
productid = "0000"
upsd.conf
LISTEN 127.0.0.1 3493
LISTEN 192.168.178.28 3493

I'm using Linux Mint 20.3 if relevant and its a Green Cell UPS01LCD.

I also tried using the blazer_usb driver, but same issue.

Hope you can help me!

Thank you in advanced and sorry for my english :)

OttoUsualConsumer commented 2 years ago

okay, I got it fixed now and its fully working. I'm not sure what actually was the problem. i think some kind of rights that were not given, so nut was not able to read the files and folders. I recommend looking at this thread and search for "chown" and you'll find the right permissions for these files: https://wiki.ipfire.org/addons/nut

also you have to add a "ups" user to your system, (I think I read that over).

also I didn't understand there is a configuration for the slaves you don't have to do when you're using your ups only on one system (without slaves). so I also recommend reading the whole documentation on the nuts site: https://networkupstools.org/docs/user-manual.chunked/ar01s02.html

without special uses it's not that long and you understand a bit more how it works, so this is really useful!