Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1365904 - /var/run/nut/ not created by upsd
Summary: /var/run/nut/ not created by upsd
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: nut
Version: 24
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Michal Hlavinka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-10 12:54 UTC by David Howells
Modified: 2016-11-01 16:22 UTC (History)
1 user (show)

Fixed In Version: nut-2.7.4-3.fc24 nut-2.7.4-4.fc25 nut-2.7.4-3.fc23
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-09-23 16:25:48 UTC


Attachments (Terms of Use)

Description David Howells 2016-08-10 12:54:28 UTC
Description of problem:

upsd and related programs fail to start apparently because /var/run/nut/ does not exist:

systemd[1]: nut-server.service: Failed with result 'exit-code'.
audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=nut-server comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
systemd[1]: nut-server.service: Unit entered failed state.
systemd[1]: nut-server.service: Main process exited, code=exited, status=1/FAILURE
upsd[15817]: Can't chdir to /var/run/nut: No such file or directory
upsd[15817]: Network UPS Tools upsd 2.7.4
upsd[15817]: Can't chdir to /var/run/nut: No such file or directory
upsd[15817]: listening on ::1 port 3493
upsd[15817]: listening on 127.0.0.1 port 3493
upsd[15817]: listening on ::1 port 3493
upsd[15817]: listening on 127.0.0.1 port 3493
upsd[15817]: fopen /var/run/nut/upsd.pid: No such file or directory
audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=nut-server comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
systemd[1]: Started Network UPS Tools - power devices information server.
systemd[1]: nut-driver.service: Failed with result 'exit-code'.
audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=nut-driver comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
systemd[1]: nut-driver.service: Unit entered failed state.
systemd[1]: Failed to start Network UPS Tools - power device driver controller.
systemd[1]: nut-driver.service: Control process exited, code=exited status=1
upsdrvctl[15812]: Network UPS Tools - UPS driver controller 2.7.4
upsdrvctl[15812]: Driver failed to start (exit status=1)
upsdrvctl[15812]: Network UPS Tools - Megatec/Q1 protocol USB driver 0.12 (2.7.4)
upsdrvctl[15812]: Can't chdir to /var/run/nut: No such file or directory
systemd[1]: Starting Network UPS Tools - power device driver controller...


Version-Release number of selected component (if applicable):

nut-2.7.4-1.fc24.x86_64

How reproducible:


Steps to Reproduce:
1. dnf install nut nut-cgi nut-client
2. modify /etc/ups/ups.conf
3. systemctl start nut-server.service

Comment 1 David Howells 2016-08-10 13:08:42 UTC
Manually creating /var/run/nut with mkdir allows the service to start, but this is a temporary fix as /var/run is on tmpfs, also:

upsd[16208]: /var/run/nut is world readable
upsd[16208]: /var/run/nut is world readable

The nut driver (blazer_usb) then fails due to SELinux:

python3[16218]: SELinux is preventing blazer_usb from getattr access on the file /run/udev/data/c189:1.
                
                *****  Plugin catchall (100. confidence) suggests   **************************
                
                If you believe that blazer_usb should be allowed getattr access on the c189:1 file by default.
                Then you should report this as a bug.
                You can generate a local policy module to allow this access.
                Do
                allow this access for now by executing:
                # ausearch -c 'blazer_usb' --raw | audit2allow -M my-blazerusb
                # semodule -X 300 -i my-blazerusb.pp
                
setroubleshoot[16218]: SELinux is preventing blazer_usb from getattr access on the file /run/udev/data/c189:1. For complete SELinux messages. run sealert -l b9e86179-d55c-43d3-8f73-251a55f7c2ae
upsd[16208]: Can't connect to UPS [dsl_ups] (blazer_usb-dsl_ups): No such file or directory
upsd[16208]: Can't connect to UPS [dsl_ups] (blazer_usb-dsl_ups): No such file or directory

Comment 2 David Howells 2016-08-10 13:09:57 UTC
Note that even after I manually create the directory, I still see this:

upsd[16674]: fopen /var/run/nut/upsd.pid: No such file or directory

and nothing appears in the dir.  Is this a holdover from pre-systemd days?

Comment 3 David Howells 2016-08-10 13:32:40 UTC
Further, the blazer_usb driver program can't open the USB device files because it sets its uid & gid to 57 (nut), but the USB device files are owned by root.root and don't grant write permission to other.

If blazer_usb is run by hand with "-a dsl_usb -u root", then it works.

Comment 4 Michal Hlavinka 2016-08-11 16:21:11 UTC
> upsd[16208]: /var/run/nut is world readable

/var/run/nut should be created by systemd-tmpfiles and it should have 0750 permissions 

there was missing ExecStartPre in nut-driver.service so this issue should be fixed

The usb devices nut is interested in have dialout group set, nut is member of that group (see output of "id nut"). It seems that it's more likely selinux issue

Selinux issue is tracked in bug #1339437

Comment 5 Fedora Update System 2016-08-12 09:14:11 UTC
nut-2.7.4-3.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-1c864f40a5

Comment 6 Fedora Update System 2016-08-12 09:14:18 UTC
nut-2.7.4-3.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-0d2525e306

Comment 7 Fedora Update System 2016-08-12 09:14:26 UTC
nut-2.7.4-3.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-8f17c643d3

Comment 8 Fedora Update System 2016-08-12 14:26:58 UTC
nut-2.7.4-3.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-8f17c643d3

Comment 9 Fedora Update System 2016-08-12 20:51:57 UTC
nut-2.7.4-3.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-1c864f40a5

Comment 10 Fedora Update System 2016-08-12 20:52:00 UTC
nut-2.7.4-3.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-0d2525e306

Comment 11 Fedora Update System 2016-09-17 07:23:17 UTC
nut-2.7.4-4.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-8c02066db5

Comment 12 Fedora Update System 2016-09-18 07:23:19 UTC
nut-2.7.4-4.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-8c02066db5

Comment 13 Fedora Update System 2016-09-23 16:25:48 UTC
nut-2.7.4-4.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2016-11-01 13:21:30 UTC
nut-2.7.4-3.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 15 Fedora Update System 2016-11-01 16:22:23 UTC
nut-2.7.4-3.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.