ERR=Bad file descriptor when running apctest

Bug #1549576 reported by Jeff Lane 
50
This bug affects 11 people
Affects Status Importance Assigned to Milestone
apcupsd (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

Configured apcupsd to monitor a new SmartUPS 1500. apcupsd seems to be ok so far, but before starting the daemon, I tried to run apctest and got this error every time I tried:

bladernr@galactica:~$ apctest

2016-02-24 21:48:34 apctest 3.14.12 (29 March 2014) debian
Checking configuration ...
sharenet.type = Network & ShareUPS Disabled
cable.type = USB Cable
mode.type = USB UPS Driver
Setting up the port ...
Doing prep_device() ...

You are using a USB cable type, so I'm entering USB test mode
Hello, this is the apcupsd Cable Test program.
This part of apctest is for testing USB UPSes.

Getting UPS capabilities...apctest FATAL ERROR in linux-usb.c at line 588
Cannot init USB HID report. ERR=Bad file descriptor
apctest error termination completed

it's connected via UPS cable to my Xenial system.

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: apcupsd 3.14.12-1.1
ProcVersionSignature: Ubuntu 4.4.0-7.22-generic 4.4.2
Uname: Linux 4.4.0-7-generic x86_64
ApportVersion: 2.20-0ubuntu3
Architecture: amd64
CurrentDesktop: Unity
Date: Wed Feb 24 21:47:14 2016
InstallationDate: Installed on 2016-02-11 (13 days ago)
InstallationMedia: Ubuntu 16.04 LTS "Xenial Xerus" - Alpha amd64 (20160210)
SourcePackage: apcupsd
UpgradeStatus: No upgrade log present (probably fresh install)
modified.conffile..etc.apcupsd.apcupsd.conf: [modified]
modified.conffile..etc.default.apcupsd: [modified]
mtime.conffile..etc.apcupsd.apcupsd.conf: 2016-02-24T21:21:35.899894
mtime.conffile..etc.default.apcupsd: 2016-02-24T21:09:50.844014

Revision history for this message
Jeff Lane  (bladernr) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in apcupsd (Ubuntu):
status: New → Confirmed
Changed in apcupsd (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Brenton Wallis (brenton-wallis-k) wrote :

Hi there,

Thought I would add to this, I too am having this issue

APC : 001,018,0450
DATE : 2016-08-06 23:01:35 +1000
HOSTNAME : ubuntuserver
VERSION : 3.14.12 (29 March 2014) debian
UPSNAME : serverups
CABLE : USB Cable
DRIVER : USB UPS Driver
UPSMODE : Stand Alone
STARTTIME: 2016-08-06 22:46:36 +1000
STATUS : COMMLOST
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME : 0 Seconds
NUMXFERS : 0
TONBATT : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
STATFLAG : 0x05000100
END APC : 2016-08-06 23:40:02 +1000

Revision history for this message
veyon (wateveyono) wrote :

Hi!
I got the same bug on the same sysstem (:

Revision history for this message
veyon (wateveyono) wrote :

http://www.apcupsd.org/manual/manual.html#verifying-device-detection-and-driver

It`s looks like that the problem in usbfs

In the Linux kernel usbfs was completely removed in 3.5 so it is completely missing since Ubuntu 12.10...(

Revision history for this message
Jeff Lane  (bladernr) wrote :

Interestingly, on my xenial system (now running 4.4.0-36):
bladernr@galactica:~$ ll /sys/bus/usb/drivers
total 0
drwxr-xr-x 2 root root 0 Sep 7 10:20 hub
drwxr-xr-x 2 root root 0 Sep 7 10:20 uas
drwxr-xr-x 2 root root 0 Sep 7 10:20 usb
drwxr-xr-x 2 root root 0 Sep 7 10:21 usbfs
drwxr-xr-x 2 root root 0 Sep 7 10:20 usbhid
drwxr-xr-x 2 root root 0 Sep 7 10:20 usb-storage
bladernr@galactica:~$ ll /sys/bus/usb/drivers/usbfs/
total 0
--w------- 1 root root 4096 Sep 7 10:21 bind
lrwxrwxrwx 1 root root 0 Sep 7 10:21 module -> ../../../../module/usbcore
-rw-r--r-- 1 root root 4096 Sep 7 10:21 new_id
-rw-r--r-- 1 root root 4096 Sep 7 10:21 remove_id
--w------- 1 root root 4096 Sep 7 10:21 uevent
--w------- 1 root root 4096 Sep 7 10:21 unbind

I looked at apcupsd.com and there is a newer version of the daemon and tools out:
https://sourceforge.net/projects/apcupsd/files/apcupsd%20-%20Stable/3.14.14/

and after compiling and installing them, they appear to work without this issue:
bladernr@galactica:~/development/apcupsd-3.14.14$ sudo /sbin/apctest

2016-09-07 10:41:19 apctest 3.14.14 (31 May 2016) debian
Checking configuration ...
sharenet.type = Network & ShareUPS Disabled
cable.type = USB Cable
mode.type = USB UPS Driver
Setting up the port ...
Doing prep_device() ...

You are using a USB cable type, so I'm entering USB test mode
Hello, this is the apcupsd Cable Test program.
This part of apctest is for testing USB UPSes.

Getting UPS capabilities...SUCCESS

Please select the function you want to perform.

1) Test kill UPS power
2) Perform self-test
3) Read last self-test result
4) View/Change battery date
5) View manufacturing date
6) View/Change alarm behavior
7) View/Change sensitivity
8) View/Change low transfer voltage
9) View/Change high transfer voltage
10) Perform battery calibration
11) Test alarm
12) View/Change self-test interval
 Q) Quit

Select function number:

So looks like the resolution here is to update apcupsd in Ubuntu to the latest version

Revision history for this message
Jeff Lane  (bladernr) wrote :

Also looks like that version is currently in Yakkety... so just needs an SRU into Xenial.

Revision history for this message
veyon (wateveyono) wrote :

Tnx, Jeff Lane (bladernr)!
newer version (3.14.14) https://sourceforge.net/projects/apcupsd/files/apcupsd%20-%20Stable/3.14.14/ of apcupsd works without this issue.
During compiling it was needed to add option --enanable-usb to ./configure

Revision history for this message
elatllat (elatllat) wrote :

Why is this still an issue?

Revision history for this message
thomas (riker1) wrote :

I am having the same issue
on ubuntu 16.04 and ubuntu 18.04
running 3-13.12 apc

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.